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.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/src/lib/trayicon.c b/src/lib/trayicon.c
index d25b9d77..cf755b43 100644
--- a/src/lib/trayicon.c
+++ b/src/lib/trayicon.c
@@ -47,9 +47,7 @@ tray_icon_on_click (GtkStatusIcon * status_icon, gpointer user_data)
47{ 47{
48 gboolean tlf; 48 gboolean tlf;
49 49
50 g_object_get (main_window, 50 g_object_get (main_window, "visible", &tlf, NULL);
51 "visible", &tlf,
52 NULL);
53 if (tlf) 51 if (tlf)
54 { 52 {
55 gtk_widget_hide (GTK_WIDGET (main_window)); 53 gtk_widget_hide (GTK_WIDGET (main_window));
@@ -71,8 +69,7 @@ tray_icon_on_click (GtkStatusIcon * status_icon, gpointer user_data)
71 * @param user_data the main loop context 69 * @param user_data the main loop context
72 */ 70 */
73void 71void
74GNUNET_GTK_tray_icon_quit (GtkMenuItem *menuitem, 72GNUNET_GTK_tray_icon_quit (GtkMenuItem * menuitem, gpointer user_data)
75 gpointer user_data)
76{ 73{
77 /* struct GNUNET_GTK_MainLoop *ml = user_data; */ 74 /* struct GNUNET_GTK_MainLoop *ml = user_data; */
78 GNUNET_SCHEDULER_shutdown (); 75 GNUNET_SCHEDULER_shutdown ();
@@ -96,7 +93,8 @@ tray_icon_on_menu (GtkWidget * widget, GdkEvent * event, gpointer user_data)
96 event_button = (GdkEventButton *) event; 93 event_button = (GdkEventButton *) event;
97 if (event_button->button == 3) 94 if (event_button->button == 3)
98 { 95 {
99 builder = GNUNET_GTK_get_new_builder ("gnunet_gtk_status_bar_menu.glade", ml); 96 builder =
97 GNUNET_GTK_get_new_builder ("gnunet_gtk_status_bar_menu.glade", ml);
100 tray_menu = 98 tray_menu =
101 GTK_MENU (gtk_builder_get_object 99 GTK_MENU (gtk_builder_get_object
102 (builder, "GNUNET_GTK_status_bar_popup_menu")); 100 (builder, "GNUNET_GTK_status_bar_popup_menu"));
@@ -119,9 +117,8 @@ tray_icon_on_menu (GtkWidget * widget, GdkEvent * event, gpointer user_data)
119 * @param tooltip tooltip for the tray icon 117 * @param tooltip tooltip for the tray icon
120 */ 118 */
121void 119void
122GNUNET_GTK_tray_icon_create (struct GNUNET_GTK_MainLoop *ml, 120GNUNET_GTK_tray_icon_create (struct GNUNET_GTK_MainLoop *ml, GtkWindow * main,
123 GtkWindow * main, const char *icon_name, 121 const char *icon_name, const char *tooltip)
124 const char *tooltip)
125{ 122{
126 if (NULL != tray_icon) 123 if (NULL != tray_icon)
127 { 124 {
@@ -139,6 +136,28 @@ GNUNET_GTK_tray_icon_create (struct GNUNET_GTK_MainLoop *ml,
139 gtk_status_icon_set_visible (tray_icon, TRUE); 136 gtk_status_icon_set_visible (tray_icon, TRUE);
140} 137}
141 138
139/**
140 * Change our tray icon.
141 *
142 * @param ml main loop
143 * @param main handle to the main window (show or hide)
144 * @param icon_name name of the tray icon file
145 * @param tooltip tooltip for the tray icon
146 */
147void
148GNUNET_GTK_tray_icon_change (const char *icon_name, const char *tooltip)
149{
150 if (NULL == tray_icon)
151 {
152 GNUNET_break (0);
153 return;
154 }
155 gtk_status_icon_set_from_icon_name (tray_icon, icon_name);
156 gtk_status_icon_set_tooltip_text (tray_icon, tooltip);
157 gtk_status_icon_set_visible (tray_icon, TRUE);
158}
159
160
142 161
143/** 162/**
144 * Destroy the tray icon. 163 * Destroy the tray icon.