~ubuntu-core-dev/update-notifier/ubuntu

« back to all changes in this revision

Viewing changes to src/reboot.c

  • Committer: Michael Vogt
  • Date: 2007-07-27 21:00:33 UTC
  • Revision ID: michael.vogt@ubuntu.com-20070727210033-bswe0d6tdsmx14x6
* fix crash in leftover from pre-GtkStatusIcon code (LP: #127965)
* consitently use notify_notification_new_with_status_icon()

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
static GladeXML *xml;
19
19
 
20
 
static gint
 
20
static gboolean
21
21
show_notification (TrayApplet *ta)
22
22
{
23
23
        NotifyNotification *n;
24
24
        int                 x, y;
25
25
 
26
 
        // only show once the icon is realy availabe
27
 
        if(!GTK_WIDGET_REALIZED(ta->tray_icon))
28
 
           return TRUE;
29
 
 
30
26
        GdkRectangle area;
31
27
        gtk_status_icon_get_geometry(ta->tray_icon, NULL, &area, NULL);
32
 
        
 
28
 
33
29
        // no usefull coordiante yet, do another timeout
34
30
        if(area.x <= 0 || area.y <= 0 || area.width <= 0 || area.height <= 0)
35
31
           return TRUE;
36
32
 
 
33
        // only show once the icon is realy availabe
 
34
        if(!gtk_status_icon_get_visible(ta->tray_icon))
 
35
           return TRUE;
 
36
 
37
37
        /* Create and show the notification */
38
 
        n = notify_notification_new (_("System restart required"),
 
38
        n = notify_notification_new_with_status_icon(
 
39
                                     _("System restart required"),
39
40
                                     _("To complete the update of your system, "
40
41
                                       "restart your system.\n\n"
41
42
                                       "Click on the notification icon to "
42
43
                                       "restart your system."),
43
44
                                     GTK_STOCK_DIALOG_WARNING,
44
 
                                     GTK_WIDGET(ta->tray_icon));
 
45
                                     ta->tray_icon);
45
46
        notify_notification_set_timeout (n, 60000);
46
47
        notify_notification_show (n, NULL);
47
48
        g_object_set_data (G_OBJECT(ta->tray_icon), "notification", n);
69
70
        }
70
71
 
71
72
        /* Skip the rest if the icon is already visible */
72
 
        if (GTK_WIDGET_VISIBLE(GTK_WIDGET(ta->tray_icon)))
73
 
                return TRUE;
 
73
        if (gtk_status_icon_get_visible (ta->tray_icon))
 
74
           return TRUE;
74
75
 
75
76
        gtk_status_icon_set_tooltip (ta->tray_icon,  
76
77
                                     _("System restart required"));