diff options
author | Srinivasa Ragavan <sragavan@src.gnome.org> | 2007-05-18 11:43:51 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2007-05-18 11:43:51 +0800 |
commit | 1e906110ccc40256aee28b45deb88e3cdef8242e (patch) | |
tree | b67e8afda83b0072cdc235242e6fd8a01314e15d /plugins/mail-notification | |
parent | a7b11e8aac05151a4d862faabea2f01d54cce5bc (diff) | |
download | gsoc2013-evolution-1e906110ccc40256aee28b45deb88e3cdef8242e.tar gsoc2013-evolution-1e906110ccc40256aee28b45deb88e3cdef8242e.tar.gz gsoc2013-evolution-1e906110ccc40256aee28b45deb88e3cdef8242e.tar.bz2 gsoc2013-evolution-1e906110ccc40256aee28b45deb88e3cdef8242e.tar.lz gsoc2013-evolution-1e906110ccc40256aee28b45deb88e3cdef8242e.tar.xz gsoc2013-evolution-1e906110ccc40256aee28b45deb88e3cdef8242e.tar.zst gsoc2013-evolution-1e906110ccc40256aee28b45deb88e3cdef8242e.zip |
** Fix for bug #439146 and #438711 from Ross Burton and Daniel Gryniewicz
svn path=/trunk/; revision=33556
Diffstat (limited to 'plugins/mail-notification')
-rw-r--r-- | plugins/mail-notification/ChangeLog | 10 | ||||
-rw-r--r-- | plugins/mail-notification/Makefile.am | 16 | ||||
-rw-r--r-- | plugins/mail-notification/apps-evolution-mail-notification.schemas.in.in | 27 | ||||
-rw-r--r-- | plugins/mail-notification/mail-notification.c | 54 |
4 files changed, 87 insertions, 20 deletions
diff --git a/plugins/mail-notification/ChangeLog b/plugins/mail-notification/ChangeLog index 83fbba0aa7..d06fe45266 100644 --- a/plugins/mail-notification/ChangeLog +++ b/plugins/mail-notification/ChangeLog @@ -1,3 +1,13 @@ +2007-05-18 Srinivasa Ragavan <sragavan@novell.com> + + ** Fix for bug #439146 and #438711 from Ross Burton and Daniel Gryniewicz + + * Makefile.am: + * apps-evolution-mail-notification.schemas.in.in: Schema to control + blink and notification. + * mail-notification.c: (org_gnome_mail_read_notify), + (org_gnome_mail_new_notify): More cleanups + 2007-05-11 Srinivasa Ragavan <sragavan@novell.com> * mail-notification.c: (org_gnome_mail_new_notify): Build error. diff --git a/plugins/mail-notification/Makefile.am b/plugins/mail-notification/Makefile.am index 6644bf97b5..33d0233726 100644 --- a/plugins/mail-notification/Makefile.am +++ b/plugins/mail-notification/Makefile.am @@ -18,6 +18,22 @@ 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 +schemadir = $(GCONF_SCHEMA_FILE_DIR) +schema_in_files = apps-evolution-mail-notification.schemas.in.in +schema_DATA = $(schema_in_files:.schemas.in.in=-$(BASE_VERSION).schemas) + +%-$(BASE_VERSION).schemas.in: %.schemas.in.in + cp $< $@ + +@INTLTOOL_SCHEMAS_RULE@ + +install-data-local: + if test -z "$(DESTDIR)" ; then \ + for p in $(schema_DATA) ; do \ + GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $$p; \ + done \ + fi + EXTRA_DIST = org-gnome-mail-notification.eplug.xml BUILT_SOURCES = $(plugin_DATA) diff --git a/plugins/mail-notification/apps-evolution-mail-notification.schemas.in.in b/plugins/mail-notification/apps-evolution-mail-notification.schemas.in.in new file mode 100644 index 0000000000..5cc552d0d0 --- /dev/null +++ b/plugins/mail-notification/apps-evolution-mail-notification.schemas.in.in @@ -0,0 +1,27 @@ +<gconfschemafile> + <schemalist> + <schema> + <key>/schemas/apps/evolution/mail/notification/notification</key> + <applyto>/apps/evolution/mail/notification/notification</applyto> + <owner>evolution-mail</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Enable libnotify notifications of new mail</short> + <long>Every time a new mail arrives, pop up a libnotify notification.</long> + </locale> + </schema> + <schema> + <key>/schemas/apps/evolution/mail/notification/blink-status-icon</key> + <applyto>/apps/evolution/mail/notification/blink-status-icon</applyto> + <owner>evolution-mail</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Make the status icon blink</short> + <long>When the new-mail status icon is visible, make it blink.</long> + </locale> + </schema> + </schemalist> +</gconfschemafile> + diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c index 29ea1e3374..7eace23fb9 100644 --- a/plugins/mail-notification/mail-notification.c +++ b/plugins/mail-notification/mail-notification.c @@ -40,6 +40,9 @@ #include <libnotify/notify.h> #endif +#define GCONF_KEY_NOTIFICATION "/apps/evolution/mail/notification/notification" +#define GCONF_KEY_BLINK "/apps/evolution/mail/notification/blink-status-icon" + int e_plugin_lib_enable (EPluginLib *ep, int enable); void org_gnome_mail_new_notify (EPlugin *ep, EMEventTargetFolder *t); void org_gnome_mail_read_notify (EPlugin *ep, EMEventTargetMessage *t); @@ -62,7 +65,6 @@ org_gnome_mail_read_notify (EPlugin *ep, EMEventTargetMessage *t) gtk_status_icon_set_visible (status_icon, FALSE); g_static_mutex_unlock (&mlock); - } static void @@ -79,9 +81,9 @@ org_gnome_mail_new_notify (EPlugin *ep, EMEventTargetFolder *t) { char *msg = NULL; char *folder; + GConfClient *client; + GConfValue *is_key; #ifdef HAVE_LIBNOTIFY - NotifyUrgency urgency = NOTIFY_URGENCY_NORMAL; - long expire_timeout = NOTIFY_EXPIRES_DEFAULT; NotifyNotification *notify; #endif /* FIXME: Should this is_inbox be configurable? */ @@ -89,38 +91,50 @@ org_gnome_mail_new_notify (EPlugin *ep, EMEventTargetFolder *t) return; g_static_mutex_lock (&mlock); + client = gconf_client_get_default (); - if (!status_icon) { - status_icon = gtk_status_icon_new (); - gtk_status_icon_set_from_pixbuf (status_icon, e_icon_factory_get_icon ("stock_mail", E_ICON_SIZE_LARGE_TOOLBAR)); - gtk_status_icon_set_blinking (status_icon, TRUE); - } + is_key = gconf_client_get (client, GCONF_KEY_BLINK, NULL); + if (!is_key) + gconf_client_set_bool (client, GCONF_KEY_BLINK, TRUE, NULL); + + gconf_value_free (is_key); + if (!status_icon) + status_icon = gtk_status_icon_new_from_pixbuf (e_icon_factory_get_icon ("stock_mail", E_ICON_SIZE_LARGE_TOOLBAR)); folder = em_utils_folder_name_from_uri (t->uri); msg = g_strdup_printf (_("You have received %d new messages in %s."), t->new, folder); gtk_status_icon_set_tooltip (status_icon, msg); gtk_status_icon_set_visible (status_icon, TRUE); + gtk_status_icon_set_blinking (status_icon, + gconf_client_get_bool (client, GCONF_KEY_BLINK, NULL)); #ifdef HAVE_LIBNOTIFY - if (!notify_init("notify-send")) - fprintf(stderr,"notify init error"); - - notify = notify_notification_new("New email in Evolution", - msg, - "stock_mail", - NULL); - if(notify==NULL) - fprintf(stderr,"notify = NULL !!\n"); - else { - notify_notification_set_urgency(notify, urgency); - notify_notification_set_timeout(notify, expire_timeout); + /* See whether the notification key has already been set */ + is_key = gconf_client_get (client, GCONF_KEY_NOTIFICATION, NULL); + if (!is_key) + gconf_client_set_bool (client, GCONF_KEY_NOTIFICATION, TRUE, NULL); + gconf_value_free (is_key); + + /* Now check whether we're supposed to send notifications */ + if (gconf_client_get_bool (client, GCONF_KEY_NOTIFICATION, NULL)) { + if (!notify_init ("evolution-mail-notification")) + fprintf(stderr,"notify init error"); + + notify = notify_notification_new_with_status_icon ( + "New email", + msg, + "stock_mail", + status_icon); + notify_notification_set_urgency(notify, NOTIFY_URGENCY_NORMAL); + notify_notification_set_timeout(notify, NOTIFY_EXPIRES_DEFAULT); notify_notification_show(notify, NULL); } #endif g_free (folder); g_free (msg); + g_object_unref (client); g_signal_connect (G_OBJECT (status_icon), "activate", G_CALLBACK (icon_activated), NULL); g_static_mutex_unlock (&mlock); |