[gnome-disk-utility] Bug 579997 – don't show notifications before the panel is there



commit edf521d384cb5f5b0dd6202c1c8e88600fd44105
Author: David Zeuthen <davidz redhat com>
Date:   Tue Apr 28 13:04:06 2009 -0400

    Bug 579997 â?? don't show notifications before the panel is there
    
    Based on a patch from Matthias Clasen <mclasen redhat com>.
---
 data/gdu-notification-daemon.desktop.in.in.in |    2 +-
 src/notification/notification-main.c          |   24 ++++++++++++++++++------
 src/playground/grid/grid.c                    |    2 ++
 3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/data/gdu-notification-daemon.desktop.in.in.in b/data/gdu-notification-daemon.desktop.in.in.in
index 05f780e..990cf61 100644
--- a/data/gdu-notification-daemon.desktop.in.in.in
+++ b/data/gdu-notification-daemon.desktop.in.in.in
@@ -3,7 +3,7 @@ Encoding=UTF-8
 _Name=Disk Notifications
 _Comment=Provides notifications related to disks
 Icon=gdu-notification-daemon
-Exec= LIBEXECDIR@/gdu-notification-daemon --delay
+Exec= LIBEXECDIR@/gdu-notification-daemon
 Terminal=false
 Type=Application
 Categories=
diff --git a/src/notification/notification-main.c b/src/notification/notification-main.c
index a63a090..609f9ff 100644
--- a/src/notification/notification-main.c
+++ b/src/notification/notification-main.c
@@ -385,6 +385,23 @@ update_ata_smart_failures (NotificationData *data)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
+static gboolean
+show_notification (NotificationData *data)
+{
+        static int count = 0;
+
+        /* wait for the panel to be settled before showing a bubble */
+        if (gtk_status_icon_is_embedded (data->status_icon)) {
+                notify_notification_show (data->ata_smart_notification, NULL);
+        } else if (count < 20) {
+                count++;
+                g_timeout_add_seconds (1, (GSourceFunc) show_notification, data);
+        } else {
+                g_warning ("No notification area. Notification bubbles will not be displayed.");
+        }
+        return FALSE;
+}
+
 static void
 update_status_icon (NotificationData *data)
 {
@@ -424,7 +441,7 @@ update_status_icon (NotificationData *data)
                                                            data->status_icon);
                 notify_notification_set_urgency (data->ata_smart_notification, NOTIFY_URGENCY_CRITICAL);
                 notify_notification_set_timeout (data->ata_smart_notification, NOTIFY_EXPIRES_NEVER);
-                notify_notification_show (data->ata_smart_notification, NULL);
+                show_notification (data);
         }
 
  out:
@@ -530,9 +547,7 @@ main (int argc, char **argv)
 {
         GError *error;
         NotificationData *data;
-        gboolean opt_delay;
         GOptionEntry opt_entries[] = {
-                { "delay", 0, 0, G_OPTION_ARG_NONE, &opt_delay, "Delay startup for five seconds", NULL },
                 { NULL }
         };
 
@@ -555,9 +570,6 @@ main (int argc, char **argv)
 
         gtk_window_set_default_icon_name ("palimpsest");
 
-        if (opt_delay)
-                sleep (5);
-
         data = notification_data_new ();
         update_all (data);
 
diff --git a/src/playground/grid/grid.c b/src/playground/grid/grid.c
index 8358fe6..853c48e 100644
--- a/src/playground/grid/grid.c
+++ b/src/playground/grid/grid.c
@@ -37,12 +37,14 @@ main (int argc, char *argv[])
                             TRUE,
                             0);
 
+#if 0
         details = gdu_grid_details_new (GDU_GRID_VIEW (view));
         gtk_box_pack_start (GTK_BOX (vbox),
                             details,
                             TRUE,
                             TRUE,
                             0);
+#endif
 
         gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
         gtk_widget_show_all (window);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]