Created
October 16, 2011 13:19
-
-
Save shellexy/1290869 to your computer and use it in GitHub Desktop.
让 stardict 用 GtkStatusIcon 代替 EggTrayIcon 作为系统托盘图标
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/stardict-3.0.1/src/docklet.cpp b/stardict-3.0.1/src/docklet.cpp | |
--- a/stardict-3.0.1/src/docklet.cpp | |
+++ b/stardict-3.0.1/src/docklet.cpp | |
@@ -24,30 +24,12 @@ DockLet::DockLet(GtkWidget *mainwin, boo | |
void DockLet::create_docklet() | |
{ | |
- docklet_ = egg_tray_icon_new("StarDict"); | |
- box_ = gtk_event_box_new(); | |
- if (is_hide_state()) { | |
- gtk_widget_set_tooltip_text(box_, _("StarDict")); | |
- image_ = gtk_image_new_from_pixbuf(normal_icon_); | |
- } else if (is_scan_on()) { | |
- gtk_widget_set_tooltip_text(box_, _("StarDict - Scanning")); | |
- image_ = gtk_image_new_from_pixbuf(scan_icon_); | |
- } else { | |
- gtk_widget_set_tooltip_text(box_, _("StarDict - Stopped")); | |
- image_ = gtk_image_new_from_pixbuf(stop_icon_); | |
- } | |
+ docklet_ = gtk_status_icon_new_from_icon_name("stardict"); | |
+ gtk_status_icon_set_tooltip_text(docklet_, _("StarDict")); | |
- g_signal_connect(G_OBJECT(docklet_), "embedded", | |
- G_CALLBACK(on_embedded), this); | |
- g_signal_connect(G_OBJECT(docklet_), "destroy", | |
- G_CALLBACK(on_destroyed), this); | |
- g_signal_connect(G_OBJECT(box_), "button-press-event", | |
+ g_signal_connect(G_OBJECT(docklet_), "button-press-event", | |
G_CALLBACK(on_btn_press), this); | |
- gtk_container_add(GTK_CONTAINER(box_), image_); | |
- gtk_container_add(GTK_CONTAINER(docklet_), box_); | |
- gtk_widget_show_all(GTK_WIDGET(docklet_)); | |
- | |
/* ref the docklet_ before we bandy it about the place */ | |
g_object_ref(G_OBJECT(docklet_)); | |
} | |
diff --git a/stardict-3.0.1/src/docklet.h b/stardict-3.0.1/src/docklet.h | |
--- a/stardict-3.0.1/src/docklet.h | |
+++ b/stardict-3.0.1/src/docklet.h | |
@@ -15,7 +15,7 @@ public: | |
void minimize_to_tray(); | |
void set_scan_mode(bool); | |
private: | |
- EggTrayIcon *docklet_; | |
+ GtkStatusIcon *docklet_; | |
GtkWidget *box_; | |
GtkWidget *image_; //icon image. | |
typedef ResourceWrapper<GtkWidget, GtkWidget, gtk_widget_destroy> GMenu; | |
diff --git a/stardict-3.0.1/src/sigc++/signal.h b/stardict-3.0.1/src/sigc++/signal.h | |
--- a/stardict-3.0.1/src/sigc++/signal.h | |
+++ b/stardict-3.0.1/src/sigc++/signal.h | |
@@ -4,6 +4,7 @@ | |
#ifndef _SIGC_SIGNAL_H_ | |
#define _SIGC_SIGNAL_H_ | |
+#include <stddef.h> | |
#include <list> | |
#include <sigc++/signal_base.h> | |
#include <sigc++/type_traits.h> | |
diff --git a/stardict-3.0.1/src/sigc++/signal_base.h b/stardict-3.0.1/src/sigc++/signal_base.h | |
--- a/stardict-3.0.1/src/sigc++/signal_base.h | |
+++ b/stardict-3.0.1/src/sigc++/signal_base.h | |
@@ -21,6 +21,7 @@ | |
#ifndef _SIGC_SIGNAL_BASE_H_ | |
#define _SIGC_SIGNAL_BASE_H_ | |
+#include <stddef.h> | |
#include <list> | |
#include <sigc++config.h> | |
#include <sigc++/type_traits.h> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment