[Galago-commits] r2985 - in trunk/notification-daemon: . po src src/capplet
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Wed Jun 13 03:00:15 PDT 2007
Author: chipx86
Date: 2007-06-13 03:00:13 -0700 (Wed, 13 Jun 2007)
New Revision: 2985
Added:
trunk/notification-daemon/src/capplet/notification-properties.glade
Modified:
trunk/notification-daemon/AUTHORS
trunk/notification-daemon/ChangeLog
trunk/notification-daemon/configure.ac
trunk/notification-daemon/po/POTFILES.in
trunk/notification-daemon/src/Makefile.am
trunk/notification-daemon/src/capplet/
trunk/notification-daemon/src/capplet/Makefile.am
trunk/notification-daemon/src/capplet/notification-properties.c
Log:
Patch by Jonh Wendell (and some code changes and dialog tweaks by me) to add a control panel applet for specifying the theme and notification position. This is not complete. We need to support actual querying of theme engine names. Works for now, though. Closes ticket #126.
Modified: trunk/notification-daemon/AUTHORS
===================================================================
--- trunk/notification-daemon/AUTHORS 2007-04-29 10:44:20 UTC (rev 2984)
+++ trunk/notification-daemon/AUTHORS 2007-06-13 10:00:13 UTC (rev 2985)
@@ -7,10 +7,11 @@
Ed Catmur <ed at catmur.co.uk>
felix at hsgheli.de
Jim Ramsay <i.am at jimramsay.com>
- Luca Cavelli <luca.cavelli at gmail.com>
+ Luca Cavalli <luca.cavelli at gmail.com>
Matt Walton <matthew at matthew-walton.co.uk>
Pawel Worach <pawel.worach at gmail.com>
Rodney Dawes <dobey at novell.com>
+ Jonh Wendell <wendell at bani.com.br>
Translators:
Dutch - Wouter Bolsterlee <uws+gnome at xs4all.nl>
Modified: trunk/notification-daemon/ChangeLog
===================================================================
--- trunk/notification-daemon/ChangeLog 2007-04-29 10:44:20 UTC (rev 2984)
+++ trunk/notification-daemon/ChangeLog 2007-06-13 10:00:13 UTC (rev 2985)
@@ -1,3 +1,18 @@
+Wed Jun 13 02:58:07 PDT 2007 Christian Hammond <chipx86 at chipx86.com>
+
+ * po/POTFILES.in:
+ * src/capplet/Makefile.am:
+ * src/capplet/notification-properties.c:
+ A src/capplet/notification-properties.glade:
+ * src/Makefile.am:
+ * AUTHORS:
+ * configure.ac:
+ - Patch by Jonh Wendell (and some code changes and dialog tweaks by me)
+ to add a control panel applet for specifying the theme and
+ notification position. This is not complete. We need to support actual
+ querying of theme engine names. Works for now, though.
+ Closes ticket #126.
+
Sun Apr 29 03:43:13 PDT 2007 Christian Hammond <chipx86 at chipx86.com>
* data/notification-daemon.schemas.in:
Modified: trunk/notification-daemon/configure.ac
===================================================================
--- trunk/notification-daemon/configure.ac 2007-04-29 10:44:20 UTC (rev 2984)
+++ trunk/notification-daemon/configure.ac 2007-06-13 10:00:13 UTC (rev 2985)
@@ -90,6 +90,10 @@
AC_SUBST(NOTIFICATION_DAEMON_CFLAGS)
AC_SUBST(NOTIFICATION_DAEMON_LIBS)
+PKG_CHECK_MODULES(NOTIFICATION_CAPPLET, glib-2.0 >= $REQ_GLIB_VERSION gtk+-2.0 >= $REQ_GTK_VERSION libglade-2.0 gconf-2.0 libnotify dbus-1 dbus-glib-1)
+AC_SUBST(NOTIFICATION_CAPPLET_CFLAGS)
+AC_SUBST(NOTIFICATION_CAPPLET_LIBS)
+
gdk_modules="
gdk-2.0 >= $REQ_GTK_VERSION, \
gdk-pixbuf-2.0 >= $REQ_GTK_VERSION \
@@ -199,6 +203,7 @@
po/Makefile.in
src/Makefile
src/daemon/Makefile
+src/capplet/Makefile
src/themes/Makefile
src/themes/bubble/Makefile
src/themes/standard/Makefile
Modified: trunk/notification-daemon/po/POTFILES.in
===================================================================
--- trunk/notification-daemon/po/POTFILES.in 2007-04-29 10:44:20 UTC (rev 2984)
+++ trunk/notification-daemon/po/POTFILES.in 2007-06-13 10:00:13 UTC (rev 2985)
@@ -1 +1,4 @@
data/notification-daemon.schemas.in
+src/capplet/notification-properties.c
+src/capplet/notification-properties.desktop.in
+src/capplet/notification-properties.glade
Modified: trunk/notification-daemon/src/Makefile.am
===================================================================
--- trunk/notification-daemon/src/Makefile.am 2007-04-29 10:44:20 UTC (rev 2984)
+++ trunk/notification-daemon/src/Makefile.am 2007-06-13 10:00:13 UTC (rev 2985)
@@ -1 +1 @@
-SUBDIRS = daemon themes
+SUBDIRS = daemon themes capplet
Property changes on: trunk/notification-daemon/src/capplet
___________________________________________________________________
Name: svn:ignore
+ Makefile
Makefile.in
notification-properties
.deps
.libs
*.bak
*.desktop
*.gladep
.*.swp
Modified: trunk/notification-daemon/src/capplet/Makefile.am
===================================================================
--- trunk/notification-daemon/src/capplet/Makefile.am 2007-04-29 10:44:20 UTC (rev 2984)
+++ trunk/notification-daemon/src/capplet/Makefile.am 2007-06-13 10:00:13 UTC (rev 2985)
@@ -2,10 +2,10 @@
@INTLTOOL_DESKTOP_RULE@
-notification_properties_LDADD = $(NOTIFICATION_CAPPLET_LIBS)
+notification_properties_LDADD = $(NOTIFICATION_CAPPLET_LIBS)
notification_properties_SOURCES = notification-properties.c
-gladedir = $(GNOMECC_GLADE_DIR)
+gladedir = $(datadir)/notification-daemon
glade_DATA = notification-properties.glade
desktopdir = $(datadir)/applications
@@ -15,7 +15,9 @@
INCLUDES = \
-I$(top_srcdir) \
$(NOTIFICATION_CAPPLET_CFLAGS) \
- -DENGINES_DIR=\"$(libdir)/notification-daemon-1.0/engines\"
+ -DENGINES_DIR=\"$(libdir)/notification-daemon-1.0/engines\" \
+ -DNOTIFICATION_LOCALEDIR=\"$(datadir)/locale\" \
+ -DNOTIFICATION_GLADEDIR=\"$(datadir)/notification-daemon\"
CLEANFILES = $(desktop_DATA)
EXTRA_DIST = $(glade_DATA) $(pixmap_DATA)
Modified: trunk/notification-daemon/src/capplet/notification-properties.c
===================================================================
--- trunk/notification-daemon/src/capplet/notification-properties.c 2007-04-29 10:44:20 UTC (rev 2984)
+++ trunk/notification-daemon/src/capplet/notification-properties.c 2007-06-13 10:00:13 UTC (rev 2985)
@@ -1,4 +1,600 @@
+/*
+ * notification-properties.c - Applet to manage notification settings
+ *
+ * Copyright (C) 2007 Jonh Wendell <wendell at bani.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <glib/gi18n.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+#include <gconf/gconf-client.h>
+#include <string.h>
+#include <libnotify/notify.h>
+
+#include "../daemon/stack.h"
+
+#define GCONF_KEY_DAEMON "/apps/notification-daemon"
+#define GCONF_KEY_THEME GCONF_KEY_DAEMON "/theme"
+#define GCONF_KEY_POPUP_LOCATION GCONF_KEY_DAEMON "/popup_location"
+
+#define N_LISTENERS 2
+
+typedef struct
+{
+ GladeXML *xml;
+ GConfClient *client;
+
+ GtkWidget *dialog;
+ GtkWidget *position_combo;
+ GtkWidget *theme_combo;
+ GtkWidget *preview_button;
+
+ NotifyNotification *preview;
+
+ guint listeners[N_LISTENERS];
+ int n_listeners;
+ int expected_listeners;
+
+} NotificationAppletDialog;
+
+enum
+{
+ NOTIFY_POSITION_LABEL,
+ NOTIFY_POSITION_NAME,
+ N_COLUMNS_POSITION
+};
+
+enum
+{
+ NOTIFY_THEME_LABEL,
+ NOTIFY_THEME_NAME,
+ NOTIFY_THEME_FILENAME,
+ N_COLUMNS_THEME
+};
+
+const struct
+{
+ const gchar *identifier;
+ const gchar *label;
+
+} popup_stack_locations[] =
+{
+ { "top_left", N_("Top Left") },
+ { "top_right", N_("Top Right") },
+ { "bottom_left", N_("Bottom Left") },
+ { "bottom_right", N_("Bottom Right") }
+};
+
+static void
+notification_properties_location_notify(GConfClient *client,
+ guint cnx_id,
+ GConfEntry *entry,
+ NotificationAppletDialog *dialog)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ const char *location;
+ gboolean valid;
+
+ if (!entry->value || entry->value->type != GCONF_VALUE_STRING)
+ return;
+
+ location = gconf_value_get_string(entry->value);
+
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(dialog->position_combo));
+ valid = gtk_tree_model_get_iter_first(model, &iter);
+
+ for (valid = gtk_tree_model_get_iter_first(model, &iter);
+ valid;
+ valid = gtk_tree_model_iter_next(model, &iter))
+ {
+ gchar *key;
+
+ gtk_tree_model_get(model, &iter, NOTIFY_POSITION_NAME, &key, -1);
+
+ if (g_str_equal(key, location))
+ {
+ gtk_combo_box_set_active_iter(
+ GTK_COMBO_BOX(dialog->position_combo),
+ &iter);
+ g_free(key);
+ break;
+ }
+
+ g_free(key);
+ }
+}
+
+static void
+notification_properties_location_changed(GtkComboBox *widget,
+ NotificationAppletDialog *dialog)
+{
+ char *location;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(dialog->position_combo));
+
+ if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(dialog->position_combo),
+ &iter))
+ {
+ return;
+ }
+
+ gtk_tree_model_get(model, &iter, NOTIFY_POSITION_NAME, &location, -1);
+
+ gconf_client_set_string(dialog->client, GCONF_KEY_POPUP_LOCATION,
+ location, NULL);
+ g_free(location);
+}
+
+static void
+notification_properties_dialog_setup_positions(NotificationAppletDialog *dialog)
+{
+ NotifyStackLocation i;
+ char *location;
+ gboolean valid;
+ GtkListStore *store;
+ GtkTreeIter iter;
+
+ dialog->position_combo =
+ glade_xml_get_widget(dialog->xml, "position_combo");
+ g_return_if_fail(dialog->position_combo != NULL);
+
+ store = gtk_list_store_new(N_COLUMNS_POSITION,
+ G_TYPE_STRING, G_TYPE_STRING);
+
+ for (i = NOTIFY_STACK_LOCATION_TOP_LEFT;
+ i <= NOTIFY_STACK_LOCATION_BOTTOM_RIGHT;
+ i++)
+ {
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ NOTIFY_POSITION_LABEL, popup_stack_locations[i].label,
+ NOTIFY_POSITION_NAME, popup_stack_locations[i].identifier,
+ -1);
+ }
+
+ gtk_combo_box_set_model(GTK_COMBO_BOX(dialog->position_combo),
+ GTK_TREE_MODEL(store));
+ g_signal_connect(dialog->position_combo, "changed",
+ G_CALLBACK(notification_properties_location_changed),
+ dialog);
+
+ location = gconf_client_get_string(dialog->client,
+ GCONF_KEY_POPUP_LOCATION, NULL);
+
+ for (valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter);
+ valid;
+ valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter))
+ {
+ gchar *key;
+
+ gtk_tree_model_get(GTK_TREE_MODEL(store), &iter,
+ NOTIFY_POSITION_NAME, &key,
+ -1);
+
+ if (g_str_equal(key, location))
+ {
+ gtk_combo_box_set_active_iter(
+ GTK_COMBO_BOX(dialog->position_combo),
+ &iter);
+ g_free(key);
+ break;
+ }
+
+ g_free(key);
+ }
+
+ dialog->listeners[dialog->n_listeners] = gconf_client_notify_add(
+ dialog->client, GCONF_KEY_POPUP_LOCATION,
+ (GConfClientNotifyFunc)notification_properties_location_notify,
+ dialog, NULL, NULL);
+ dialog->n_listeners++;
+ g_free(location);
+}
+
+static void
+notification_properties_theme_notify(GConfClient *client,
+ guint cnx_id,
+ GConfEntry *entry,
+ NotificationAppletDialog *dialog)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ const char *theme;
+ gboolean valid;
+
+ if (!entry->value || entry->value->type != GCONF_VALUE_STRING)
+ return;
+
+ theme = gconf_value_get_string(entry->value);
+
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(dialog->theme_combo));
+
+ for (valid = gtk_tree_model_get_iter_first(model, &iter);
+ valid;
+ valid = gtk_tree_model_iter_next(model, &iter))
+ {
+ gchar *theme_name;
+
+ gtk_tree_model_get(model, &iter, NOTIFY_THEME_NAME, &theme_name, -1);
+
+ if (g_str_equal(theme_name, theme))
+ {
+ gtk_combo_box_set_active_iter(GTK_COMBO_BOX(dialog->theme_combo),
+ &iter);
+ g_free(theme_name);
+ break;
+ }
+
+ g_free(theme_name);
+ }
+}
+
+static void
+notification_properties_theme_changed(GtkComboBox *widget,
+ NotificationAppletDialog *dialog)
+{
+ char *theme;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(dialog->theme_combo));
+
+ if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(dialog->theme_combo),
+ &iter))
+ {
+ return;
+ }
+
+ gtk_tree_model_get(model, &iter, NOTIFY_THEME_NAME, &theme, -1);
+ gconf_client_set_string(dialog->client, GCONF_KEY_THEME, theme, NULL);
+ g_free(theme);
+}
+
+static gchar *
+get_theme_name(const gchar *filename)
+{
+ gchar *result;
+
+ /* TODO: Remove magic numbers. Strip "lib" and ".so" */
+ result = g_strdup(filename + 3);
+ result[strlen(result) - 3] = '\0';
+ return result;
+}
+
+static void
+notification_properties_dialog_setup_themes(NotificationAppletDialog *dialog)
+{
+ GDir *dir;
+ const gchar *filename;
+ char *theme, *theme_name, *theme_label;
+ gboolean valid;
+ GtkListStore *store;
+ GtkTreeIter iter;
+
+ dialog->theme_combo = glade_xml_get_widget(dialog->xml, "theme_combo");
+ g_assert (dialog->theme_combo != NULL);
+
+ store = gtk_list_store_new(N_COLUMNS_THEME,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
+
+ gtk_combo_box_set_model(GTK_COMBO_BOX(dialog->theme_combo),
+ GTK_TREE_MODEL(store));
+ g_signal_connect(dialog->theme_combo, "changed",
+ G_CALLBACK(notification_properties_theme_changed),
+ dialog);
+
+ GtkCellRenderer *cell = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start(
+ GTK_CELL_LAYOUT(GTK_COMBO_BOX(dialog->theme_combo)),
+ cell, TRUE);
+ gtk_cell_layout_set_attributes(
+ GTK_CELL_LAYOUT(GTK_COMBO_BOX(dialog->theme_combo)),
+ cell, "text", 0, NULL);
+
+ if ((dir = g_dir_open(ENGINES_DIR, 0, NULL)))
+ {
+ while ((filename = g_dir_read_name(dir)))
+ {
+ if ( g_str_has_prefix(filename, "lib") &&
+ g_str_has_suffix(filename, ".so") )
+ {
+ theme_name = get_theme_name(filename);
+
+ /* FIXME: other solution than hardcode? */
+ if (g_str_equal(theme_name, "ubuntu"))
+ theme_label = g_strdup(_("Ubuntu theme"));
+ else if (g_str_equal(theme_name, "standard"))
+ theme_label = g_strdup(_("Standard theme"));
+ else
+ theme_label = g_strdup(theme_name);
+
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ NOTIFY_THEME_LABEL, theme_label,
+ NOTIFY_THEME_NAME, theme_name,
+ NOTIFY_THEME_FILENAME, filename,
+ -1);
+ g_free(theme_name);
+ g_free(theme_label);
+ }
+ }
+
+ g_dir_close(dir);
+ }
+ else
+ {
+ g_warning("Error opening themes dir");
+ }
+
+
+ theme = gconf_client_get_string(dialog->client, GCONF_KEY_THEME, NULL);
+
+ for (valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter);
+ valid;
+ valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter))
+ {
+ gchar *key;
+
+ gtk_tree_model_get(GTK_TREE_MODEL(store), &iter,
+ NOTIFY_THEME_NAME, &key,
+ -1);
+
+ if (g_str_equal(key, theme))
+ {
+ gtk_combo_box_set_active_iter(GTK_COMBO_BOX(dialog->theme_combo),
+ &iter);
+ g_free(key);
+ break;
+ }
+
+ g_free(key);
+ }
+
+ dialog->listeners[dialog->n_listeners] =
+ gconf_client_notify_add(dialog->client,
+ GCONF_KEY_THEME,
+ (GConfClientNotifyFunc)notification_properties_theme_notify,
+ dialog, NULL, NULL);
+ dialog->n_listeners++;
+ g_free(theme);
+}
+
+static void
+notification_properties_dialog_help(void)
+{
+ /* Do nothing */
+}
+
+static void
+show_message(NotificationAppletDialog *dialog,
+ const gchar *message)
+{
+ GtkWidget *d;
+
+ d = gtk_message_dialog_new(GTK_WINDOW(dialog->dialog),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ message);
+ gtk_dialog_run(GTK_DIALOG(d));
+ gtk_widget_destroy(d);
+}
+
+static void
+notification_properties_dialog_preview_closed(NotifyNotification *preview,
+ NotificationAppletDialog *dialog)
+{
+ g_object_unref(dialog->preview);
+ dialog->preview = NULL;
+}
+
+static void
+notification_properties_dialog_preview(NotificationAppletDialog *dialog)
+{
+ GError *error;
+
+ if (!notify_is_initted())
+ {
+ if (!notify_init("n-d"))
+ {
+ show_message(dialog, _("Error initializing libnotify"));
+ return;
+ }
+ }
+
+ error = NULL;
+
+ if (dialog->preview)
+ {
+ notify_notification_close(dialog->preview, NULL);
+ g_object_unref(dialog->preview);
+ dialog->preview = NULL;
+ }
+
+ dialog->preview = notify_notification_new(_("Notification Test"),
+ _("Just a test"),
+ "gnome-util",
+ NULL);
+
+ if (!notify_notification_show(dialog->preview, &error))
+ {
+ char *message = g_strdup_printf(
+ _("Error while displaying notification: %s"), error->message);
+ show_message(dialog, message);
+ g_error_free(error);
+ g_free(message);
+ }
+
+ g_signal_connect(dialog->preview, "closed",
+ G_CALLBACK(notification_properties_dialog_preview_closed),
+ dialog);
+}
+
+static void
+notification_properties_dialog_response(GtkWidget *widget,
+ int response,
+ NotificationAppletDialog *dialog)
+{
+ switch (response)
+ {
+ case GTK_RESPONSE_HELP:
+ notification_properties_dialog_help();
+ break;
+
+ case GTK_RESPONSE_ACCEPT:
+ notification_properties_dialog_preview(dialog);
+ break;
+
+ case GTK_RESPONSE_CLOSE:
+ default:
+ gtk_widget_destroy(widget);
+ break;
+ }
+}
+
+static void
+notification_properties_dialog_destroyed(GtkWidget *widget,
+ NotificationAppletDialog *dialog)
+{
+ dialog->dialog = NULL;
+
+ gtk_main_quit();
+}
+
+static gboolean
+notification_properties_dialog_init(NotificationAppletDialog *dialog)
+{
+#define NOTIFICATION_GLADE_FILE "notification-properties.glade"
+ const char *glade_file;
+
+ if (g_file_test(NOTIFICATION_GLADE_FILE, G_FILE_TEST_EXISTS))
+ glade_file = NOTIFICATION_GLADE_FILE;
+ else
+ glade_file = NOTIFICATION_GLADEDIR "/" NOTIFICATION_GLADE_FILE;
+
+ dialog->xml = glade_xml_new(glade_file, "dialog", NULL);
+
+ if (!dialog->xml)
+ {
+ g_warning(_("Unable to locate glade file '%s'"), glade_file);
+ return FALSE;
+ }
+
+ dialog->dialog = glade_xml_get_widget(dialog->xml, "dialog");
+ g_assert(dialog->dialog != NULL);
+
+ g_signal_connect(dialog->dialog, "response",
+ G_CALLBACK(notification_properties_dialog_response),
+ dialog);
+ g_signal_connect(dialog->dialog, "destroy",
+ G_CALLBACK(notification_properties_dialog_destroyed),
+ dialog);
+
+ dialog->client = gconf_client_get_default();
+ gconf_client_add_dir(dialog->client, GCONF_KEY_DAEMON,
+ GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+
+ dialog->expected_listeners = N_LISTENERS;
+ dialog->n_listeners = 0;
+
+ notification_properties_dialog_setup_themes(dialog);
+ notification_properties_dialog_setup_positions(dialog);
+
+ g_assert(dialog->n_listeners == dialog->expected_listeners);
+ gtk_widget_show(dialog->dialog);
+
+ dialog->preview = NULL;
+
+ return TRUE;
+
+#undef NOTIFICATION_GLADE_FILE
+}
+
+static void
+notification_properties_dialog_finalize(NotificationAppletDialog *dialog)
+{
+ if (dialog->dialog != NULL)
+ {
+ gtk_widget_destroy(dialog->dialog);
+ dialog->dialog = NULL;
+ }
+
+ if (dialog->client != NULL)
+ {
+ int i;
+ for (i = 0; i < dialog->n_listeners; i++)
+ {
+ if (dialog->listeners[i])
+ {
+ gconf_client_notify_remove(dialog->client,
+ dialog->listeners[i]);
+ dialog->listeners[i] = 0;
+ }
+ }
+
+ dialog->n_listeners = 0;
+ gconf_client_remove_dir(dialog->client, GCONF_KEY_DAEMON, NULL);
+ g_object_unref(dialog->client);
+ dialog->client = NULL;
+ }
+
+ if (dialog->xml != NULL)
+ {
+ g_object_unref(dialog->xml);
+ dialog->xml = NULL;
+ }
+
+ if (dialog->preview)
+ {
+ notify_notification_close(dialog->preview, NULL);
+ dialog->preview = NULL;
+ }
+}
+
int
main(int argc, char **argv)
{
+ NotificationAppletDialog dialog = { NULL, };
+
+ bindtextdomain(GETTEXT_PACKAGE, NOTIFICATION_LOCALEDIR);
+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+ textdomain(GETTEXT_PACKAGE);
+
+ gtk_init(&argc, &argv);
+
+ notify_init("notification-properties");
+
+ if (!notification_properties_dialog_init(&dialog))
+ {
+ notification_properties_dialog_finalize(&dialog);
+ return 1;
+ }
+
+ gtk_main();
+
+ notification_properties_dialog_finalize(&dialog);
+
+ return 0;
}
Added: trunk/notification-daemon/src/capplet/notification-properties.glade
===================================================================
--- trunk/notification-daemon/src/capplet/notification-properties.glade (rev 0)
+++ trunk/notification-daemon/src/capplet/notification-properties.glade 2007-06-13 10:00:13 UTC (rev 2985)
@@ -0,0 +1,324 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkDialog" id="dialog">
+ <property name="border_width">5</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="title" translatable="yes">Notification Settings</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+ <property name="modal">False</property>
+ <property name="resizable">False</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
+ <property name="has_separator">False</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="button3">
+ <property name="can_focus">True</property>
+ <property name="label">gtk-help</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">False</property>
+ <property name="response_id">-11</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-3</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-media-play</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label12">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Preview</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button5">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-7</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox4">
+ <property name="border_width">5</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>General Options</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table3">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+
+ <child>
+ <widget class="GtkComboBox" id="theme_combo">
+ <property name="visible">True</property>
+ <property name="add_tearoffs">False</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkComboBox" id="position_combo">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes"></property>
+ <property name="add_tearoffs">False</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Position:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">position_combo</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Theme:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">theme_combo</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
More information about the galago-commits
mailing list