[gnome-disk-utility] work around notification-daemon brokenness



commit 122c651f99ee1ad730a35925db520d8fb90bd4f4
Author: David Zeuthen <davidz redhat com>
Date:   Wed Apr 15 12:33:11 2009 -0400

    work around notification-daemon brokenness
    
    On login, the bubble is not correctly positioned and it even appears
    that it disappears when the background is changed. So delay start up
    five seconds.
---
 data/gdu-notification-daemon.desktop.in.in.in |    2 +-
 src/notification/notification-main.c          |   26 ++++++++++++++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/data/gdu-notification-daemon.desktop.in.in.in b/data/gdu-notification-daemon.desktop.in.in.in
index 990cf61..05f780e 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
+Exec= LIBEXECDIR@/gdu-notification-daemon --delay
 Terminal=false
 Type=Application
 Categories=
diff --git a/src/notification/notification-main.c b/src/notification/notification-main.c
index d34028d..a63a090 100644
--- a/src/notification/notification-main.c
+++ b/src/notification/notification-main.c
@@ -23,6 +23,7 @@
 
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
+#include <stdlib.h>
 
 #include <gdu/gdu.h>
 #include <gdu-gtk/gdu-gtk.h>
@@ -527,17 +528,36 @@ show_menu_for_status_icon (NotificationData *data)
 int
 main (int argc, char **argv)
 {
+        GError *error;
         NotificationData *data;
-
-        gtk_init (&argc, &argv);
-        notify_init ("gdu-notification-daemon");
+        gboolean opt_delay;
+        GOptionEntry opt_entries[] = {
+                { "delay", 0, 0, G_OPTION_ARG_NONE, &opt_delay, "Delay startup for five seconds", NULL },
+                { NULL }
+        };
+
+        error = NULL;
+        if (!gtk_init_with_args (&argc, &argv,
+                                 "gnome-disk-utility notification daemon",
+                                 opt_entries,
+                                 GETTEXT_PACKAGE,
+                                 &error)) {
+                g_error ("%s", error->message);
+                g_error_free (error);
+                exit (1);
+        }
 
         bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
         textdomain (GETTEXT_PACKAGE);
 
+        notify_init ("gdu-notification-daemon");
+
         gtk_window_set_default_icon_name ("palimpsest");
 
+        if (opt_delay)
+                sleep (5);
+
         data = notification_data_new ();
         update_all (data);
 



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