aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-09-02 07:51:55 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-09-02 07:51:55 +0800
commit136adee47614d99ed26a294865cfd0d1ffb2cf7f (patch)
tree547e3578eeaaf78c0e8460fa775c0a9f83a876b2 /plugins
parent8f0093b0d8c8b45390353243515b7dfb8eeabf93 (diff)
downloadgsoc2013-evolution-136adee47614d99ed26a294865cfd0d1ffb2cf7f.tar
gsoc2013-evolution-136adee47614d99ed26a294865cfd0d1ffb2cf7f.tar.gz
gsoc2013-evolution-136adee47614d99ed26a294865cfd0d1ffb2cf7f.tar.bz2
gsoc2013-evolution-136adee47614d99ed26a294865cfd0d1ffb2cf7f.tar.lz
gsoc2013-evolution-136adee47614d99ed26a294865cfd0d1ffb2cf7f.tar.xz
gsoc2013-evolution-136adee47614d99ed26a294865cfd0d1ffb2cf7f.tar.zst
gsoc2013-evolution-136adee47614d99ed26a294865cfd0d1ffb2cf7f.zip
Get the publish-calendar plugin working.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/publish-calendar/Makefile.am4
-rw-r--r--plugins/publish-calendar/org-gnome-publish-calendar.eplug.xml26
-rw-r--r--plugins/publish-calendar/org-gnome-publish-calendar.xml13
-rw-r--r--plugins/publish-calendar/publish-calendar.c74
4 files changed, 67 insertions, 50 deletions
diff --git a/plugins/publish-calendar/Makefile.am b/plugins/publish-calendar/Makefile.am
index 274c14f290..bd6537df82 100644
--- a/plugins/publish-calendar/Makefile.am
+++ b/plugins/publish-calendar/Makefile.am
@@ -9,8 +9,7 @@ AM_CPPFLAGS = \
@EVO_PLUGIN_RULE@
plugin_DATA = \
- org-gnome-publish-calendar.eplug \
- org-gnome-publish-calendar.xml
+ org-gnome-publish-calendar.eplug
glade_DATA = \
publish-calendar.glade
@@ -37,7 +36,6 @@ liborg_gnome_publish_calendar_la_LIBADD = \
EXTRA_DIST = \
org-gnome-publish-calendar.eplug.xml \
- org-gnome-publish-calendar.xml \
$(glade_DATA)
CLEANFILES = org-gnome-publish-calendar.eplug
diff --git a/plugins/publish-calendar/org-gnome-publish-calendar.eplug.xml b/plugins/publish-calendar/org-gnome-publish-calendar.eplug.xml
index 4923aa1c28..dcb26e23f7 100644
--- a/plugins/publish-calendar/org-gnome-publish-calendar.eplug.xml
+++ b/plugins/publish-calendar/org-gnome-publish-calendar.eplug.xml
@@ -8,16 +8,17 @@
<_description>Publish calendars to the web.</_description>
<author name="David Trowbridge" email="trowbrds@cs.colorado.edu"/>
<!-- calendar main menu -->
- <hook class="org.gnome.evolution.calendar.bonobomenu:1.0">
- <menu id="org.gnome.evolution.calendar.view" target="select">
- <ui file="@PLUGINDIR@/org-gnome-publish-calendar.xml" />
- <item
- type="item"
- verb="EPublishCalendarPublish"
- path="/commands/EPublishCalendarPublish"
- activate="action_publish" />
- </menu>
- </hook>
+ <hook class="org.gnome.evolution.ui:1.0">
+ <ui-manager id="org.gnome.evolution.calendars">
+ <menubar name='main-menu'>
+ <placeholder name='custom-menus'>
+ <menu action="calendar-actions-menu">
+ <menuitem action="calendar-publish"/>
+ </menu>
+ </placeholder>
+ </menubar>
+ </ui-manager>
+ </hook>
<!-- config page -->
<hook class="org.gnome.evolution.calendar.config:1.0">
@@ -38,10 +39,5 @@
factory="publish_calendar_locations"/>
</group>
</hook>
-
- <!-- shell hooks -->
- <hook class="org.gnome.evolution.shell.events:1.0">
- <event id="state.changed" handle="online_state_changed" target="state" />
- </hook>
</e-plugin>
</e-plugin-list>
diff --git a/plugins/publish-calendar/org-gnome-publish-calendar.xml b/plugins/publish-calendar/org-gnome-publish-calendar.xml
deleted file mode 100644
index 6eaa4256b7..0000000000
--- a/plugins/publish-calendar/org-gnome-publish-calendar.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<Root>
- <commands>
- <cmd name="EPublishCalendarPublish"/>
- </commands>
-
- <menu>
- <placeholder name="ActionsPlaceholder">
- <submenu name="Actions">
- <menuitem verb="EPublishCalendarPublish" _label="_Publish Calendar Information" />
- </submenu>
- </placeholder>
- </menu>
-</Root>
diff --git a/plugins/publish-calendar/publish-calendar.c b/plugins/publish-calendar/publish-calendar.c
index e63f4bca4c..b8bb453158 100644
--- a/plugins/publish-calendar/publish-calendar.c
+++ b/plugins/publish-calendar/publish-calendar.c
@@ -28,12 +28,14 @@
#include <gio/gio.h>
#include <libedataserver/e-url.h>
#include <libedataserverui/e-passwords.h>
-#include <calendar/gui/e-cal-popup.h>
#include <calendar/gui/e-cal-config.h>
-#include <calendar/gui/e-cal-menu.h>
#include <shell/es-event.h>
#include <e-util/e-util-private.h>
#include <e-util/e-dialog-utils.h>
+
+#include <shell/e-shell.h>
+#include <shell/e-shell-view.h>
+
#include "url-editor-dialog.h"
#include "publish-format-fb.h"
#include "publish-format-ical.h"
@@ -50,9 +52,6 @@ static guint error_queue_show_idle_id = 0;
static void error_queue_add (gchar *descriptions, GError *error);
gint e_plugin_lib_enable (EPlugin *ep, gint enable);
-void action_publish (EPlugin *ep, ECalMenuTargetSelect *t);
-void online_state_changed (EPlugin *ep, ESEventTargetState *target);
-void publish_calendar_context_activate (EPlugin *ep, ECalPopupTargetSource *target);
GtkWidget *publish_calendar_locations (EPlugin *epl, EConfigHookItemFactoryData *data);
static void update_timestamp (EPublishUri *uri);
static void publish (EPublishUri *uri, gboolean can_report_success);
@@ -677,10 +676,10 @@ url_enable_clicked (GtkButton *button, PublishUIData *ui)
}
}
-void
-online_state_changed (EPlugin *ep, ESEventTargetState *target)
+static void
+online_state_changed (EShell *shell)
{
- online = target->state;
+ online = e_shell_get_online (shell);
if (online)
while (queued_publishes)
publish (queued_publishes->data, FALSE);
@@ -777,17 +776,6 @@ publish_urls (gpointer data)
return GINT_TO_POINTER (0);
}
-void
-action_publish (EPlugin *ep, ECalMenuTargetSelect *t)
-{
- GThread *thread = NULL;
- GError *error = NULL;
-
- thread = g_thread_create ((GThreadFunc) publish_urls, NULL, FALSE, &error);
- if (!thread)
- error_queue_add (g_strdup (_("Could not create publish thread.")), error);
-}
-
static gpointer
publish_uris_set_timeout (GSList *uris)
{
@@ -825,6 +813,13 @@ e_plugin_lib_enable (EPlugin *ep, gint enable)
{
GSList *uris;
GConfClient *client;
+ EShell *shell = e_shell_get_default ();
+
+ if (shell) {
+ g_signal_handlers_disconnect_by_func (shell, G_CALLBACK (online_state_changed), NULL);
+ if (enable)
+ g_signal_connect (shell, "notify::online", G_CALLBACK (online_state_changed), NULL);
+ }
if (enable) {
GThread *thread = NULL;
@@ -929,3 +924,44 @@ error_queue_add (gchar *description, GError *error)
error_queue_show_idle_id = g_idle_add (error_queue_show_idle, NULL);
g_static_mutex_unlock (&error_queue_lock);
}
+
+static void
+action_calendar_publish_cb (GtkAction *action,
+ EShellView *shell_view)
+{
+ GThread *thread = NULL;
+ GError *error = NULL;
+
+ thread = g_thread_create ((GThreadFunc) publish_urls, NULL, FALSE, &error);
+ if (!thread)
+ error_queue_add (g_strdup (_("Could not create publish thread.")), error);
+}
+
+static GtkActionEntry entries[] = {
+
+ { "calendar-publish",
+ NULL,
+ N_("_Publish Calendar Information"),
+ NULL,
+ NULL, /* XXX Add a tooltip! */
+ G_CALLBACK (action_calendar_publish_cb) }
+};
+
+gboolean e_plugin_ui_init (GtkUIManager *ui_manager, EShellView *shell_view);
+
+gboolean
+e_plugin_ui_init (GtkUIManager *ui_manager,
+ EShellView *shell_view)
+{
+ EShellWindow *shell_window;
+ GtkActionGroup *action_group;
+
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ action_group = e_shell_window_get_action_group (shell_window, "calendar");
+
+ gtk_action_group_add_actions (
+ action_group, entries,
+ G_N_ELEMENTS (entries), shell_view);
+
+ return TRUE;
+}