aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mail-notification
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mail-notification')
-rw-r--r--plugins/mail-notification/Makefile.am12
-rw-r--r--plugins/mail-notification/apps-evolution-mail-notification.schemas.in11
-rw-r--r--plugins/mail-notification/mail-notification.c471
3 files changed, 258 insertions, 236 deletions
diff --git a/plugins/mail-notification/Makefile.am b/plugins/mail-notification/Makefile.am
index 0915329b42..b53e6a55a6 100644
--- a/plugins/mail-notification/Makefile.am
+++ b/plugins/mail-notification/Makefile.am
@@ -9,7 +9,8 @@ AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/widgets \
$(EVOLUTION_MAIL_CFLAGS) \
- $(LIBNOTIFY_CFLAGS)
+ $(LIBNOTIFY_CFLAGS) \
+ $(CANBERRA_CFLAGS)
if DBUS_SUPPORT
AM_CPPFLAGS += -DDBUS_API_SUBJECT_TO_CHANGE=1 \
@@ -24,9 +25,12 @@ plugin_LTLIBRARIES = liborg-gnome-mail-notification.la
liborg_gnome_mail_notification_la_SOURCES = mail-notification.c
liborg_gnome_mail_notification_la_LDFLAGS = \
-module -avoid-version $(NO_UNDEFINED)
-liborg_gnome_mail_notification_la_LIBADD = \
- $(LIBNOTIFY_LIBS) \
- $(NO_UNDEFINED_REQUIRED_LIBS)
+liborg_gnome_mail_notification_la_LIBADD = \
+ $(CANBERRA_LIBS) \
+ $(LIBNOTIFY_LIBS) \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/mail/libevolution-mail.la \
+ $(GNOME_PLATFORM_LIBS)
if DBUS_SUPPORT
liborg_gnome_mail_notification_la_LIBADD += $(DBUS_GLIB_LIBS)
diff --git a/plugins/mail-notification/apps-evolution-mail-notification.schemas.in b/plugins/mail-notification/apps-evolution-mail-notification.schemas.in
index c0a038068d..ad7dd91615 100644
--- a/plugins/mail-notification/apps-evolution-mail-notification.schemas.in
+++ b/plugins/mail-notification/apps-evolution-mail-notification.schemas.in
@@ -91,6 +91,17 @@
<long>Sound file to be played when new messages arrive, if not in beep mode.</long>
</locale>
</schema>
+ <schema>
+ <key>/schemas/apps/evolution/eplugin/mail-notification/sound-use-theme</key>
+ <applyto>/apps/evolution/eplugin/mail-notification/sound-use-theme</applyto>
+ <owner>evolution-mail</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Use sound theme</short>
+ <long>Play themed sound when new messages arrive, if not in beep mode.</long>
+ </locale>
+ </schema>
</schemalist>
</gconfschemafile>
diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c
index c42473acc7..f6272ba873 100644
--- a/plugins/mail-notification/mail-notification.c
+++ b/plugins/mail-notification/mail-notification.c
@@ -29,7 +29,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
-#include <libgnome/gnome-sound.h>
+#include <canberra-gtk.h>
#ifdef HAVE_DBUS
#include <dbus/dbus-glib.h>
@@ -38,7 +38,9 @@
#include <time.h>
+#include "e-util/e-binding.h"
#include "e-util/e-config.h"
+#include "e-util/gconf-bridge.h"
#include "mail/em-utils.h"
#include "mail/em-event.h"
#include "mail/em-folder-tree-model.h"
@@ -84,7 +86,7 @@ static GStaticMutex mlock = G_STATIC_MUTEX_INIT;
static gboolean
is_part_enabled (const gchar *gconf_key)
{
- /* the part is enabled by defaul */
+ /* the part is enabled by default */
gboolean res = TRUE;
GConfClient *client;
GConfValue *is_key;
@@ -102,17 +104,6 @@ is_part_enabled (const gchar *gconf_key)
return res;
}
-static void
-set_part_enabled (const gchar *gconf_key, gboolean enable)
-{
- GConfClient *client;
-
- client = gconf_client_get_default ();
-
- gconf_client_set_bool (client, gconf_key, enable, NULL);
- g_object_unref (client);
-}
-
/* ------------------------------------------------------------------- */
/* DBUS part */
/* ------------------------------------------------------------------- */
@@ -201,14 +192,6 @@ init_dbus (void)
return TRUE;
}
-static void
-toggled_dbus_cb (GtkWidget *widget, gpointer data)
-{
- g_return_if_fail (widget != NULL);
-
- set_part_enabled (GCONF_KEY_ENABLED_DBUS, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
-}
-
/* ------------------------------------------------------------------- */
static void
@@ -236,21 +219,6 @@ enable_dbus (gint enable)
bus = NULL;
}
}
-
-static GtkWidget *
-get_config_widget_dbus (void)
-{
- GtkWidget *w;
-
- w = gtk_check_button_new_with_mnemonic (_("Generate a _D-Bus message"));
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), is_part_enabled (GCONF_KEY_ENABLED_DBUS));
- g_signal_connect (G_OBJECT (w), "toggled", G_CALLBACK (toggled_dbus_cb), NULL);
- gtk_widget_show (w);
-
- return w;
-}
-
#endif
/* ------------------------------------------------------------------- */
@@ -276,12 +244,12 @@ icon_activated (GtkStatusIcon *icon, NotifyNotification *pnotify)
icon_activated (GtkStatusIcon *icon, gpointer pnotify)
#endif
{
- #ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBNOTIFY
if (notify)
notify_notification_close (notify, NULL);
notify = NULL;
- #endif
+#endif
gtk_status_icon_set_visible (status_icon, FALSE);
g_object_unref (status_icon);
@@ -314,45 +282,6 @@ stop_blinking_cb (gpointer data)
return FALSE;
}
-struct _StatusConfigureWidgets
-{
- GtkWidget *enable;
- GtkWidget *blink;
- #ifdef HAVE_LIBNOTIFY
- GtkWidget *message;
- #endif
-};
-
-static void
-toggled_status_cb (GtkWidget *widget, gpointer data)
-{
- struct _StatusConfigureWidgets *scw = (struct _StatusConfigureWidgets *) data;
- gboolean enabl;
-
- g_return_if_fail (scw != NULL);
- g_return_if_fail (scw->enable != NULL);
- g_return_if_fail (scw->blink != NULL);
- #ifdef HAVE_LIBNOTIFY
- g_return_if_fail (scw->message != NULL);
- #endif
-
- enabl = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scw->enable));
- if (widget == scw->enable)
- set_part_enabled (GCONF_KEY_ENABLED_STATUS, enabl);
-
- #define work_widget(w, key) \
- gtk_widget_set_sensitive (w, enabl); \
- if (widget == w) \
- set_part_enabled (key, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)));
-
- work_widget (scw->blink, GCONF_KEY_STATUS_BLINK);
- #ifdef HAVE_LIBNOTIFY
- work_widget (scw->message, GCONF_KEY_STATUS_NOTIFICATION);
- #endif
-
- #undef work_widget
-}
-
/* ------------------------------------------------------------------- */
static void
@@ -409,11 +338,11 @@ popup_menu_status (GtkStatusIcon *status_icon, guint button, guint activate_time
menu = GTK_MENU (gtk_menu_new ());
item = gtk_image_menu_item_new_from_stock (GTK_STOCK_CLOSE, NULL);
- #ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBNOTIFY
g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (icon_activated), notify);
- #else
+#else
g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (icon_activated), NULL);
- #endif
+#endif
gtk_widget_show (item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
@@ -513,7 +442,7 @@ new_notify_status (EMEventTargetFolder *t)
gtk_status_icon_set_visible (status_icon, TRUE);
- #ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBNOTIFY
/* Now check whether we're supposed to send notifications */
if (is_part_enabled (GCONF_KEY_STATUS_NOTIFICATION)) {
if (notify) {
@@ -534,16 +463,16 @@ new_notify_status (EMEventTargetFolder *t)
}
}
}
- #endif
+#endif
g_free (msg);
if (new_icon) {
- #ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBNOTIFY
g_signal_connect (G_OBJECT (status_icon), "activate", G_CALLBACK (icon_activated), notify);
- #else
+#else
g_signal_connect (G_OBJECT (status_icon), "activate", G_CALLBACK (icon_activated), NULL);
- #endif
+#endif
g_signal_connect (G_OBJECT (status_icon), "popup-menu", G_CALLBACK (popup_menu_status), NULL);
}
@@ -555,56 +484,77 @@ read_notify_status (EMEventTargetMessage *t)
if (!status_icon)
return;
- #ifdef HAVE_LIBNOTIFY
+#ifdef HAVE_LIBNOTIFY
icon_activated (status_icon, notify);
- #else
+#else
icon_activated (status_icon, NULL);
- #endif
-}
-
-static void
-enable_status (gint enable)
-{
- /* this does nothing on enable, it's here just to be
- consistent with other parts of this plugin */
+#endif
}
static GtkWidget *
get_config_widget_status (void)
{
- GtkWidget *vbox, *parent, *alignment;
- struct _StatusConfigureWidgets *scw;
+ GtkWidget *vbox;
+ GtkWidget *master;
+ GtkWidget *container;
+ GtkWidget *widget;
+ GConfBridge *bridge;
+ const gchar *text;
- vbox = gtk_vbox_new (FALSE, 0);
- scw = g_malloc0 (sizeof (struct _StatusConfigureWidgets));
+ bridge = gconf_bridge_get ();
- #define create_check(c, key, desc) \
- c = gtk_check_button_new_with_mnemonic (desc); \
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (c), is_part_enabled (key)); \
- gtk_box_pack_start (GTK_BOX (parent), c, FALSE, FALSE, 0); \
- g_signal_connect (G_OBJECT (c), "toggled", G_CALLBACK (toggled_status_cb), scw);
+ vbox = gtk_vbox_new (FALSE, 6);
+ gtk_widget_show (vbox);
- parent = vbox;
- create_check (scw->enable, GCONF_KEY_ENABLED_STATUS, _("Show icon in _notification area"));
+ container = vbox;
- parent = gtk_vbox_new (FALSE, 0);
- create_check (scw->blink, GCONF_KEY_STATUS_BLINK, _("B_link icon in notification area"));
- #ifdef HAVE_LIBNOTIFY
- create_check (scw->message, GCONF_KEY_STATUS_NOTIFICATION, _("Popup _message together with the icon"));
- #endif
+ text = _("Show icon in _notification area");
+ widget = gtk_check_button_new_with_mnemonic (text);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
- alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 20, 0);
- gtk_container_add (GTK_CONTAINER (alignment), parent);
- gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
+ gconf_bridge_bind_property (
+ bridge, GCONF_KEY_ENABLED_STATUS,
+ G_OBJECT (widget), "active");
- #undef create_check
+ master = widget;
- /* to let structure free properly */
- g_object_set_data_full (G_OBJECT (vbox), "scw-data", scw, g_free);
+ widget = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (widget), 0, 0, 12, 0);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ e_binding_new (
+ G_OBJECT (master), "active",
+ G_OBJECT (widget), "sensitive");
+
+ container = widget;
+
+ widget = gtk_vbox_new (FALSE, 6);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ gtk_widget_show (widget);
- toggled_status_cb (NULL, scw);
- gtk_widget_show_all (vbox);
+ container = widget;
+
+ text = _("B_link icon in notification area");
+ widget = gtk_check_button_new_with_mnemonic (text);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ gconf_bridge_bind_property (
+ bridge, GCONF_KEY_STATUS_BLINK,
+ G_OBJECT (widget), "active");
+
+#ifdef HAVE_LIBNOTIFY
+ text = _("Popup _message together with the icon");
+ widget = gtk_check_button_new_with_mnemonic (text);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ gconf_bridge_bind_property (
+ bridge, GCONF_KEY_STATUS_NOTIFICATION,
+ G_OBJECT (widget), "active");
+#endif
return vbox;
}
@@ -618,57 +568,39 @@ get_config_widget_status (void)
#define GCONF_KEY_SOUND_BEEP GCONF_KEY_ROOT "sound-beep"
#define GCONF_KEY_SOUND_FILE GCONF_KEY_ROOT "sound-file"
+#define GCONF_KEY_SOUND_PLAY_FILE GCONF_KEY_ROOT "sound-play-file"
+#define GCONF_KEY_SOUND_USE_THEME GCONF_KEY_ROOT "sound-use-theme"
+
+static ca_context *mailnotification = NULL;
static void
-do_play_sound (gboolean beep, const gchar *file)
-{
- if (beep)
- gdk_beep ();
- else if (!file || !*file)
- g_warning ("No file to play!");
+do_play_sound (gboolean beep, gboolean use_theme, const gchar *file)
+{
+ if (!beep) {
+ if ( (file || *file) && !use_theme )
+ ca_context_play(mailnotification, 0,
+ CA_PROP_MEDIA_FILENAME, file,
+ NULL);
+ else
+ ca_context_play(mailnotification, 0,
+ CA_PROP_EVENT_ID,"message-new-email",
+ NULL);
+ }
else
- gnome_sound_play (file);
+ gdk_beep();
}
struct _SoundConfigureWidgets
{
GtkWidget *enable;
GtkWidget *beep;
+ GtkWidget *use_theme;
GtkWidget *file;
- GtkWidget *label;
GtkWidget *filechooser;
GtkWidget *play;
};
static void
-toggled_sound_cb (GtkWidget *widget, gpointer data)
-{
- struct _SoundConfigureWidgets *scw = (struct _SoundConfigureWidgets *) data;
- gboolean enabl;
-
- g_return_if_fail (data != NULL);
- g_return_if_fail (scw->enable != NULL);
- g_return_if_fail (scw->beep != NULL);
- g_return_if_fail (scw->file != NULL);
- g_return_if_fail (scw->label != NULL);
- g_return_if_fail (scw->filechooser != NULL);
- g_return_if_fail (scw->play != NULL);
-
- enabl = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scw->enable));
- if (widget == scw->enable)
- set_part_enabled (GCONF_KEY_ENABLED_SOUND, enabl);
-
- gtk_widget_set_sensitive (scw->beep, enabl);
- gtk_widget_set_sensitive (scw->file, enabl);
- gtk_widget_set_sensitive (scw->label, enabl);
- gtk_widget_set_sensitive (scw->filechooser, enabl && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scw->file)));
- gtk_widget_set_sensitive (scw->play, enabl);
-
- if (widget == scw->beep || widget == scw->file)
- set_part_enabled (GCONF_KEY_SOUND_BEEP, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scw->beep)));
-}
-
-static void
sound_file_set_cb (GtkWidget *widget, gpointer data)
{
gchar *file;
@@ -697,7 +629,9 @@ sound_play_cb (GtkWidget *widget, gpointer data)
return;
file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (scw->filechooser));
- do_play_sound (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scw->beep)), file);
+ do_play_sound (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (scw->beep)),
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (scw->use_theme)),
+ file);
g_free (file);
}
@@ -718,7 +652,9 @@ sound_notify_idle_cb (gpointer user_data)
client = gconf_client_get_default ();
file = gconf_client_get_string (client, GCONF_KEY_SOUND_FILE, NULL);
- do_play_sound (is_part_enabled (GCONF_KEY_SOUND_BEEP), file);
+ do_play_sound (is_part_enabled (GCONF_KEY_SOUND_BEEP),
+ is_part_enabled (GCONF_KEY_SOUND_USE_THEME),
+ file);
g_object_unref (client);
g_free (file);
@@ -754,47 +690,129 @@ read_notify_sound (EMEventTargetMessage *t)
static void
enable_sound (gint enable)
{
- if (enable)
- gnome_sound_init ("localhost");
+ if (enable) {
+ ca_context_create(&mailnotification);
+ ca_context_change_props(
+ mailnotification,
+ CA_PROP_APPLICATION_NAME,
+ "mailnotification Plugin",
+ NULL);
+ }
else
- gnome_sound_shutdown ();
+ ca_context_destroy(mailnotification);
}
static GtkWidget *
get_config_widget_sound (void)
{
- GtkWidget *vbox, *alignment, *parent, *hbox;
+ GtkWidget *vbox;
+ GtkWidget *container;
+ GtkWidget *master;
+ GtkWidget *widget;
gchar *file;
+ GConfBridge *bridge;
GConfClient *client;
+ GSList *group = NULL;
struct _SoundConfigureWidgets *scw;
+ const gchar *text;
+
+ bridge = gconf_bridge_get ();
- vbox = gtk_vbox_new (FALSE, 0);
scw = g_malloc0 (sizeof (struct _SoundConfigureWidgets));
- scw->enable = gtk_check_button_new_with_mnemonic (_("_Play sound when new messages arrive"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scw->enable), is_part_enabled (GCONF_KEY_ENABLED_SOUND));
- gtk_box_pack_start (GTK_BOX (vbox), scw->enable, FALSE, FALSE, 0);
- g_signal_connect (G_OBJECT (scw->enable), "toggled", G_CALLBACK (toggled_sound_cb), scw);
+ vbox = gtk_vbox_new (FALSE, 6);
+ gtk_widget_show (vbox);
+
+ container = vbox;
- parent = gtk_vbox_new (FALSE, 0);
- scw->beep = gtk_radio_button_new_with_mnemonic (NULL, _("_Beep"));
- scw->file = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (scw->beep), _("Play _sound file"));
+ text = _("_Play sound when new messages arrive");
+ widget = gtk_check_button_new_with_mnemonic (text);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
- if (is_part_enabled (GCONF_KEY_SOUND_BEEP))
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scw->beep), TRUE);
- else
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scw->file), TRUE);
+ gconf_bridge_bind_property (
+ bridge, GCONF_KEY_ENABLED_SOUND,
+ G_OBJECT (widget), "active");
+
+ master = widget;
+ scw->enable = widget;
+
+ widget = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (widget), 0, 0, 12, 0);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ e_binding_new (
+ G_OBJECT (master), "active",
+ G_OBJECT (widget), "sensitive");
+
+ container = widget;
+
+ widget = gtk_vbox_new (FALSE, 6);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ text = _("_Beep");
+ widget = gtk_radio_button_new_with_mnemonic (group, text);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ gconf_bridge_bind_property (
+ bridge, GCONF_KEY_SOUND_BEEP,
+ G_OBJECT (widget), "active");
- g_signal_connect (G_OBJECT (scw->beep), "toggled", G_CALLBACK (toggled_sound_cb), scw);
- g_signal_connect (G_OBJECT (scw->file), "toggled", G_CALLBACK (toggled_sound_cb), scw);
+ scw->beep = widget;
- hbox = gtk_hbox_new (FALSE, 0);
- scw->label = gtk_label_new_with_mnemonic (_("Specify _filename:"));
- scw->filechooser = gtk_file_chooser_button_new (_("Select sound file"), GTK_FILE_CHOOSER_ACTION_OPEN);
- scw->play = gtk_button_new_with_mnemonic (_("Pl_ay"));
+ group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
- gtk_label_set_mnemonic_widget (GTK_LABEL (scw->label), scw->filechooser);
- gtk_button_set_image (GTK_BUTTON (scw->play), gtk_image_new_from_icon_name ("media-playback-start", GTK_ICON_SIZE_BUTTON));
+ text = _("Use sound _theme");
+ widget = gtk_radio_button_new_with_mnemonic (group, text);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ gconf_bridge_bind_property (
+ bridge, GCONF_KEY_SOUND_USE_THEME,
+ G_OBJECT (widget), "active");
+
+ scw->use_theme = widget;
+
+ group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
+
+ widget = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ text = _("Play _file:");
+ widget = gtk_radio_button_new_with_mnemonic (group, text);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ gconf_bridge_bind_property (
+ bridge, GCONF_KEY_SOUND_PLAY_FILE,
+ G_OBJECT (widget), "active");
+
+ scw->file = widget;
+
+ text = _("Select sound file");
+ widget = gtk_file_chooser_button_new (
+ text, GTK_FILE_CHOOSER_ACTION_OPEN);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ gtk_widget_show (widget);
+
+ scw->filechooser = widget;
+
+ widget = gtk_button_new ();
+ gtk_button_set_image (
+ GTK_BUTTON (widget), gtk_image_new_from_icon_name (
+ "media-playback-start", GTK_ICON_SIZE_BUTTON));
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ scw->play = widget;
client = gconf_client_get_default ();
file = gconf_client_get_string (client, GCONF_KEY_SOUND_FILE, NULL);
@@ -805,28 +823,16 @@ get_config_widget_sound (void)
g_object_unref (client);
g_free (file);
- g_signal_connect (G_OBJECT (scw->filechooser), "file-set", G_CALLBACK (sound_file_set_cb), scw);
- g_signal_connect (G_OBJECT (scw->play), "clicked", G_CALLBACK (sound_play_cb), scw);
-
- gtk_box_pack_start (GTK_BOX (hbox), scw->label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), scw->filechooser, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), scw->play, FALSE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (parent), scw->beep, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (parent), scw->file, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (parent), hbox, FALSE, FALSE, 0);
-
- alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 20, 0);
- gtk_container_add (GTK_CONTAINER (alignment), parent);
- gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
+ g_signal_connect (
+ scw->filechooser, "file-set",
+ G_CALLBACK (sound_file_set_cb), scw);
+ g_signal_connect (
+ scw->play, "clicked",
+ G_CALLBACK (sound_play_cb), scw);
/* to let structure free properly */
g_object_set_data_full (G_OBJECT (vbox), "scw-data", scw, g_free);
- toggled_sound_cb (NULL, scw);
- gtk_widget_show_all (vbox);
-
return vbox;
}
@@ -834,49 +840,54 @@ get_config_widget_sound (void)
/* Plugin itself part */
/* ------------------------------------------------------------------- */
-static void
-toggled_only_inbox_cb (GtkWidget *widget, gpointer data)
-{
- g_return_if_fail (widget != NULL);
-
- set_part_enabled (GCONF_KEY_NOTIFY_ONLY_INBOX, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
-}
-
static GtkWidget *
get_cfg_widget (void)
{
- GtkWidget *cfg, *vbox, *check;
+ GtkWidget *container;
+ GtkWidget *widget;
+ GConfBridge *bridge;
+ const gchar *text;
- vbox = gtk_vbox_new (FALSE, 6);
- check = gtk_check_button_new_with_mnemonic (_("Notify new messages for _Inbox only"));
+ bridge = gconf_bridge_get ();
+
+ widget = gtk_vbox_new (FALSE, 12);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ text = _("Notify new messages for _Inbox only");
+ widget = gtk_check_button_new_with_mnemonic (text);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), is_part_enabled (GCONF_KEY_NOTIFY_ONLY_INBOX));
- g_signal_connect (G_OBJECT (check), "toggled", G_CALLBACK (toggled_only_inbox_cb), NULL);
- gtk_widget_show (check);
- gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
+ gconf_bridge_bind_property (
+ bridge, GCONF_KEY_NOTIFY_ONLY_INBOX,
+ G_OBJECT (widget), "active");
#ifdef HAVE_DBUS
- cfg = get_config_widget_dbus ();
- if (cfg)
- gtk_box_pack_start (GTK_BOX (vbox), cfg, FALSE, FALSE, 0);
+ text = _("Generate a _D-Bus message");
+ widget = gtk_check_button_new_with_mnemonic (text);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ gconf_bridge_bind_property (
+ bridge, GCONF_KEY_ENABLED_DBUS,
+ G_OBJECT (widget), "active");
#endif
- cfg = get_config_widget_status ();
- if (cfg)
- gtk_box_pack_start (GTK_BOX (vbox), cfg, FALSE, FALSE, 0);
- cfg = get_config_widget_sound ();
- if (cfg)
- gtk_box_pack_start (GTK_BOX (vbox), cfg, FALSE, FALSE, 0);
+ widget = get_config_widget_status ();
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
- gtk_widget_show (vbox);
+ widget = get_config_widget_sound ();
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
- return vbox;
+ return container;
}
void org_gnome_mail_new_notify (EPlugin *ep, EMEventTargetFolder *t);
void org_gnome_mail_read_notify (EPlugin *ep, EMEventTargetMessage *t);
-gint e_plugin_lib_enable (EPluginLib *ep, gint enable);
+gint e_plugin_lib_enable (EPlugin *ep, gint enable);
GtkWidget *e_plugin_lib_get_configure_widget (EPlugin *epl);
void
@@ -926,16 +937,13 @@ org_gnome_mail_read_notify (EPlugin *ep, EMEventTargetMessage *t)
}
gint
-e_plugin_lib_enable (EPluginLib *ep, gint enable)
+e_plugin_lib_enable (EPlugin *ep, gint enable)
{
if (enable) {
#ifdef HAVE_DBUS
if (is_part_enabled (GCONF_KEY_ENABLED_DBUS))
enable_dbus (enable);
#endif
- if (is_part_enabled (GCONF_KEY_ENABLED_STATUS))
- enable_status (enable);
-
if (is_part_enabled (GCONF_KEY_ENABLED_SOUND))
enable_sound (enable);
@@ -944,7 +952,6 @@ e_plugin_lib_enable (EPluginLib *ep, gint enable)
#ifdef HAVE_DBUS
enable_dbus (enable);
#endif
- enable_status (enable);
enable_sound (enable);
enabled = FALSE;