aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-09-18 22:28:13 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-09-18 23:58:19 +0800
commit3f1448b0119585493e1d213af9afde5faf50cb2c (patch)
tree6addf33f16a492227b262df4a4fa7e116848df72
parentf99137ce6242e40274bb89baeae8d762ae726f1a (diff)
downloadgsoc2013-evolution-3f1448b0119585493e1d213af9afde5faf50cb2c.tar.gz
gsoc2013-evolution-3f1448b0119585493e1d213af9afde5faf50cb2c.tar.zst
gsoc2013-evolution-3f1448b0119585493e1d213af9afde5faf50cb2c.zip
Restore the alarm notify daemon.
Convert evolution-alarm-notify to an autostart program, add a .desktop file for it, and use libunique to ensure only one instance is running.
-rw-r--r--calendar/gui/Makefile.am4
-rw-r--r--calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.server.in.in27
-rw-r--r--calendar/gui/alarm-notify/Makefile.am4
-rw-r--r--calendar/gui/alarm-notify/alarm-notify.c206
-rw-r--r--calendar/gui/alarm-notify/alarm-notify.h60
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c1
-rw-r--r--calendar/gui/alarm-notify/notify-main.c130
-rw-r--r--configure.ac1
-rw-r--r--data/Makefile.am7
-rw-r--r--data/evolution-alarm-notify.desktop.in.in14
-rw-r--r--shell/main.c2
11 files changed, 188 insertions, 268 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index f5e3374f27..e732b83837 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -2,9 +2,7 @@ if OS_WIN32
WIN32_BOOTSTRAP_LIBS = $(top_builddir)/win32/libevolution-mail.la
endif
-# KILL-BONOBO: Temporarily disabled alarm-notify
-#SUBDIRS = alarm-notify dialogs
-SUBDIRS = dialogs
+SUBDIRS = alarm-notify dialogs
privsolib_LTLIBRARIES = libevolution-calendar.la
diff --git a/calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.server.in.in b/calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.server.in.in
deleted file mode 100644
index 885af33fb5..0000000000
--- a/calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.server.in.in
+++ /dev/null
@@ -1,27 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_AlarmNotify_Factory:@VERSION@"
- type="exe"
- location="@PRIVLIBEXECDIR_IN_SERVER_FILE@/evolution-alarm-notify@EXEEXT@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Calendar alarm notification service"/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_AlarmNotify:@VERSION@"
- type="factory"
- location="OAFIID:GNOME_Evolution_Calendar_AlarmNotify_Factory:@VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/Unknown:1.0"/>
- <item value="IDL:GNOME/Evolution/Calendar/AlarmNotify:@VERSION@"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string" _value="Evolution Calendar alarm notification service"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/calendar/gui/alarm-notify/Makefile.am b/calendar/gui/alarm-notify/Makefile.am
index d8a68387fe..7fce7dbc23 100644
--- a/calendar/gui/alarm-notify/Makefile.am
+++ b/calendar/gui/alarm-notify/Makefile.am
@@ -1,5 +1,4 @@
-privlibexec_PROGRAMS = evolution-alarm-notify
-
+bin_PROGRAMS = evolution-alarm-notify
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"evolution-alarm-notify\" \
@@ -16,7 +15,6 @@ glade_DATA = \
alarm-notify.glade
evolution_alarm_notify_SOURCES = \
- $(CORBA_GENERATED) \
alarm.c \
alarm.h \
alarm-notify.c \
diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c
index 62679bb2b6..5651a61182 100644
--- a/calendar/gui/alarm-notify/alarm-notify.c
+++ b/calendar/gui/alarm-notify/alarm-notify.c
@@ -25,7 +25,6 @@
#endif
#include <string.h>
-#include <bonobo/bonobo-main.h>
#include <libedataserver/e-url.h>
#include <libedataserver/e-data-server-util.h>
#include <libedataserverui/e-passwords.h>
@@ -34,54 +33,36 @@
#include "alarm-queue.h"
#include "config-data.h"
#include "common/authentication.h"
-
-/* Private part of the AlarmNotify structure */
+
+#define d(x)
+
+#define ALARM_NOTIFY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_ALARM_NOTIFY, AlarmNotifyPrivate))
+
struct _AlarmNotifyPrivate {
/* Mapping from EUri's to LoadedClient structures */
/* FIXME do we need per source type uri hashes? or perhaps we
just need to hash based on source */
- GHashTable *uri_client_hash [E_CAL_SOURCE_TYPE_LAST];
- ESourceList *source_lists [E_CAL_SOURCE_TYPE_LAST];
+ GHashTable *uri_client_hash[E_CAL_SOURCE_TYPE_LAST];
+ ESourceList *source_lists[E_CAL_SOURCE_TYPE_LAST];
ESourceList *selected_calendars;
GMutex *mutex;
};
-#define d(x)
-
-
-static void alarm_notify_class_init (AlarmNotifyClass *klass);
-static void alarm_notify_init (AlarmNotify *an, AlarmNotifyClass *klass);
-static void alarm_notify_finalize (GObject *object);
-
-static BonoboObjectClass *parent_class;
-
-
-BONOBO_TYPE_FUNC_FULL(AlarmNotify, GNOME_Evolution_Calendar_AlarmNotify, BONOBO_TYPE_OBJECT, alarm_notify)
-
-/* Class initialization function for the alarm notify service */
-static void
-alarm_notify_class_init (AlarmNotifyClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = alarm_notify_finalize;
-}
-
typedef struct {
AlarmNotify *an;
ESourceList *source_list;
GList *removals;
} ProcessRemovalsData;
+static gpointer parent_class;
+
static void
-process_removal_in_hash (gpointer key, gpointer value, gpointer data)
+process_removal_in_hash (const gchar *uri,
+ gpointer value,
+ ProcessRemovalsData *prd)
{
- gchar *uri = key;
- ProcessRemovalsData *prd = data;
GSList *groups, *sources, *p, *q;
gboolean found = FALSE;
@@ -109,27 +90,25 @@ process_removal_in_hash (gpointer key, gpointer value, gpointer data)
}
/* not found, so list it for removal */
- prd->removals = g_list_prepend (prd->removals, uri);
+ prd->removals = g_list_prepend (prd->removals, (gpointer) uri);
}
static void
-list_changed_cb (ESourceList *source_list, gpointer data)
+alarm_notify_list_changed_cb (ESourceList *source_list,
+ AlarmNotify *an)
{
- AlarmNotify *an = data;
- AlarmNotifyPrivate *priv;
GSList *groups, *sources, *p, *q;
ECalSourceType source_type = E_CAL_SOURCE_TYPE_LAST;
ProcessRemovalsData prd;
GList *l;
gint i;
- g_signal_handlers_block_by_func(source_list, list_changed_cb, data);
-
- priv = an->priv;
+ g_signal_handlers_block_by_func (
+ source_list, alarm_notify_list_changed_cb, an);
/* Figure out the source type */
for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++) {
- if (source_list == priv->source_lists[i]) {
+ if (source_list == an->priv->source_lists[i]) {
source_type = i;
break;
}
@@ -153,7 +132,7 @@ list_changed_cb (ESourceList *source_list, gpointer data)
continue;
uri = e_source_get_uri (source);
- if (!g_hash_table_lookup (priv->uri_client_hash[source_type], uri)) {
+ if (!g_hash_table_lookup (an->priv->uri_client_hash[source_type], uri)) {
d (printf("%s:%d (list_changed_cb) - Adding Calendar %s\n", __FILE__, __LINE__, uri));
alarm_notify_add_calendar (an, source_type, source, FALSE);
}
@@ -163,37 +142,30 @@ list_changed_cb (ESourceList *source_list, gpointer data)
/* process the removals */
prd.an = an;
- prd.source_list = priv->source_lists[source_type];
+ prd.source_list = an->priv->source_lists[source_type];
prd.removals = NULL;
- g_hash_table_foreach (priv->uri_client_hash[source_type], (GHFunc) process_removal_in_hash, &prd);
+ g_hash_table_foreach (an->priv->uri_client_hash[source_type], (GHFunc) process_removal_in_hash, &prd);
for (l = prd.removals; l; l = l->next) {
d (printf("%s:%d (list_changed_cb) - Removing Calendar %s\n", __FILE__, __LINE__, (gchar *)l->data));
alarm_notify_remove_calendar (an, source_type, l->data);
}
g_list_free (prd.removals);
- g_signal_handlers_unblock_by_func(source_list, list_changed_cb, data);
-
-}
+ g_signal_handlers_unblock_by_func (
+ source_list, alarm_notify_list_changed_cb, an);
-ESourceList *
-alarm_notify_get_selected_calendars (AlarmNotify *an)
-{
- return an->priv->selected_calendars;
}
static void
-load_calendars (AlarmNotify *an, ECalSourceType source_type)
+alarm_notify_load_calendars (AlarmNotify *an,
+ ECalSourceType source_type)
{
- AlarmNotifyPrivate *priv;
ESourceList *source_list;
GSList *groups, *sources, *p, *q;
- priv = an->priv;
-
if (!e_cal_get_sources (&source_list, source_type, NULL)) {
d (printf("%s:%d (load_calendars) - Cannont get sources\n ", __FILE__, __LINE__));
- priv->source_lists[source_type] = NULL;
+ an->priv->source_lists[source_type] = NULL;
return;
}
@@ -220,89 +192,119 @@ load_calendars (AlarmNotify *an, ECalSourceType source_type)
}
}
- g_signal_connect_object (source_list, "changed", G_CALLBACK (list_changed_cb), an, 0);
- priv->source_lists[source_type] = source_list;
+ g_signal_connect_object (
+ source_list, "changed",
+ G_CALLBACK (alarm_notify_list_changed_cb), an, 0);
+ an->priv->source_lists[source_type] = source_list;
}
-/* Object initialization function for the alarm notify system */
static void
-alarm_notify_init (AlarmNotify *an, AlarmNotifyClass *klass)
+alarm_notify_dequeue_client (gpointer key,
+ ECal *client)
+{
+ alarm_queue_remove_client (client, TRUE);
+}
+
+static void
+alarm_notify_finalize (GObject *object)
{
AlarmNotifyPrivate *priv;
- gint i;
+ gint ii;
- priv = g_new0 (AlarmNotifyPrivate, 1);
- an->priv = priv;
- priv->mutex = g_mutex_new ();
- priv->selected_calendars = config_data_get_calendars ("/apps/evolution/calendar/sources");
+ priv = ALARM_NOTIFY_GET_PRIVATE (object);
- d (printf("%s:%d (alarm_notify_init) - Initing Alarm Notify\n", __FILE__, __LINE__));
+ for (ii = 0; ii < E_CAL_SOURCE_TYPE_LAST; ii++) {
+ g_hash_table_foreach (
+ priv->uri_client_hash[ii],
+ (GHFunc) alarm_notify_dequeue_client, NULL);
+ g_hash_table_destroy (priv->uri_client_hash[ii]);
+ }
- for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++)
- priv->uri_client_hash[i] = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+ alarm_queue_done ();
- alarm_queue_init (an);
+ g_mutex_free (priv->mutex);
- for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++)
- load_calendars (an, i);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
-dequeue_client (gpointer key, gpointer value, gpointer user_data)
+alarm_notify_class_init (AlarmNotifyClass *class)
{
- ECal *client = value;
+ GObjectClass *object_class;
- d (printf("%s:%d (dequeue_client) - Removing client %p\n ", __FILE__, __LINE__, client));
- alarm_queue_remove_client (client, TRUE);
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (AlarmNotifyPrivate));
+
+ object_class = (GObjectClass *) class;
+ object_class->finalize = alarm_notify_finalize;
}
-/* Finalize handler for the alarm notify system */
static void
-alarm_notify_finalize (GObject *object)
+alarm_notify_init (AlarmNotify *an)
{
- AlarmNotify *an;
- AlarmNotifyPrivate *priv;
- gint i;
+ gint ii;
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_ALARM_NOTIFY (object));
+ an->priv = ALARM_NOTIFY_GET_PRIVATE (an);
+ an->priv->mutex = g_mutex_new ();
+ an->priv->selected_calendars = config_data_get_calendars (
+ "/apps/evolution/calendar/sources");
- d (printf("%s:%d (alarm_notify_finalize) - Finalize \n ", __FILE__, __LINE__));
+ for (ii = 0; ii < E_CAL_SOURCE_TYPE_LAST; ii++)
+ an->priv->uri_client_hash[ii] = g_hash_table_new_full (
+ g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) g_object_unref);
- an = ALARM_NOTIFY (object);
- priv = an->priv;
+ alarm_queue_init (an);
- for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++) {
- g_hash_table_foreach (priv->uri_client_hash[i], dequeue_client, NULL);
- g_hash_table_destroy (priv->uri_client_hash[i]);
- }
+ for (ii = 0; ii < E_CAL_SOURCE_TYPE_LAST; ii++)
+ alarm_notify_load_calendars (an, ii);
+}
- alarm_queue_done ();
+ESourceList *
+alarm_notify_get_selected_calendars (AlarmNotify *an)
+{
+ return an->priv->selected_calendars;
+}
- g_mutex_free (priv->mutex);
- g_free (priv);
+GType
+alarm_notify_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo type_info = {
+ sizeof (AlarmNotifyClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) alarm_notify_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (AlarmNotify),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) alarm_notify_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ G_TYPE_OBJECT, "AlarmNotify", &type_info, 0);
+ }
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ return type;
}
-
-
/**
* alarm_notify_new:
*
* Creates a new #AlarmNotify object.
*
- * Return value: A newly-created #AlarmNotify, or NULL if its corresponding
- * CORBA object could not be created.
+ * Returns: a newly-created #AlarmNotify
**/
AlarmNotify *
alarm_notify_new (void)
{
- return g_object_new (TYPE_ALARM_NOTIFY,
- "poa", bonobo_poa_get_threaded (
- ORBIT_THREAD_HINT_PER_REQUEST, NULL),
- NULL);
+ return g_object_new (TYPE_ALARM_NOTIFY, NULL);
}
static void
diff --git a/calendar/gui/alarm-notify/alarm-notify.h b/calendar/gui/alarm-notify/alarm-notify.h
index a6ef3a173e..00936c41ed 100644
--- a/calendar/gui/alarm-notify/alarm-notify.h
+++ b/calendar/gui/alarm-notify/alarm-notify.h
@@ -26,44 +26,54 @@
#ifndef ALARM_NOTIFY_H
#define ALARM_NOTIFY_H
-#include <bonobo/bonobo-object.h>
#include <libedataserver/e-msgport.h>
-#include "evolution-calendar.h"
-
-#define TYPE_ALARM_NOTIFY (alarm_notify_get_type ())
-#define ALARM_NOTIFY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ALARM_NOTIFY, AlarmNotify))
-#define ALARM_NOTIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ALARM_NOTIFY, \
- AlarmNotifyClass))
-#define IS_ALARM_NOTIFY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ALARM_NOTIFY))
-#define IS_ALARM_NOTIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ALARM_NOTIFY))
+/* Standard GObject macros */
+#define TYPE_ALARM_NOTIFY \
+ (alarm_notify_get_type ())
+#define ALARM_NOTIFY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), TYPE_ALARM_NOTIFY, AlarmNotify))
+#define ALARM_NOTIFY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), TYPE_ALARM_NOTIFY, AlarmNotifyClass))
+#define IS_ALARM_NOTIFY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), TYPE_ALARM_NOTIFY))
+#define IS_ALARM_NOTIFY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), TYPE_ALARM_NOTIFY))
+#define ALARM_NOTIFY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), TYPE_ALARM_NOTIFY, AlarmNotifyClass))
+
+G_BEGIN_DECLS
typedef struct _AlarmNotify AlarmNotify;
typedef struct _AlarmNotifyClass AlarmNotifyClass;
-
typedef struct _AlarmNotifyPrivate AlarmNotifyPrivate;
struct _AlarmNotify {
- BonoboObject object;
-
- /* Private data */
+ GObject parent;
AlarmNotifyPrivate *priv;
};
struct _AlarmNotifyClass {
- BonoboObjectClass parent_class;
- POA_GNOME_Evolution_Calendar_AlarmNotify__epv epv;
+ GObjectClass parent_class;
};
-GType alarm_notify_get_type (void);
-
-AlarmNotify *alarm_notify_new (void);
-
-void alarm_notify_add_calendar (AlarmNotify *an, ECalSourceType source_type, ESource *source, gboolean load_afterwards);
-void alarm_notify_remove_calendar (AlarmNotify *an, ECalSourceType source_type, const gchar *str_uri);
-
-ESourceList *alarm_notify_get_selected_calendars (AlarmNotify *);
+GType alarm_notify_get_type (void);
+AlarmNotify * alarm_notify_new (void);
+void alarm_notify_add_calendar (AlarmNotify *an,
+ ECalSourceType source_type,
+ ESource *source,
+ gboolean load_afterwards);
+void alarm_notify_remove_calendar (AlarmNotify *an,
+ ECalSourceType source_type,
+ const gchar *str_uri);
+ESourceList * alarm_notify_get_selected_calendars
+ (AlarmNotify *an);
-
+G_END_DECLS
-#endif
+#endif /* ALARM_NOTIFY_H */
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index a8d99590a1..7793e62d80 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -43,7 +43,6 @@
#include <libnotify/notify.h>
#endif
-#include "evolution-calendar.h"
#include "alarm.h"
#include "alarm-notify-dialog.h"
#include "alarm-queue.h"
diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c
index b3ff0db6a5..18e0a5eadf 100644
--- a/calendar/gui/alarm-notify/notify-main.c
+++ b/calendar/gui/alarm-notify/notify-main.c
@@ -30,144 +30,62 @@
#include <string.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <libgnome/gnome-init.h>
-#include <libgnomeui/gnome-client.h>
-#include <libgnomeui/gnome-ui-init.h>
#include <glade/glade.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo-activation/bonobo-activation.h>
+#include <unique/unique.h>
+#include <camel/camel-object.h>
#include <libedataserver/e-source.h>
#include <libedataserverui/e-passwords.h>
+
#include "e-util/e-icon-factory.h"
#include "e-util/e-util-private.h"
#include "alarm.h"
#include "alarm-queue.h"
#include "alarm-notify.h"
#include "config-data.h"
-#include <camel/camel-object.h>
-
-static BonoboGenericFactory *factory;
-
-static AlarmNotify *alarm_notify_service = NULL;
-
-/* Callback for the master client's "die" signal. We must terminate the daemon
- * since the session is ending.
- */
-static void
-client_die_cb (GnomeClient *client)
-{
- bonobo_main_quit ();
-}
-
-static gint
-save_session_cb (GnomeClient *client, GnomeSaveStyle save_style, gint shutdown,
- GnomeInteractStyle interact_style, gint fast, gpointer user_data)
-{
- gchar *args[2];
-
- args[0] = g_build_filename (EVOLUTION_LIBEXECDIR,
- "evolution-alarm-notify"
-#ifdef G_OS_WIN32
- ".exe"
-#endif
- ,
- NULL);
- args[1] = NULL;
- gnome_client_set_restart_command (client, 1, args);
- g_free (args[0]);
-
- return TRUE;
-}
-
-/* Sees if a session manager is present. If so, it tells the SM how to restart
- * the daemon when the session starts. It also sets the die callback so that
- * the daemon can terminate properly when the session ends.
- */
-static void
-init_session (void)
-{
- GnomeClient *master_client;
-
- master_client = gnome_master_client ();
-
- g_signal_connect (G_OBJECT (master_client), "die",
- G_CALLBACK (client_die_cb), NULL);
- g_signal_connect (G_OBJECT (master_client), "save_yourself",
- G_CALLBACK (save_session_cb), NULL);
-
- /* The daemon should always be started up by the session manager when
- * the session starts. The daemon will take care of loading whatever
- * calendars it was told to load.
- */
- gnome_client_set_restart_style (master_client, GNOME_RESTART_IF_RUNNING);
-}
-
-/* Factory function for the alarm notify service; just creates and references a
- * singleton service object.
- */
-static BonoboObject *
-alarm_notify_factory_fn (BonoboGenericFactory *factory, const gchar *component_id, gpointer data)
-{
- g_return_val_if_fail (alarm_notify_service != NULL, NULL);
-
- bonobo_object_ref (BONOBO_OBJECT (alarm_notify_service));
- return BONOBO_OBJECT (alarm_notify_service);
-}
-
-/* Creates the alarm notifier */
-static gboolean
-init_alarm_service (gpointer user_data)
-{
- alarm_notify_service = alarm_notify_new ();
- g_return_val_if_fail (alarm_notify_service != NULL, FALSE);
- return FALSE;
-}
gint
main (gint argc, gchar **argv)
{
+ AlarmNotify *alarm_notify_service;
+ UniqueApp *app;
+
bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
- gnome_program_init ("evolution-alarm-notify", VERSION, LIBGNOMEUI_MODULE, argc, argv, NULL);
+ g_thread_init (NULL);
+
+ gtk_init (&argc, &argv);
+
+ app = unique_app_new ("org.gnome.EvolutionAlarmNotify", NULL);
- if (bonobo_init_full (&argc, argv, bonobo_activation_orb_get (),
- CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE)
- g_error (_("Could not initialize Bonobo"));
+ if (unique_app_is_running (app))
+ goto exit;
glade_init ();
e_icon_factory_init ();
- init_alarm_service (NULL);
-
- factory = bonobo_generic_factory_new ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify_Factory:" BASE_VERSION,
- (BonoboFactoryCallback) alarm_notify_factory_fn, NULL);
- if (!factory) {
- g_warning (_("Could not create the alarm notify service factory, maybe it's already running..."));
- return 1;
- }
+ alarm_notify_service = alarm_notify_new ();
- init_session ();
+ /* FIXME Ideally we should not use camel libraries in calendar,
+ * though it is the case currently for attachments. Remove
+ * this once that is fixed. */
- /* FIXME Ideally we should not use camel libraries in calendar, though it is the case
- currently for attachments. Remove this once that is fixed.
- Initialise global camel_object_type */
+ /* Initialize Camel's type system. */
camel_object_get_type();
- bonobo_main ();
+ gtk_main ();
- bonobo_object_unref (BONOBO_OBJECT (factory));
- factory = NULL;
-
- if (alarm_notify_service)
- bonobo_object_unref (BONOBO_OBJECT (alarm_notify_service));
+ if (alarm_notify_service != NULL)
+ g_object_unref (alarm_notify_service);
alarm_done ();
e_passwords_shutdown ();
+exit:
+ g_object_unref (app);
+
return 0;
}
diff --git a/configure.ac b/configure.ac
index 2358f6438b..2853155513 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1993,6 +1993,7 @@ calendar/conduits/todo/Makefile
calendar/conduits/calendar/Makefile
calendar/conduits/memo/Makefile
calendar/gui/Makefile
+calendar/gui/alarm-notify/Makefile
calendar/gui/dialogs/Makefile
composer/Makefile
m4/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index 6fbfd499c9..8bbcdedda7 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -4,6 +4,11 @@ desktop_file = $(desktop_in_in_file:.desktop.in.in=.desktop)
%.desktop.in: %.desktop.in.in
sed -e "s|\@BASE_VERSION\@|$(BASE_VERSION)|" -e "s|\@DATASERVER_EXEC_VERSION\@|$(DATASERVER_EXEC_VERSION)|" $< > $@
+autostartdir = $(sysconfdir)/xdg/autostart
+autostart_in_in_files = evolution-alarm-notify.desktop.in.in
+autostart_in_files = evolution-alarm-notify.desktop.in
+autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
+
@INTLTOOL_DESKTOP_RULE@
keysdir = $(datadir)/mime-info
@@ -57,10 +62,12 @@ uninstall-local: uninstall-kde-applnk
rm -rf $(DESTDIR)$(mimedir)/$(mime_file) ;
CLEANFILES = \
+ $(autostart_DATA) \
$(desktop_file) \
$(keys_file)
EXTRA_DIST = \
+ $(autostart_in_in_files) \
$(desktop_in_in_file) \
$(mime_file) \
$(keys_in_file) \
diff --git a/data/evolution-alarm-notify.desktop.in.in b/data/evolution-alarm-notify.desktop.in.in
new file mode 100644
index 0000000000..23b40644fa
--- /dev/null
+++ b/data/evolution-alarm-notify.desktop.in.in
@@ -0,0 +1,14 @@
+[Desktop Entry]
+Type=Application
+_Name=Evolution Alarm Notify
+_Comment=Calendar event notifications
+Icon=appointment-soon
+Exec=evolution-alarm-notify
+Terminal=false
+Type=Application
+Categories=
+OnlyShowIn=GNOME;XFCE;
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=evolution
+X-GNOME-Bugzilla-Component=calendar
+X-GNOME-Bugzilla-Version=@VERSION@
diff --git a/shell/main.c b/shell/main.c
index 9f3070dcaa..a74e28ace5 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -429,7 +429,7 @@ create_default_shell (void)
shell = g_object_new (
E_TYPE_SHELL,
- "name", "org.gnome.evolution",
+ "name", "org.gnome.Evolution",
"online", online,
NULL);