[Goodies-commits] r1992 - in notification-daemon-xfce/trunk: . po settings

Nick Schermer nick at xfce.org
Thu Sep 7 19:05:45 CEST 2006


Author: nick
Date: 2006-09-07 17:05:44 +0000 (Thu, 07 Sep 2006)
New Revision: 1992

Modified:
   notification-daemon-xfce/trunk/ChangeLog
   notification-daemon-xfce/trunk/po/hu.po
   notification-daemon-xfce/trunk/po/nl.po
   notification-daemon-xfce/trunk/po/notification-daemon-xfce.pot
   notification-daemon-xfce/trunk/settings/main.c
Log:
* Better to to "re-display" the preview notification


Modified: notification-daemon-xfce/trunk/ChangeLog
===================================================================
--- notification-daemon-xfce/trunk/ChangeLog	2006-09-07 13:39:46 UTC (rev 1991)
+++ notification-daemon-xfce/trunk/ChangeLog	2006-09-07 17:05:44 UTC (rev 1992)
@@ -1,3 +1,7 @@
+2006-09-07 19:00 nick
+
+	* Better to to "re-display" the preview notification
+
 2006-09-07 13:00 nick
 
 	* Created icons directory with icon-cache hook, moved

Modified: notification-daemon-xfce/trunk/po/hu.po
===================================================================
--- notification-daemon-xfce/trunk/po/hu.po	2006-09-07 13:39:46 UTC (rev 1991)
+++ notification-daemon-xfce/trunk/po/hu.po	2006-09-07 17:05:44 UTC (rev 1992)
@@ -2,7 +2,7 @@
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-09-07 12:03+0200\n"
+"POT-Creation-Date: 2006-09-07 19:02+0200\n"
 "PO-Revision-Date: 2006-09-07 00:05+0100\n"
 "Last-Translator: SZERVÑC Attila <sas at 321.hu>\n"
 "Language-Team: Hungarian\n"
@@ -30,28 +30,28 @@
 msgstr "Jobb alsó"
 
 #. create new preview notification
-#: ../settings/main.c:186
+#: ../settings/main.c:189
 msgid "Preview notification"
 msgstr ""
 
-#: ../settings/main.c:187
+#: ../settings/main.c:190
 msgid ""
 "Lorem Ipsum is simply dummy text of the printing and typesetting industry."
 msgstr ""
 
-#: ../settings/main.c:307 ../settings/notification-settings.desktop.in.h:2
+#: ../settings/main.c:325 ../settings/notification-settings.desktop.in.h:2
 msgid "Notification Settings"
 msgstr "Emlékeztető beállítások"
 
-#: ../settings/main.c:313
+#: ../settings/main.c:331
 msgid "Configure the Xfce notification daemon"
 msgstr "Xfce emlékeztető démon beállítása"
 
-#: ../settings/main.c:323
+#: ../settings/main.c:341
 msgid "Notification _position:"
 msgstr "Emlékeztető _helye"
 
-#: ../settings/main.c:352
+#: ../settings/main.c:371
 msgid "Pre_view"
 msgstr ""
 
@@ -66,3 +66,8 @@
 #: ../settings/notification-settings.desktop.in.h:1
 msgid "Customize the notification daemon settings"
 msgstr "Emlékeztető beállítások testreszabása"
+
+#: ../settings/notification-settings.desktop.in.h:3
+#, fuzzy
+msgid "Xfce 4 Notification Settings"
+msgstr "Emlékeztető beállítások"

Modified: notification-daemon-xfce/trunk/po/nl.po
===================================================================
--- notification-daemon-xfce/trunk/po/nl.po	2006-09-07 13:39:46 UTC (rev 1991)
+++ notification-daemon-xfce/trunk/po/nl.po	2006-09-07 17:05:44 UTC (rev 1992)
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: 0.3.6\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-09-07 12:03+0200\n"
+"POT-Creation-Date: 2006-09-07 19:02+0200\n"
 "PO-Revision-Date: 2006-09-07 12:03+0200\n"
 "Last-Translator: Nick Schermer <nick at xfce.org>\n"
 "Language-Team: Dutch\n"
@@ -33,28 +33,29 @@
 msgstr "Rechts Onder"
 
 #. create new preview notification
-#: ../settings/main.c:186
+#: ../settings/main.c:189
 msgid "Preview notification"
 msgstr "Voorbeeld bericht"
 
-#: ../settings/main.c:187
+#: ../settings/main.c:190
 msgid ""
 "Lorem Ipsum is simply dummy text of the printing and typesetting industry."
-msgstr "Lorum Ipsum is gewoon voorbeeld tekst voor de print en letterzet industrie."
+msgstr ""
+"Lorum Ipsum is gewoon voorbeeld tekst voor de print en letterzet industrie."
 
-#: ../settings/main.c:307 ../settings/notification-settings.desktop.in.h:2
+#: ../settings/main.c:325 ../settings/notification-settings.desktop.in.h:2
 msgid "Notification Settings"
 msgstr "Berichtweergave Instellingen"
 
-#: ../settings/main.c:313
+#: ../settings/main.c:331
 msgid "Configure the Xfce notification daemon"
 msgstr "Instellingen van de Xfce berichtweergave daemon"
 
-#: ../settings/main.c:323
+#: ../settings/main.c:341
 msgid "Notification _position:"
 msgstr "Bericht _positie"
 
-#: ../settings/main.c:352
+#: ../settings/main.c:371
 msgid "Pre_view"
 msgstr "_Voorbeeld"
 
@@ -69,3 +70,7 @@
 #: ../settings/notification-settings.desktop.in.h:1
 msgid "Customize the notification daemon settings"
 msgstr "Verander de berichtweergave daemon instellingen"
+
+#: ../settings/notification-settings.desktop.in.h:3
+msgid "Xfce 4 Notification Settings"
+msgstr "Xfce 4 Berichtweergave Instellingen"

Modified: notification-daemon-xfce/trunk/po/notification-daemon-xfce.pot
===================================================================
--- notification-daemon-xfce/trunk/po/notification-daemon-xfce.pot	2006-09-07 13:39:46 UTC (rev 1991)
+++ notification-daemon-xfce/trunk/po/notification-daemon-xfce.pot	2006-09-07 17:05:44 UTC (rev 1992)
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-09-07 12:03+0200\n"
+"POT-Creation-Date: 2006-09-07 19:02+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -33,28 +33,28 @@
 msgstr ""
 
 #. create new preview notification
-#: ../settings/main.c:186
+#: ../settings/main.c:189
 msgid "Preview notification"
 msgstr ""
 
-#: ../settings/main.c:187
+#: ../settings/main.c:190
 msgid ""
 "Lorem Ipsum is simply dummy text of the printing and typesetting industry."
 msgstr ""
 
-#: ../settings/main.c:307 ../settings/notification-settings.desktop.in.h:2
+#: ../settings/main.c:325 ../settings/notification-settings.desktop.in.h:2
 msgid "Notification Settings"
 msgstr ""
 
-#: ../settings/main.c:313
+#: ../settings/main.c:331
 msgid "Configure the Xfce notification daemon"
 msgstr ""
 
-#: ../settings/main.c:323
+#: ../settings/main.c:341
 msgid "Notification _position:"
 msgstr ""
 
-#: ../settings/main.c:352
+#: ../settings/main.c:371
 msgid "Pre_view"
 msgstr ""
 
@@ -69,3 +69,7 @@
 #: ../settings/notification-settings.desktop.in.h:1
 msgid "Customize the notification daemon settings"
 msgstr ""
+
+#: ../settings/notification-settings.desktop.in.h:3
+msgid "Xfce 4 Notification Settings"
+msgstr ""

Modified: notification-daemon-xfce/trunk/settings/main.c
===================================================================
--- notification-daemon-xfce/trunk/settings/main.c	2006-09-07 13:39:46 UTC (rev 1991)
+++ notification-daemon-xfce/trunk/settings/main.c	2006-09-07 17:05:44 UTC (rev 1992)
@@ -71,12 +71,12 @@
 
 
 
-static gboolean         notification_settings_init_daemon    (void);
+static void             notification_settings_init_daemon    (void);
 static void             notification_settings_reload_daemon  (void);
 #ifdef HAVE_LIBNOTIFY
 static void             notification_settings_preview_closed (GObject *object,
                                                               gpointer user_data);
-static void             notification_settings_preview        (GtkWidget   *button);
+static gboolean         notification_settings_preview        (GtkWidget   *button);
 #endif
 static void             notification_settings_save_position  (GtkComboBox *combobox);
 static void             notification_settings_write_setting  (const gchar *key,
@@ -91,10 +91,11 @@
 static DBusGProxy *proxy = NULL;
 #ifdef HAVE_LIBNOTIFY
 static NotifyNotification *preview = NULL;
+static gboolean show_preview_again = FALSE;
 #endif
 
 
-static gboolean
+static void
 notification_settings_init_daemon (void)
 {
   GError *error = NULL;
@@ -104,11 +105,11 @@
 
   bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
 
-  if (error != NULL)
+  if (G_UNLIKELY (error != NULL))
     {
        g_message ("Unable to get session bus: %s", error->message);
        g_error_free (error);
-       return FALSE;
+       return;
     }
 
   proxy = dbus_g_proxy_new_for_name (bus,
@@ -116,8 +117,6 @@
                                      NOTIFY_DBUS_CORE_OBJECT,
                                      NOTIFY_DBUS_CORE_INTERFACE);
   dbus_g_connection_unref (bus);
-
-  return TRUE;
 }
 
 
@@ -135,14 +134,7 @@
   {
      g_message("Unable to reload the daemon: %s", error->message);
      g_error_free(error);
-     return;
   }
-
-#ifdef HAVE_LIBNOTIFY
-  /* reset the preview notification position */
-  if (preview)
-    notify_notification_show (preview, NULL);
-#endif
 }
 
 
@@ -152,43 +144,55 @@
                                       gpointer data)
 {
   GtkWidget *button;
-
   g_return_if_fail (object == G_OBJECT (preview));
 
   button = (GtkWidget *)data;
 
-  /* activate preview button */
-  gtk_widget_set_sensitive (button, TRUE);
-
+  /* destroy the notification */
   g_object_unref (object);
   preview = NULL;
+
+  /* show preview again, or active the button again */
+  if (show_preview_again)
+    {
+       /* reset bool and show again */
+       show_preview_again = FALSE;
+       g_idle_add ((GSourceFunc) notification_settings_preview,
+                   button);
+    }
+  else
+    {
+       gtk_widget_set_sensitive (button, TRUE);
+    }
 }
 
 
 
-static void
+static gboolean
 notification_settings_preview (GtkWidget *button)
 {
   /* return if the notification is already visible */
   if (preview != NULL)
-    return;
+    return FALSE;
 
-  if (!notify_init("notification-settings"))
-  {
-     g_warning ("Unable to init the notification library");
-     return;
-  }
+  /* init libnotify */
+  if (G_UNLIKELY (!notify_init("notification-settings")))
+    {
+       g_warning ("Unable to init the notification library");
+       return FALSE;
+    }
 
   /* disable preview button */
   gtk_widget_set_sensitive (button, FALSE);
 
   /* create new preview notification */
   preview = notify_notification_new (_("Preview notification"),
-                                     _("Lorem Ipsum is simply dummy text of the printing "
-                                      "and typesetting industry."),
-                                      "notification-settings",
-                                      NULL);
+    _("Lorem Ipsum is simply dummy text of the printing and typesetting industry."),
+      "notification-settings",
+      NULL);
+
   notify_notification_set_urgency (preview, NOTIFY_URGENCY_NORMAL);
+  notify_notification_set_category(preview, "preview");
   notify_notification_set_timeout (preview, 5000);
 
   /* attach close signal */
@@ -197,7 +201,11 @@
 
   /* show the notification */
   notify_notification_show (preview, NULL);
+
+  /* uninit libnotify */
   notify_uninit ();
+
+  return FALSE;
 }
 #endif
 
@@ -237,6 +245,16 @@
 
   /* reload daemon */
   notification_settings_reload_daemon ();
+
+
+#ifdef HAVE_LIBNOTIFY
+  /* display the preview again on new position */
+  if (preview)
+    {
+       show_preview_again = TRUE;
+       notify_notification_close (preview, NULL);
+    }
+#endif
 }
 
 
@@ -329,6 +347,10 @@
   gtk_box_pack_start (GTK_BOX (hbox), combobox, TRUE, TRUE, 0);
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), combobox);
 
+  /* connect combobox change signal */
+  g_signal_connect(G_OBJECT(combobox), "changed",
+    G_CALLBACK(notification_settings_save_position), NULL);
+
   /* append all position values */
   active = notification_settings_read_setting ("popup_location", DEFAULT_POSITION);
   for (l = popup_locations; l->name != NULL; l++)
@@ -342,11 +364,8 @@
     }
   g_free (active);
 
-  g_signal_connect(G_OBJECT(combobox), "changed",
-    G_CALLBACK(notification_settings_save_position), NULL);
-
+#ifdef HAVE_LIBNOTIFY
   /* preview button */
-#ifdef HAVE_LIBNOTIFY
   hbox = GTK_DIALOG (dialog)->action_area;
 
   button = gtk_button_new_with_mnemonic (_("Pre_view"));
@@ -359,17 +378,15 @@
 
   g_signal_connect(G_OBJECT(button), "clicked",
     G_CALLBACK(notification_settings_preview), NULL);
-#endif
 
-  /* close button */
-  gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_OK);
-
-#ifdef HAVE_LIBNOTIFY
   /* button box layout */
   gtk_button_box_set_layout (GTK_BUTTON_BOX (GTK_DIALOG (dialog)->action_area),
                              GTK_BUTTONBOX_EDGE);
 #endif
 
+  /* close button */
+  gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_OK);
+
   return dialog;
 }
 




More information about the Goodies-commits mailing list