94
cb_toggled_show_notifications(GObject *self, void *data)
94
cb_toggled_show_notifications(GObject *self, void *user_data)
96
TrayApplet *ta = (TrayApplet*)data;
97
96
GConfClient *gconf = gconf_client_get_default();
98
97
gboolean b = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(self));
99
98
gconf_client_set_bool(gconf, GCONF_KEY_NO_UPDATE_NOTIFICATIONS, !b,NULL);
100
NotifyNotification *n = (NotifyNotification*)g_object_get_data(G_OBJECT(ta->tray_icon),"notification");
102
notify_notification_close(n, NULL);
103
g_object_set_data(G_OBJECT(ta->tray_icon), "notification", NULL);
174
* this function is called when the notification handle is clicked
177
void notify_callback(NotifyHandle *handle, guint32 uid, void *user_data)
179
GMainLoop *loop = (GMainLoop*)user_data;
181
if(uid == NOTIFICATION_SHOW_UPDATES) {
182
invoke_with_gksu (actions[0][0], _(actions[0][1]));
185
notify_close(handle);
186
g_main_loop_quit(loop);
179
189
// actually show the notification
181
191
show_notification(gpointer user_data)
183
193
TrayApplet *ta = (TrayApplet *)user_data;
195
// now show a notification handle
186
200
gdk_window_get_origin(GTK_WIDGET(ta->tray_icon)->window, &x, &y);
189
203
if(x <= 0 || y <= 0)
192
// check if the update-icon is still visible (in the delay time a
193
// update may already have been performed)
194
if(!GTK_WIDGET_VISIBLE(ta->tray_icon))
206
//g_print("Placing notification at: %i %i", x, y);
208
gtk_widget_size_request(GTK_WIDGET(ta->tray_icon), &size);
209
x = x + size.width/2;
197
// now show a notification handle
198
NotifyNotification *n = notify_notification_new(_("New updates available"),
199
_("Click on the update icon"
200
" to see the available "
204
notify_notification_set_timeout (n, 60*1000);
205
notify_notification_show(n, NULL);
206
// save the notification handle
207
g_object_set_data(G_OBJECT(ta->tray_icon), "notification", n);
213
loop = g_main_loop_new(NULL, FALSE);
215
hints = notify_hints_new();
216
notify_hints_set_int(hints, "x", x);
217
notify_hints_set_int(hints, "y", y);
219
n = notify_send_notification(NULL, // replaces nothing
221
NOTIFY_URGENCY_NORMAL,
222
_("New updates available"),
223
_("Click on the update icon the link "
224
"to see the available Updates"),
227
60, // expire timout (big!)
231
NOTIFICATION_DEFAULT,
234
NOTIFICATION_SHOW_UPDATES,
238
_("Tell me about this later"),
209
243
// remove this from the timeout now
232
266
gtk_tooltips_set_tip(GTK_TOOLTIPS(ta->tooltip),
233
267
GTK_WIDGET (ta->eventbox),
234
268
_("A error occured, please run Package Manager "
235
"from the right-click menu or "
269
"from the righ-click menu or "
236
270
"apt-get on a terminal to see what is wrong"),
237
271
_("This usually means that your installed "
238
272
"packages have unmet dependencies"));
249
283
if (num_upgrades == 0) {
250
284
gtk_widget_hide(GTK_WIDGET(ta->tray_icon));
251
NotifyNotification *n = (NotifyNotification*)g_object_get_data(G_OBJECT(ta->tray_icon),"notification");
253
notify_notification_close(n, NULL);
254
g_object_set_data(G_OBJECT(ta->tray_icon), "notification", NULL);