diff options
author | Milan Crha <mcrha@redhat.com> | 2009-09-02 07:51:55 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-09-02 07:51:55 +0800 |
commit | 136adee47614d99ed26a294865cfd0d1ffb2cf7f (patch) | |
tree | 547e3578eeaaf78c0e8460fa775c0a9f83a876b2 | |
parent | 8f0093b0d8c8b45390353243515b7dfb8eeabf93 (diff) | |
download | gsoc2013-evolution-136adee47614d99ed26a294865cfd0d1ffb2cf7f.tar.gz gsoc2013-evolution-136adee47614d99ed26a294865cfd0d1ffb2cf7f.tar.zst gsoc2013-evolution-136adee47614d99ed26a294865cfd0d1ffb2cf7f.zip |
Get the publish-calendar plugin working.
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | plugins/publish-calendar/Makefile.am | 4 | ||||
-rw-r--r-- | plugins/publish-calendar/org-gnome-publish-calendar.eplug.xml | 26 | ||||
-rw-r--r-- | plugins/publish-calendar/org-gnome-publish-calendar.xml | 13 | ||||
-rw-r--r-- | plugins/publish-calendar/publish-calendar.c | 74 | ||||
-rw-r--r-- | po/POTFILES.in | 1 |
6 files changed, 68 insertions, 53 deletions
diff --git a/configure.ac b/configure.ac index 8f771064ef..a74bc518c8 100644 --- a/configure.ac +++ b/configure.ac @@ -1807,7 +1807,7 @@ plugins_experimental="$plugins_experimental_always $IPOD_SYNC $TNEF_ATTACHMENTS" all_plugins_experimental="$plugins_experimental_always ipod-sync tnef-attachments" dnl Temporary KILL-BONOBO hack -enable_plugins="attachment-reminder addressbook-file audio-inline backup-restore bbdb bogo-junk-plugin caldav calendar-file calendar-http calendar-weather default-mailer default-source email-custom-header external-editor face google-account-setup hula-account-setup imap-features itip-formatter mail-notification mail-to-task mark-all-read plugin-manager prefer-plain profiler pst-import sa-junk-plugin startup-wizard subject-thread templates $TNEF_ATTACHMENTS vcard-inline webdav-account-setup" +enable_plugins="attachment-reminder addressbook-file audio-inline backup-restore bbdb bogo-junk-plugin caldav calendar-file calendar-http calendar-weather default-mailer default-source email-custom-header external-editor face google-account-setup hula-account-setup imap-features itip-formatter mail-notification mail-to-task mark-all-read plugin-manager prefer-plain profiler pst-import sa-junk-plugin startup-wizard subject-thread templates $TNEF_ATTACHMENTS vcard-inline webdav-account-setup publish-calendar" dnl PLUGINS NOT BUILDING YET dnl ------------------------ @@ -1815,7 +1815,6 @@ dnl exchange-operations dnl groupwise-features dnl ipod-sync dnl mailing-list-actions -dnl publish-calendar dnl save-calendar case x"$enable_plugins" in 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; +} diff --git a/po/POTFILES.in b/po/POTFILES.in index 4c4409abb2..5d6310101e 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -400,7 +400,6 @@ plugins/profiler/org-gnome-evolution-profiler.eplug.xml plugins/pst-import/org-gnome-pst-import.eplug.xml plugins/pst-import/pst-importer.c plugins/publish-calendar/org-gnome-publish-calendar.eplug.xml -plugins/publish-calendar/org-gnome-publish-calendar.xml plugins/publish-calendar/publish-calendar.c plugins/publish-calendar/publish-calendar.glade plugins/publish-calendar/publish-format-fb.c |