Get the publish-calendar plugin working.

This commit is contained in:
Milan Crha
2009-09-01 19:51:55 -04:00
committed by Matthew Barnes
parent 8f0093b0d8
commit 136adee476
6 changed files with 68 additions and 53 deletions

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -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>

View File

@ -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;
}

View File

@ -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