[Goodies-commits] r1986 - in notification-daemon-xfce/trunk: . settings
Nick Schermer
nick at xfce.org
Wed Sep 6 23:14:26 CEST 2006
Author: nick
Date: 2006-09-06 21:14:25 +0000 (Wed, 06 Sep 2006)
New Revision: 1986
Modified:
notification-daemon-xfce/trunk/ChangeLog
notification-daemon-xfce/trunk/configure.in.in
notification-daemon-xfce/trunk/settings/Makefile.am
notification-daemon-xfce/trunk/settings/main.c
Log:
* Add preview support to the settings dialog.
* Hacky way to kill the deamon when settings has been
changed.
Modified: notification-daemon-xfce/trunk/ChangeLog
===================================================================
--- notification-daemon-xfce/trunk/ChangeLog 2006-09-06 20:47:55 UTC (rev 1985)
+++ notification-daemon-xfce/trunk/ChangeLog 2006-09-06 21:14:25 UTC (rev 1986)
@@ -1,3 +1,9 @@
+2006-09-06 23:12 nick
+
+ * Add preview support to the settings dialog.
+ * Hacky way to kill the deamon when settings has been
+ changed.
+
2006-09-06 18:10 nick
* Imported all changes from the trunk version of
Modified: notification-daemon-xfce/trunk/configure.in.in
===================================================================
--- notification-daemon-xfce/trunk/configure.in.in 2006-09-06 20:47:55 UTC (rev 1985)
+++ notification-daemon-xfce/trunk/configure.in.in 2006-09-06 21:14:25 UTC (rev 1986)
@@ -58,6 +58,9 @@
XDT_CHECK_OPTIONAL_PACKAGE([XFCE_MCS_MANAGER], [xfce-mcs-manager], [4.2.2],
[mcs-plugin], [xfce-mcs-manager], [yes])
+XDT_CHECK_OPTIONAL_PACKAGE([LIBNOTIFY], [libnotify], [0.4.0],
+ [settings], [libnotify], [yes])
+
dnl check for debugging support
XDT_FEATURE_DEBUG()
Modified: notification-daemon-xfce/trunk/settings/Makefile.am
===================================================================
--- notification-daemon-xfce/trunk/settings/Makefile.am 2006-09-06 20:47:55 UTC (rev 1985)
+++ notification-daemon-xfce/trunk/settings/Makefile.am 2006-09-06 21:14:25 UTC (rev 1986)
@@ -31,6 +31,14 @@
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCEGUI4_LIBS)
+if HAVE_LIBNOTIFY
+notification_settings_CFLAGS += \
+ $(LIBNOTIFY_CFLAGS)
+
+notification_settings_LDADD += \
+ $(LIBNOTIFY_LIBS)
+endif
+
##
## .desktop file
##
Modified: notification-daemon-xfce/trunk/settings/main.c
===================================================================
--- notification-daemon-xfce/trunk/settings/main.c 2006-09-06 20:47:55 UTC (rev 1985)
+++ notification-daemon-xfce/trunk/settings/main.c 2006-09-06 21:14:25 UTC (rev 1986)
@@ -36,6 +36,9 @@
#include <libxfcegui4/libxfcegui4.h>
#include <libxfce4util/libxfce4util.h>
+#ifdef HAVE_LIBNOTIFY
+#include <libnotify/notify.h>
+#endif
#define BORDER 6
#define DEFAULT_POSITION "buttom_right"
@@ -64,6 +67,45 @@
static void
+notification_settings_kill_daemon (void)
+{
+ /* this is a real hack, but good enough for most users */
+ GError *error = NULL;
+ gchar *argv[] = { "/usr/bin/killall", "-q", "-s", "QUIT", "notification-daemon-xfce", NULL };
+
+ if (!g_spawn_async (NULL, argv, NULL, 0, NULL, NULL, NULL, &error))
+ {
+ g_error_free (error);
+ }
+}
+
+
+#ifdef HAVE_LIBNOTIFY
+static void
+notification_settings_preview (GtkWidget *button)
+{
+ NotifyNotification *notify;
+
+ if (!notify_init("notify-send"))
+ {
+ g_warning ("Unable to init the notification library");
+ return;
+ }
+
+ notify = notify_notification_new ("Preview notification",
+ _("Lorem Ipsum is simply dummy text of the printing and typesetting industry."),
+ "notification-settings",
+ NULL);
+ notify_notification_set_urgency (notify, NOTIFY_URGENCY_NORMAL);
+ notify_notification_set_timeout (notify, 5000);
+ notify_notification_show (notify, NULL);
+ g_object_unref (G_OBJECT(notify));
+ notify_uninit ();
+}
+#endif
+
+
+static void
notification_settings_save_position (GtkComboBox *combobox)
{
const PopupLocation *l;
@@ -72,6 +114,8 @@
gchar *file;
XfceRc *rc;
+ notification_settings_kill_daemon ();
+
/* get active selected item */
selected = gtk_combo_box_get_active (combobox);
@@ -147,7 +191,7 @@
static GtkWidget *
notifications_settings_dialog_new (void)
{
- GtkWidget *dialog, *dialog_vbox, *hbox, *image, *label, *combobox;
+ GtkWidget *dialog, *dialog_vbox, *hbox, *label, *combobox, *button, *image;
const PopupLocation *l;
gint i = 0;
gchar *active;
@@ -155,7 +199,6 @@
dialog = xfce_titled_dialog_new_with_buttons (_("Notification Settings"),
NULL,
GTK_DIALOG_NO_SEPARATOR,
- GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
NULL);
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (dialog),
@@ -163,7 +206,7 @@
gtk_window_set_icon_name (GTK_WINDOW (dialog), "notification-settings");
dialog_vbox = GTK_DIALOG (dialog)->vbox;
-
+/*
hbox = gtk_hbox_new (FALSE, BORDER);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (dialog_vbox), hbox, FALSE, FALSE, 0);;
@@ -179,7 +222,7 @@
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-
+*/
hbox = gtk_hbox_new (FALSE, BORDER);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (dialog_vbox), hbox, FALSE, FALSE, 0);;
@@ -212,6 +255,31 @@
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combobox);
+ /* preview button */
+#ifdef HAVE_LIBNOTIFY
+ hbox = GTK_DIALOG (dialog)->action_area;
+
+ button = gtk_button_new_with_mnemonic (_("Pre_view"));
+ gtk_widget_show (button);
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+
+ image = gtk_image_new_from_icon_name ("notification-settings", GTK_ICON_SIZE_BUTTON);
+ gtk_widget_show (image);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+
+ 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
+
return dialog;
}
More information about the Goodies-commits
mailing list