diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-05-06 01:21:42 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-05-06 01:21:42 +0800 |
commit | 16d914886110d57eaf8946000c365de2007728b3 (patch) | |
tree | dc91c2e17d9febfc121cfdc3b375cc75162f1877 /plugins | |
parent | c3e0648d8b5a1d73f82f0a7691b9ab1320248392 (diff) | |
parent | a30e0738880809f8e3a6d05a66f82081d91c21a0 (diff) | |
download | gsoc2013-evolution-16d914886110d57eaf8946000c365de2007728b3.tar.gz gsoc2013-evolution-16d914886110d57eaf8946000c365de2007728b3.tar.zst gsoc2013-evolution-16d914886110d57eaf8946000c365de2007728b3.zip |
Merge branch 'master' into kill-bonobo
Conflicts:
calendar/gui/dialogs/comp-editor.c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/backup-restore/Makefile.am | 3 | ||||
-rw-r--r-- | plugins/backup-restore/backup.c | 284 | ||||
-rw-r--r-- | plugins/bbdb/bbdb.c | 86 | ||||
-rw-r--r-- | plugins/bbdb/org-gnome-evolution-bbdb.eplug.xml | 11 | ||||
-rw-r--r-- | plugins/exchange-operations/exchange-contacts.c | 11 | ||||
-rw-r--r-- | plugins/external-editor/Makefile.am | 1 | ||||
-rw-r--r-- | plugins/external-editor/org-gnome-external-editor.eplug.xml | 4 | ||||
-rw-r--r-- | plugins/mailing-list-actions/Makefile.am | 1 | ||||
-rw-r--r-- | plugins/publish-calendar/publish-calendar.glade | 102 | ||||
-rw-r--r-- | plugins/publish-calendar/publish-format-fb.c | 18 | ||||
-rw-r--r-- | plugins/publish-calendar/publish-location.c | 34 | ||||
-rw-r--r-- | plugins/publish-calendar/publish-location.h | 8 | ||||
-rw-r--r-- | plugins/publish-calendar/url-editor-dialog.c | 21 | ||||
-rw-r--r-- | plugins/publish-calendar/url-editor-dialog.h | 5 | ||||
-rw-r--r-- | plugins/templates/Makefile.am | 1 |
15 files changed, 342 insertions, 248 deletions
diff --git a/plugins/backup-restore/Makefile.am b/plugins/backup-restore/Makefile.am index ceb6fdb41c..b4e554cf47 100644 --- a/plugins/backup-restore/Makefile.am +++ b/plugins/backup-restore/Makefile.am @@ -21,14 +21,11 @@ plugin_LTLIBRARIES = liborg-gnome-backup-restore.la liborg_gnome_backup_restore_la_SOURCES = backup-restore.c liborg_gnome_backup_restore_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) liborg_gnome_backup_restore_la_LIBADD = \ - $(EVOLUTION_MAIL_LIBS) \ $(top_builddir)/e-util/libeutil.la privlibexec_PROGRAMS = evolution-backup evolution_backup_SOURCES = backup.c evolution_backup_LDADD = $(SHELL_LIBS) \ - $(EVOLUTION_CALENDAR_LIBS) \ - $(EVOLUTION_ADDRESSBOOK_LIBS) \ $(top_builddir)/e-util/libeutil.la diff --git a/plugins/backup-restore/backup.c b/plugins/backup-restore/backup.c index 99d7f8d41f..7d3c208a28 100644 --- a/plugins/backup-restore/backup.c +++ b/plugins/backup-restore/backup.c @@ -30,12 +30,10 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <libebook/e-book.h> -#include <libecal/e-cal.h> -#include <libedataserver/e-account.h> -#include <libedataserver/e-account-list.h> #include "e-util/e-util.h" +#define EVOUSERDATADIR_MAGIC "#EVO_USERDATADIR#" + #define EVOLUTION "evolution" #define EVOLUTION_DIR "$HOME/.evolution/" #define EVOLUTION_DIR_BACKUP "$HOME/.evolution-old/" @@ -59,7 +57,7 @@ static GtkWidget *pbar; static char *txt = NULL; gboolean complete = FALSE; -static const GOptionEntry options[] = { +static GOptionEntry options[] = { { "backup", '\0', 0, G_OPTION_ARG_NONE, &backup_op, N_("Backup Evolution directory"), NULL }, { "restore", '\0', 0, G_OPTION_ARG_NONE, &restore_op, @@ -77,37 +75,103 @@ static const GOptionEntry options[] = { #define d(x) -#define rc(x) G_STMT_START { g_message (x); system (x); } G_STMT_END +#define print_and_run(x) G_STMT_START { g_message ("%s", x); system (x); } G_STMT_END #define CANCEL(x) if (x) return; +static GString * +replace_string (const char *text, const char *find, const char *replace) +{ + const char *p, *next; + GString *str; + int find_len; + + g_return_val_if_fail (text != NULL, NULL); + g_return_val_if_fail (find != NULL, NULL); + g_return_val_if_fail (*find, NULL); + + find_len = strlen (find); + str = g_string_new (""); + + p = text; + while (next = strstr (p, find), next) { + if (p + 1 < next) + g_string_append_len (str, p, next - p); + + if (replace && *replace) + g_string_append (str, replace); + + p = next + find_len; + } + + g_string_append (str, p); + + return str; +} + static void -s (const char *cmd) +replace_in_file (const char *filename, const char *find, const char *replace) +{ + char *content = NULL; + GError *error = NULL; + GString *filenamestr = NULL; + + g_return_if_fail (filename != NULL); + g_return_if_fail (find != NULL); + g_return_if_fail (*find); + g_return_if_fail (replace != NULL); + + if (strstr (filename, "$HOME")) { + filenamestr = replace_string (filename, "$HOME", g_get_home_dir ()); + + if (!filenamestr) { + g_warning ("%s: Replace string on $HOME failed!", G_STRFUNC); + return; + } + + filename = filenamestr->str; + } + + if (g_file_get_contents (filename, &content, NULL, &error)) { + GString *str = replace_string (content, find, replace); + + if (str) { + if (!g_file_set_contents (filename, str->str, -1, &error) && error) { + g_warning ("%s: cannot write file content, error: %s", G_STRFUNC, error->message); + g_error_free (error); + } + + g_string_free (str, TRUE); + } else { + g_warning ("%s: Replace of '%s' to '%s' failed!", G_STRFUNC, find, replace); + } + + g_free (content); + } else if (error) { + g_warning ("%s: Cannot read file content, error: %s", G_STRFUNC, error->message); + g_error_free (error); + } + + if (filenamestr) + g_string_free (filenamestr, TRUE); +} + +static void +run_cmd (const char *cmd) { if (!cmd) return; if (strstr (cmd, "$HOME") != NULL) { /* read the doc for g_get_home_dir to know why replacing it here */ - const char *home = g_get_home_dir (); - const char *p, *next; - GString *str = g_string_new (""); - - p = cmd; - while (next = strstr (p, "$HOME"), next) { - if (p + 1 < next) - g_string_append_len (str, p, next - p); - g_string_append (str, home); + GString *str = replace_string (cmd, "$HOME", g_get_home_dir ()); - p = next + 5; + if (str) { + print_and_run (str->str); + g_string_free (str, TRUE); } - - g_string_append (str, p); - - rc (str->str); - g_string_free (str, TRUE); } else - rc (cmd); + print_and_run (cmd); } static void @@ -122,13 +186,15 @@ backup (const char *filename) CANCEL (complete); txt = _("Shutting down Evolution"); /* FIXME Will the versioned setting always work? */ - s (EVOLUTION " --force-shutdown"); + run_cmd (EVOLUTION " --force-shutdown"); - s ("rm $HOME/.evolution/.running"); + run_cmd ("rm $HOME/.evolution/.running"); CANCEL (complete); txt = _("Backing Evolution accounts and settings"); - s ("gconftool-2 --dump " GCONF_DIR " > " GCONF_DUMP_PATH); + run_cmd ("gconftool-2 --dump " GCONF_DIR " > " GCONF_DUMP_PATH); + + replace_in_file (GCONF_DUMP_PATH, e_get_user_data_dir (), EVOUSERDATADIR_MAGIC); CANCEL (complete); txt = _("Backing Evolution data (Mails, Contacts, Calendar, Tasks, Memos)"); @@ -138,7 +204,7 @@ backup (const char *filename) /* FIXME date/time stamp?" */ /* FIXME backup location?" */ command = g_strdup_printf ("cd $HOME && tar chf - .evolution .camel_certs | gzip > %s", quotedfname); - s (command); + run_cmd (command); g_free (command); g_free (quotedfname); @@ -150,103 +216,16 @@ backup (const char *filename) txt = _("Restarting Evolution"); complete=TRUE; - s (EVOLUTION); - } - -} - -static void -ensure_locals (ESourceList *source_list, const char *base_dir) -{ - GSList *groups, *sources; - - if (!source_list) - return; - - for (groups = e_source_list_peek_groups (source_list); groups; groups = groups->next) { - char *base_filename, *base_uri; - ESourceGroup *group = E_SOURCE_GROUP (groups->data); - - if (!group || !e_source_group_peek_base_uri (group) || !g_str_has_prefix (e_source_group_peek_base_uri (group), "file://")) - continue; - - base_filename = g_build_filename (base_dir, "local", NULL); - base_uri = g_filename_to_uri (base_filename, NULL, NULL); - - if (base_uri && !g_str_equal (base_uri, e_source_group_peek_base_uri (group))) { - /* groups base_uri differs from the new one, maybe users imports - to the account with different user name, thus fixing this */ - e_source_group_set_base_uri (group, base_uri); - } - - for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) { - ESource *source = E_SOURCE (sources->data); - - if (!source || !e_source_peek_absolute_uri (source)) - continue; - - if (!g_str_has_prefix (e_source_peek_absolute_uri (source), base_uri)) { - char *abs_uri = e_source_build_absolute_uri (source); - - e_source_set_absolute_uri (source, abs_uri); - g_free (abs_uri); - } - } - - g_free (base_filename); - g_free (base_uri); - } -} - -/* returns whether changed the item */ -static gboolean -fix_account_folder_uri (EAccount *account, e_account_item_t item, const char *base_dir) -{ - gboolean changed = FALSE; - const char *uri; - - /* the base_dir should always contain that part, so just a sanity check */ - if (!account || !base_dir || strstr (base_dir, "/.evolution/mail/local") == NULL) - return FALSE; - - uri = e_account_get_string (account, item); - if (uri && strstr (uri, "/.evolution/mail/local") != NULL) { - const char *path = strchr (uri, ':') + 1; - - if (!g_str_has_prefix (path, base_dir)) { - GString *new_uri = g_string_new (""); - - /* prefix, like "mbox:" */ - g_string_append_len (new_uri, uri, path - uri); - /* middle, changing old patch with new path */ - g_string_append_len (new_uri, base_dir, strstr (base_dir, "/.evolution/mail/local") - base_dir); - /* sufix, the rest beginning with "/.evolution/..." */ - g_string_append (new_uri, strstr (uri, "/.evolution/mail/local")); - - changed = TRUE; - e_account_set_string (account, item, new_uri->str); - g_string_free (new_uri, TRUE); - } + run_cmd (EVOLUTION); } - return changed; } static void restore (const char *filename) { - struct _calendars { ECalSourceType type; const char *dir; } - calendars[] = { - { E_CAL_SOURCE_TYPE_EVENT, "calendar"}, - { E_CAL_SOURCE_TYPE_TODO, "tasks"}, - { E_CAL_SOURCE_TYPE_JOURNAL, "memos"}, - { E_CAL_SOURCE_TYPE_LAST, NULL} }; - int i; char *command; char *quotedfname; - ESourceList *sources = NULL; - EAccountList *accounts; - GConfClient *gconf; g_return_if_fail (filename && *filename); quotedfname = g_shell_quote(filename); @@ -254,89 +233,42 @@ restore (const char *filename) /* FIXME Will the versioned setting always work? */ CANCEL (complete); txt = _("Shutting down Evolution"); - s (EVOLUTION " --force-shutdown"); + run_cmd (EVOLUTION " --force-shutdown"); CANCEL (complete); txt = _("Backup current Evolution data"); - s ("mv " EVOLUTION_DIR " " EVOLUTION_DIR_BACKUP); - s ("mv $HOME/.camel_certs ~/.camel_certs_old"); + run_cmd ("mv " EVOLUTION_DIR " " EVOLUTION_DIR_BACKUP); + run_cmd ("mv $HOME/.camel_certs ~/.camel_certs_old"); CANCEL (complete); txt = _("Extracting files from backup"); command = g_strdup_printf ("cd $HOME && gzip -cd %s| tar xf -", quotedfname); - s (command); + run_cmd (command); g_free (command); g_free (quotedfname); CANCEL (complete); txt = _("Loading Evolution settings"); - s ("gconftool-2 --load " GCONF_DUMP_PATH); + + replace_in_file (GCONF_DUMP_PATH, EVOUSERDATADIR_MAGIC, e_get_user_data_dir ()); + + run_cmd ("gconftool-2 --load " GCONF_DUMP_PATH); CANCEL (complete); txt = _("Removing temporary backup files"); - s ("rm -rf " GCONF_DUMP_PATH); - s ("rm -rf " EVOLUTION_DIR_BACKUP); - s ("rm -rf $HOME/.camel_certs_old"); - s ("rm $HOME/.evolution/.running"); + run_cmd ("rm -rf " GCONF_DUMP_PATH); + run_cmd ("rm -rf " EVOLUTION_DIR_BACKUP); + run_cmd ("rm -rf $HOME/.camel_certs_old"); + run_cmd ("rm $HOME/.evolution/.running"); CANCEL (complete); txt = _("Ensuring local sources"); - if (e_book_get_addressbooks (&sources, NULL)) { - char *base_dir = g_build_filename (e_get_user_data_dir (), "addressbook", NULL); - - ensure_locals (sources, base_dir); - g_object_unref (sources); - sources = NULL; - - g_free (base_dir); - } - - for (i = 0; calendars[i].dir; i++) { - if (e_cal_get_sources (&sources, calendars [i].type, NULL)) { - char *base_dir = g_build_filename (e_get_user_data_dir (), calendars [i].dir, NULL); - - ensure_locals (sources, base_dir); - g_object_unref (sources); - sources = NULL; - - g_free (base_dir); - } - } - - gconf = gconf_client_get_default (); - accounts = e_account_list_new (gconf); - - if (accounts) { - gboolean changed = FALSE; - char *base_dir = g_build_filename (e_get_user_data_dir (), "mail", "local", NULL); - EIterator *it; - - for (it = e_list_get_iterator (E_LIST (accounts)); e_iterator_is_valid (it); e_iterator_next (it)) { - /* why does this return a 'const' object?!? */ - EAccount *account = (EAccount *) e_iterator_get (it); - - if (account) { - changed = fix_account_folder_uri (account, E_ACCOUNT_DRAFTS_FOLDER_URI, base_dir) || changed; - changed = fix_account_folder_uri (account, E_ACCOUNT_SENT_FOLDER_URI, base_dir) || changed; - } - } - - if (changed) - e_account_list_save (accounts); - - g_object_unref (it); - g_object_unref (accounts); - g_free (base_dir); - } - - g_object_unref (gconf); - if (restart_arg) { CANCEL (complete); txt = _("Restarting Evolution"); complete=TRUE; - s (EVOLUTION); + run_cmd (EVOLUTION); } } @@ -422,7 +354,7 @@ dlg_response (GtkWidget *dlg, gint response, gpointer data) gtk_widget_destroy (dlg); /* We will kill just the tar operation. Rest of the them will be just a second of microseconds.*/ - s ("pkill tar"); + run_cmd ("pkill tar"); gtk_main_quit (); } diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c index adc89dbcb2..c642dd9130 100644 --- a/plugins/bbdb/bbdb.c +++ b/plugins/bbdb/bbdb.c @@ -35,6 +35,7 @@ #include <mail/em-config.h> #include <mail/em-event.h> #include <camel/camel-mime-message.h> +#include <composer/e-msg-composer.h> #include "bbdb.h" @@ -42,7 +43,7 @@ /* Plugin hooks */ int e_plugin_lib_enable (EPluginLib *ep, int enable); -void bbdb_handle_reply (EPlugin *ep, EMEventTargetMessage *target); +void bbdb_handle_send (EPlugin *ep, EMEventTargetComposer *target); GtkWidget *bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data); GtkWidget *bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data); @@ -227,47 +228,43 @@ bbdb_do_thread (const char *name, const char *email) G_UNLOCK (todo); } -/* Code to populate addressbook when you reply to a mail follows */ void -bbdb_handle_reply (EPlugin *ep, EMEventTargetMessage *target) +bbdb_handle_send (EPlugin *ep, EMEventTargetComposer *target) { - const CamelInternetAddress *cia; - int i; - - cia = camel_mime_message_get_from (target->message); - if (cia) { - for (i = 0; i < camel_address_length (CAMEL_ADDRESS (cia)); i ++) { - const char *name=NULL, *email=NULL; - if (!(camel_internet_address_get (cia, i, &name, &email))) - continue; - bbdb_do_thread (name, email); - } - } + GConfClient *gconf; + CamelMimeMessage *message = NULL; + const CamelInternetAddress *to, *cc; + gint i, len, enable; + gconf = gconf_client_get_default (); - /* If this is a reply-all event, process To: and Cc: also. */ - if (((EEventTarget *) target)->mask & EM_EVENT_MESSAGE_REPLY_ALL) { + enable = gconf_client_get_bool (gconf, GCONF_KEY_ENABLE, NULL); + g_object_unref (G_OBJECT (gconf)); + + if (!enable) return; - } - cia = camel_mime_message_get_recipients (target->message, CAMEL_RECIPIENT_TYPE_TO); - if (cia) { - for (i = 0; i < camel_address_length (CAMEL_ADDRESS (cia)); i ++) { - const char *name=NULL, *email=NULL; - if (!(camel_internet_address_get (cia, i, &name, &email))) - continue; - bbdb_do_thread (name, email); - } - } + message = e_msg_composer_get_message(target->composer, 1); - cia = camel_mime_message_get_recipients (target->message, CAMEL_RECIPIENT_TYPE_CC); - if (cia) { - for (i = 0; i < camel_address_length (CAMEL_ADDRESS (cia)); i ++) { - const char *name=NULL, *email=NULL; - if (!(camel_internet_address_get (cia, i, &name, &email))) - continue; - bbdb_do_thread (name, email); - } - } + to = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); + + len = CAMEL_ADDRESS (to)->addresses->len; + for (i = 0; i < len; i++) { + const gchar *name, *addr; + if (!(camel_internet_address_get (to, i, &name, &addr))) + continue; + bbdb_do_thread (name, addr); + } + + + cc = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); + + len = CAMEL_ADDRESS (cc)->addresses->len; + for (i = 0; i < len; i++) { + const gchar *name, *addr; + if (!(camel_internet_address_get (cc, i, &name, &addr))) + continue; + bbdb_do_thread (name, addr); + } } static void @@ -458,14 +455,18 @@ enable_toggled_cb (GtkWidget *widget, gpointer data) struct bbdb_stuff *stuff = (struct bbdb_stuff *) data; gboolean active; ESource *selected_source; + gchar *addressbook; active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); /* Save the new setting to gconf */ gconf_client_set_bool (stuff->target->gconf, GCONF_KEY_ENABLE, active, NULL); - gtk_widget_set_sensitive (stuff->option_menu, active); - if (active && !gconf_client_get_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK, NULL)) { + gtk_widget_set_sensitive (stuff->option_menu, active); + + addressbook = gconf_client_get_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK, NULL); + + if (active && !addressbook) { const gchar *uri = NULL; GError *error = NULL; @@ -484,6 +485,7 @@ enable_toggled_cb (GtkWidget *widget, gpointer data) g_error_free (error); } } + g_free (addressbook); } static void @@ -492,18 +494,22 @@ enable_gaim_toggled_cb (GtkWidget *widget, gpointer data) struct bbdb_stuff *stuff = (struct bbdb_stuff *) data; gboolean active; ESource *selected_source; + char *addressbook_gaim; active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); /* Save the new setting to gconf */ gconf_client_set_bool (stuff->target->gconf, GCONF_KEY_ENABLE_GAIM, active, NULL); + addressbook_gaim = gconf_client_get_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK_GAIM, NULL); gtk_widget_set_sensitive (stuff->gaim_option_menu, active); - if (active && !gconf_client_get_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK_GAIM, NULL)) { + if (active && !addressbook_gaim) { selected_source = e_source_combo_box_get_active ( E_SOURCE_COMBO_BOX (stuff->gaim_option_menu)); gconf_client_set_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK_GAIM, e_source_get_uri (selected_source), NULL); } + + g_free (addressbook_gaim); } static void @@ -636,7 +642,7 @@ bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data) gtk_box_pack_start (GTK_BOX (hbox), inner_vbox, FALSE, FALSE, 0); /* Enable BBDB checkbox */ - check = gtk_check_button_new_with_mnemonic (_("_Auto-create address book entries when replying to messages")); + check = gtk_check_button_new_with_mnemonic (_("Create _address book entries when sending mails")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), gconf_client_get_bool (target->gconf, GCONF_KEY_ENABLE, NULL)); g_signal_connect (GTK_TOGGLE_BUTTON (check), "toggled", G_CALLBACK (enable_toggled_cb), stuff); gtk_box_pack_start (GTK_BOX (inner_vbox), check, FALSE, FALSE, 0); diff --git a/plugins/bbdb/org-gnome-evolution-bbdb.eplug.xml b/plugins/bbdb/org-gnome-evolution-bbdb.eplug.xml index ff3ff9f8d8..8f9af69821 100644 --- a/plugins/bbdb/org-gnome-evolution-bbdb.eplug.xml +++ b/plugins/bbdb/org-gnome-evolution-bbdb.eplug.xml @@ -11,12 +11,11 @@ <hook class="org.gnome.evolution.mail.events:1.0"> <event - id="message.replying" - handle="bbdb_handle_reply" - target="message" - /> - </hook> - + id="composer.presendchecks" + handle="bbdb_handle_send" + target="message" + /> + </hook> <hook class="org.gnome.evolution.mail.config:1.0"> <group id="org.gnome.evolution.mail.prefs" target="prefs"> <item type="page" path="80.bbdb" _label="BBDB" factory="bbdb_page_factory"/> diff --git a/plugins/exchange-operations/exchange-contacts.c b/plugins/exchange-operations/exchange-contacts.c index 5fe233dec0..f04c9d6076 100644 --- a/plugins/exchange-operations/exchange-contacts.c +++ b/plugins/exchange-operations/exchange-contacts.c @@ -25,6 +25,7 @@ #include <e-util/e-config.h> #include <calendar/gui/e-cal-config.h> #include <libedataserver/e-source.h> +#include <libedataserver/e-source-list.h> #include <libedataserver/e-url.h> #include <e-folder.h> #include <exchange-account.h> @@ -342,17 +343,19 @@ e_exchange_contacts_check (EPlugin *epl, EConfigHookPageCheckData *data) GConfClient *client; ESourceList *source_list = NULL; ESourceGroup *source_group = NULL; - GSList *groups; ESource *source; + EAccount *eaccount; /* GAL folder */ client = gconf_client_get_default (); source_list = e_source_list_new_for_gconf ( client, CONF_KEY_CONTACTS); g_object_unref (client); - groups = e_source_list_peek_groups (source_list); - if ((source_group = e_source_list_peek_group_by_name (source_list, - account->account_name))) { + eaccount = exchange_account_fetch (account); + g_return_val_if_fail (eaccount != NULL, FALSE); + g_return_val_if_fail (eaccount->uid != NULL, FALSE); + + if ((source_group = e_source_list_peek_group_by_properties (source_list, "account-uid", eaccount->uid, NULL))) { source = e_source_group_peek_source_by_name (source_group, e_source_peek_name (t->source)); if (e_source_group_peek_source_by_name (source_group, e_source_peek_name (t->source))) { diff --git a/plugins/external-editor/Makefile.am b/plugins/external-editor/Makefile.am index 0a39bc41e4..4373b81ee5 100644 --- a/plugins/external-editor/Makefile.am +++ b/plugins/external-editor/Makefile.am @@ -15,6 +15,7 @@ INCLUDES = \ -DLIBDIR=\""$(libdir)"\" \ -I$(top_srcdir) \ -I$(top_srcdir)/composer \ + -I$(top_srcdir)/widgets \ $(SHELL_CFLAGS) \ $(EVOLUTION_MAIL_CFLAGS) \ $(E_UTIL_CFLAGS) diff --git a/plugins/external-editor/org-gnome-external-editor.eplug.xml b/plugins/external-editor/org-gnome-external-editor.eplug.xml index 861535d6cf..3ecab43293 100644 --- a/plugins/external-editor/org-gnome-external-editor.eplug.xml +++ b/plugins/external-editor/org-gnome-external-editor.eplug.xml @@ -2,10 +2,10 @@ <e-plugin-list> <e-plugin type="shlib" location="@PLUGINDIR@/liborg-gnome-external-editor@SOEXT@" - id="org.gnome.plugin.external.editor" name="External Editor"> + id="org.gnome.plugin.external.editor" _name="External Editor"> <author name="Holger Macht" email="hmacht@suse.de"/> <author name="Sankar P" email="sankar2u@gmail.com"/> - <description>A plugin for using an external editor as the composer. You can send only plain-text messages.</description> + <_description>A plugin for using an external editor as the composer. You can send only plain-text messages.</_description> <hook class="org.gnome.evolution.ui:1.0"> <ui-manager id="org.gnome.evolution.composer"> diff --git a/plugins/mailing-list-actions/Makefile.am b/plugins/mailing-list-actions/Makefile.am index dffd4f1d44..e90c608a5b 100644 --- a/plugins/mailing-list-actions/Makefile.am +++ b/plugins/mailing-list-actions/Makefile.am @@ -1,5 +1,6 @@ INCLUDES = \ -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ -I$(top_builddir)/composer \ $(EVOLUTION_MAIL_CFLAGS) diff --git a/plugins/publish-calendar/publish-calendar.glade b/plugins/publish-calendar/publish-calendar.glade index 6f6ae9dcf2..1f1dca0202 100644 --- a/plugins/publish-calendar/publish-calendar.glade +++ b/plugins/publish-calendar/publish-calendar.glade @@ -382,7 +382,7 @@ <child> <widget class="GtkTable" id="table1"> <property name="visible">True</property> - <property name="n_rows">2</property> + <property name="n_rows">3</property> <property name="n_columns">2</property> <property name="homogeneous">False</property> <property name="row_spacing">6</property> @@ -418,6 +418,24 @@ </child> <child> + <widget class="GtkComboBox" id="type_selector"> + <property name="visible">True</property> + <property name="items" translatable="yes">iCal +Free/Busy</property> + <property name="add_tearoffs">False</property> + <property name="focus_on_click">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> <widget class="GtkLabel" id="label29"> <property name="visible">True</property> <property name="label" translatable="yes">Publishing _Frequency:</property> @@ -439,8 +457,8 @@ <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> @@ -458,25 +476,87 @@ Manual (via Actions menu)</property> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="fb_duration_label"> + <property name="visible">True</property> + <property name="label" translatable="yes">Time _duration:</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="mnemonic_widget">fb_duration_spin</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> - <property name="y_options">fill</property> + <property name="x_options">fill</property> + <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkComboBox" id="type_selector"> + <widget class="GtkHBox" id="hbox20"> <property name="visible">True</property> - <property name="items" translatable="yes">iCal -Free/Busy</property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkSpinButton" id="fb_duration_spin"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="climb_rate">1</property> + <property name="digits">0</property> + <property name="numeric">False</property> + <property name="update_policy">GTK_UPDATE_ALWAYS</property> + <property name="snap_to_ticks">False</property> + <property name="wrap">False</property> + <property name="adjustment">1 1 100 1 10 0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkComboBox" id="fb_duration_combo"> + <property name="visible">True</property> + <property name="items" translatable="yes">days +weeks +months</property> + <property name="add_tearoffs">False</property> + <property name="focus_on_click">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="x_options">fill</property> <property name="y_options">fill</property> </packing> diff --git a/plugins/publish-calendar/publish-format-fb.c b/plugins/publish-calendar/publish-format-fb.c index 5956b0ff8d..a4b3a44544 100644 --- a/plugins/publish-calendar/publish-format-fb.c +++ b/plugins/publish-calendar/publish-format-fb.c @@ -33,7 +33,7 @@ #include "publish-format-fb.h" static gboolean -write_calendar (gchar *uid, ESourceList *source_list, GOutputStream *stream, GError **error) +write_calendar (gchar *uid, ESourceList *source_list, GOutputStream *stream, int dur_type, int dur_value, GError **error) { ESource *source; ECal *client = NULL; @@ -47,7 +47,19 @@ write_calendar (gchar *uid, ESourceList *source_list, GOutputStream *stream, GEr utc = icaltimezone_get_utc_timezone (); start = time_day_begin_with_zone (start, utc); - end = time_add_week_with_zone (start, 6, utc); + + switch (dur_type) { + case FB_DURATION_DAYS: + end = time_add_day_with_zone (start, dur_value, utc); + break; + default: + case FB_DURATION_WEEKS: + end = time_add_week_with_zone (start, dur_value, utc); + break; + case FB_DURATION_MONTHS: + end = time_add_month_with_zone (start, dur_value, utc); + break; + } source = e_source_list_peek_source_by_uid (source_list, uid); if (source) @@ -109,7 +121,7 @@ publish_calendar_as_fb (GOutputStream *stream, EPublishUri *uri, GError **error) l = uri->events; while (l) { gchar *uid = l->data; - if (!write_calendar (uid, source_list, stream, error)) + if (!write_calendar (uid, source_list, stream, uri->fb_duration_type, uri->fb_duration_value, error)) break; l = g_slist_next (l); } diff --git a/plugins/publish-calendar/publish-location.c b/plugins/publish-calendar/publish-location.c index 2de877b093..1ebe2cfefb 100644 --- a/plugins/publish-calendar/publish-location.c +++ b/plugins/publish-calendar/publish-location.c @@ -120,7 +120,7 @@ e_publish_uri_from_xml (const gchar *xml) { xmlDocPtr doc; xmlNodePtr root, p; - xmlChar *location, *enabled, *frequency; + xmlChar *location, *enabled, *frequency, *fb_duration_value, *fb_duration_type; xmlChar *publish_time, *format, *username = NULL; GSList *events = NULL; EPublishUri *uri; @@ -146,6 +146,8 @@ e_publish_uri_from_xml (const gchar *xml) frequency = xmlGetProp (root, (const unsigned char *)"frequency"); format = xmlGetProp (root, (const unsigned char *)"format"); publish_time = xmlGetProp (root, (const unsigned char *)"publish_time"); + fb_duration_value = xmlGetProp (root, (xmlChar *)"fb_duration_value"); + fb_duration_type = xmlGetProp (root, (xmlChar *)"fb_duration_type"); if (location != NULL) uri->location = (char *)location; @@ -158,6 +160,23 @@ e_publish_uri_from_xml (const gchar *xml) if (publish_time != NULL) uri->last_pub_time = (char *)publish_time; + if (fb_duration_value) + uri->fb_duration_value = atoi ((char *)fb_duration_value); + else + uri->fb_duration_value = -1; + + if (uri->fb_duration_value < 1) + uri->fb_duration_value = 6; + else if (uri->fb_duration_value > 100) + uri->fb_duration_value = 100; + + if (fb_duration_type && g_str_equal ((char *)fb_duration_type, "days")) + uri->fb_duration_type = FB_DURATION_DAYS; + else if (fb_duration_type && g_str_equal ((char *)fb_duration_type, "months")) + uri->fb_duration_type = FB_DURATION_MONTHS; + else + uri->fb_duration_type = FB_DURATION_WEEKS; + uri->password = g_strdup (""); for (p = root->children; p != NULL; p = p->next) { @@ -173,6 +192,8 @@ e_publish_uri_from_xml (const gchar *xml) xmlFree (enabled); xmlFree (frequency); xmlFree (format); + xmlFree (fb_duration_value); + xmlFree (fb_duration_type); xmlFreeDoc (doc); return uri; @@ -204,6 +225,17 @@ e_publish_uri_to_xml (EPublishUri *uri) xmlSetProp (root, (const unsigned char *)"format", (unsigned char *)format); xmlSetProp (root, (const unsigned char *)"publish_time", (unsigned char *)uri->last_pub_time); + g_free (format); + format = g_strdup_printf ("%d", uri->fb_duration_value); + xmlSetProp (root, (xmlChar *)"fb_duration_value", (xmlChar *)format); + + if (uri->fb_duration_type == FB_DURATION_DAYS) + xmlSetProp (root, (xmlChar *)"fb_duration_type", (xmlChar *)"days"); + else if (uri->fb_duration_type == FB_DURATION_MONTHS) + xmlSetProp (root, (xmlChar *)"fb_duration_type", (xmlChar *)"months"); + else + xmlSetProp (root, (xmlChar *)"fb_duration_type", (xmlChar *)"weeks"); + for (calendars = uri->events; calendars != NULL; calendars = g_slist_next (calendars)) { xmlNodePtr node; node = xmlNewChild (root, NULL, (const unsigned char *)"event", NULL); diff --git a/plugins/publish-calendar/publish-location.h b/plugins/publish-calendar/publish-location.h index f3fbf03d49..ec627d18ce 100644 --- a/plugins/publish-calendar/publish-location.h +++ b/plugins/publish-calendar/publish-location.h @@ -56,6 +56,12 @@ static const int publish_format_type_mask[] = { -1, }; +enum FBDurationType { + FB_DURATION_DAYS, + FB_DURATION_WEEKS, + FB_DURATION_MONTHS +}; + typedef struct _EPublishUri EPublishUri; struct _EPublishUri { gboolean enabled; @@ -65,6 +71,8 @@ struct _EPublishUri { gchar *password; GSList *events; gchar *last_pub_time; + int fb_duration_value; + int fb_duration_type; gint service_type; }; diff --git a/plugins/publish-calendar/url-editor-dialog.c b/plugins/publish-calendar/url-editor-dialog.c index 8e1c735dc3..ea03320ae8 100644 --- a/plugins/publish-calendar/url-editor-dialog.c +++ b/plugins/publish-calendar/url-editor-dialog.c @@ -90,6 +90,9 @@ create_uri (UrlEditorDialog *dialog) g_free (username); g_free (password); } + + uri->fb_duration_value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (dialog->fb_duration_spin)); + uri->fb_duration_type = gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->fb_duration_combo)); } static void @@ -101,6 +104,16 @@ check_input (UrlEditorDialog *dialog) uri = dialog->uri; + if (gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->type_selector)) == 1) { + gtk_widget_show (dialog->fb_duration_label); + gtk_widget_show (dialog->fb_duration_spin); + gtk_widget_show (dialog->fb_duration_combo); + } else { + gtk_widget_hide (dialog->fb_duration_label); + gtk_widget_hide (dialog->fb_duration_spin); + gtk_widget_hide (dialog->fb_duration_combo); + } + if (GTK_WIDGET_IS_SENSITIVE (dialog->events_selector)) { sources = e_source_selector_get_selection (E_SOURCE_SELECTOR (dialog->events_selector)); n += g_slist_length (sources); @@ -329,8 +342,11 @@ url_editor_dialog_construct (UrlEditorDialog *dialog) dialog->gui = gui; #define GW(name) ((dialog->name) = glade_xml_get_widget (dialog->gui, #name)) - GW(publish_frequency); GW(type_selector); + GW(fb_duration_label); + GW(fb_duration_spin); + GW(fb_duration_combo); + GW(publish_frequency); GW(events_swin); @@ -429,6 +445,9 @@ url_editor_dialog_construct (UrlEditorDialog *dialog) } } + gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->fb_duration_spin), uri->fb_duration_value); + gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->fb_duration_combo), uri->fb_duration_type); + g_signal_connect (G_OBJECT (dialog->publish_service), "changed", G_CALLBACK (publish_service_changed), dialog); g_signal_connect (G_OBJECT (dialog->type_selector), "changed", G_CALLBACK (type_selector_changed), dialog); g_signal_connect (G_OBJECT (dialog->publish_frequency), "changed", G_CALLBACK (frequency_changed_cb), dialog); diff --git a/plugins/publish-calendar/url-editor-dialog.h b/plugins/publish-calendar/url-editor-dialog.h index 2d985e90e5..3a85fc895e 100644 --- a/plugins/publish-calendar/url-editor-dialog.h +++ b/plugins/publish-calendar/url-editor-dialog.h @@ -64,8 +64,11 @@ struct _UrlEditorDialog { GladeXML *gui; - GtkWidget *publish_frequency; GtkWidget *type_selector; + GtkWidget *fb_duration_label; + GtkWidget *fb_duration_spin; + GtkWidget *fb_duration_combo; + GtkWidget *publish_frequency; GtkWidget *events_swin; diff --git a/plugins/templates/Makefile.am b/plugins/templates/Makefile.am index 6b01e15767..3c1ff2052e 100644 --- a/plugins/templates/Makefile.am +++ b/plugins/templates/Makefile.am @@ -1,5 +1,6 @@ INCLUDES = \ -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ -I$(top_builddir) \ -I$(top_builddir)/composer \ $(EVOLUTION_MAIL_CFLAGS) \ |