aboutsummaryrefslogtreecommitdiff
path: root/src/lib/trayicon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/trayicon.c')
-rw-r--r--src/lib/trayicon.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/lib/trayicon.c b/src/lib/trayicon.c
index c7c57a16..1b8edd85 100644
--- a/src/lib/trayicon.c
+++ b/src/lib/trayicon.c
@@ -46,8 +46,7 @@ static GtkWindow *main_window;
46 * @param user_data unused 46 * @param user_data unused
47 */ 47 */
48static void 48static void
49tray_icon_on_click (GtkStatusIcon *status_icon, 49tray_icon_on_click (GtkStatusIcon *status_icon, gpointer user_data)
50 gpointer user_data)
51{ 50{
52 gboolean tlf; 51 gboolean tlf;
53 52
@@ -73,8 +72,7 @@ tray_icon_on_click (GtkStatusIcon *status_icon,
73 * @param user_data the main loop context 72 * @param user_data the main loop context
74 */ 73 */
75void 74void
76GNUNET_GTK_tray_icon_quit (GtkMenuItem *menuitem, 75GNUNET_GTK_tray_icon_quit (GtkMenuItem *menuitem, gpointer user_data)
77 gpointer user_data)
78{ 76{
79 /* struct GNUNET_GTK_MainLoop *ml = user_data; */ 77 /* struct GNUNET_GTK_MainLoop *ml = user_data; */
80 GNUNET_SCHEDULER_shutdown (); 78 GNUNET_SCHEDULER_shutdown ();
@@ -90,9 +88,7 @@ GNUNET_GTK_tray_icon_quit (GtkMenuItem *menuitem,
90 * @param user_data unused 88 * @param user_data unused
91 */ 89 */
92static int 90static int
93tray_icon_on_menu (GtkWidget *widget, 91tray_icon_on_menu (GtkWidget *widget, GdkEvent *event, gpointer user_data)
94 GdkEvent *event,
95 gpointer user_data)
96{ 92{
97 struct GNUNET_GTK_MainLoop *ml = user_data; 93 struct GNUNET_GTK_MainLoop *ml = user_data;
98 GtkMenu *tray_menu; 94 GtkMenu *tray_menu;
@@ -105,12 +101,16 @@ tray_icon_on_menu (GtkWidget *widget,
105 if (event_button->button == 3) 101 if (event_button->button == 3)
106 { 102 {
107 builder = 103 builder =
108 GNUNET_GTK_get_new_builder ("gnunet_gtk_status_bar_menu.glade", ml); 104 GNUNET_GTK_get_new_builder ("gnunet_gtk_status_bar_menu.glade", ml);
109 tray_menu = 105 tray_menu = GTK_MENU (
110 GTK_MENU (gtk_builder_get_object 106 gtk_builder_get_object (builder, "GNUNET_GTK_status_bar_popup_menu"));
111 (builder, "GNUNET_GTK_status_bar_popup_menu"));
112 g_object_ref (tray_menu); 107 g_object_ref (tray_menu);
113 gtk_menu_popup (tray_menu, NULL, NULL, NULL, NULL, event_button->button, 108 gtk_menu_popup (tray_menu,
109 NULL,
110 NULL,
111 NULL,
112 NULL,
113 event_button->button,
114 event_button->time); 114 event_button->time);
115 g_object_unref (builder); 115 g_object_unref (builder);
116 } 116 }
@@ -140,10 +140,14 @@ GNUNET_GTK_tray_icon_create (struct GNUNET_GTK_MainLoop *ml,
140 } 140 }
141 main_window = main; 141 main_window = main;
142 tray_icon = gtk_status_icon_new (); 142 tray_icon = gtk_status_icon_new ();
143 g_signal_connect (G_OBJECT (tray_icon), "activate", 143 g_signal_connect (G_OBJECT (tray_icon),
144 G_CALLBACK (tray_icon_on_click), ml); 144 "activate",
145 g_signal_connect (G_OBJECT (tray_icon), "button_press_event", 145 G_CALLBACK (tray_icon_on_click),
146 G_CALLBACK (tray_icon_on_menu), ml); 146 ml);
147 g_signal_connect (G_OBJECT (tray_icon),
148 "button_press_event",
149 G_CALLBACK (tray_icon_on_menu),
150 ml);
147 gtk_status_icon_set_from_icon_name (tray_icon, icon_name); 151 gtk_status_icon_set_from_icon_name (tray_icon, icon_name);
148 gtk_status_icon_set_tooltip_text (tray_icon, tooltip); 152 gtk_status_icon_set_tooltip_text (tray_icon, tooltip);
149 gtk_status_icon_set_visible (tray_icon, TRUE); 153 gtk_status_icon_set_visible (tray_icon, TRUE);
@@ -157,8 +161,7 @@ GNUNET_GTK_tray_icon_create (struct GNUNET_GTK_MainLoop *ml,
157 * @param tooltip tooltip for the tray icon 161 * @param tooltip tooltip for the tray icon
158 */ 162 */
159void 163void
160GNUNET_GTK_tray_icon_change (const char *icon_name, 164GNUNET_GTK_tray_icon_change (const char *icon_name, const char *tooltip)
161 const char *tooltip)
162{ 165{
163 if (NULL == tray_icon) 166 if (NULL == tray_icon)
164 return; 167 return;