diff options
Diffstat (limited to 'modules')
51 files changed, 753 insertions, 2396 deletions
diff --git a/modules/Makefile.am b/modules/Makefile.am index 4c0c38dcbb..f42e3000a7 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -22,6 +22,7 @@ SUBDIRS = \ addressbook \ calendar \ mail \ + mailto-handler \ plugin-lib \ $(MONO_DIR) \ $(PYTHON_DIR) \ diff --git a/modules/addressbook/addressbook-config.c b/modules/addressbook/addressbook-config.c index 9c53f411d5..7d398f855d 100644 --- a/modules/addressbook/addressbook-config.c +++ b/modules/addressbook/addressbook-config.c @@ -299,10 +299,15 @@ static gint addressbook_root_dse_query (AddressbookSourceDialog *dialog, LDAP *ldap, const gchar **attrs, LDAPMessage **resp) { + GtkAdjustment *adjustment; + GtkRange *range; gint ldap_error; struct timeval timeout; - timeout.tv_sec = (gint) gtk_adjustment_get_value (GTK_RANGE(dialog->timeout_scale)->adjustment); + range = GTK_RANGE (dialog->timeout_scale); + adjustment = gtk_range_get_adjustment (range); + + timeout.tv_sec = (gint) gtk_adjustment_get_value (adjustment); timeout.tv_usec = 0; ldap_error = ldap_search_ext_s (ldap, @@ -376,6 +381,7 @@ query_for_supported_bases (GtkWidget *button, AddressbookSourceDialog *sdialog) GtkTreeSelection *selection; GtkTreeModel *model; GtkWidget *dialog; + GtkWidget *container; GtkWidget *supported_bases_table; GtkBuilder *builder; GtkTreeIter iter; @@ -389,8 +395,12 @@ query_for_supported_bases (GtkWidget *button, AddressbookSourceDialog *sdialog) gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); gtk_widget_ensure_style (dialog); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 0); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 12); + + container = gtk_dialog_get_action_area (GTK_DIALOG (dialog)); + gtk_container_set_border_width (GTK_CONTAINER (container), 12); + + container = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); + gtk_container_set_border_width (GTK_CONTAINER (container), 0); supported_bases_table = e_builder_get_widget (builder, "supported-bases-table"); model = gtk_tree_view_get_model (GTK_TREE_VIEW (supported_bases_table)); @@ -589,7 +599,7 @@ eabc_general_use_in_cal (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkW if (old) return old; - use_in_cal_setting = gtk_check_button_new_with_mnemonic (_("Use in _Birthday & Anniversaries calendar")); + use_in_cal_setting = gtk_check_button_new_with_mnemonic (_("U_se in Birthday & Anniversaries calendar")); gtk_widget_show (use_in_cal_setting); gtk_container_add (GTK_CONTAINER (parent), use_in_cal_setting); @@ -918,9 +928,13 @@ eabc_details_search(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget static void timeout_changed_cb(GtkWidget *w, AddressbookSourceDialog *sdialog) { + GtkAdjustment *adjustment; + GtkRange *range; gchar *timeout; - timeout = g_strdup_printf("%f", gtk_adjustment_get_value(((GtkRange *)sdialog->timeout_scale)->adjustment)); + range = GTK_RANGE (sdialog->timeout_scale); + adjustment = gtk_range_get_adjustment (range); + timeout = g_strdup_printf("%f", gtk_adjustment_get_value (adjustment)); e_source_set_property(sdialog->source, "timeout", timeout); g_free(timeout); } @@ -947,6 +961,8 @@ static GtkWidget * eabc_details_limit(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data) { AddressbookSourceDialog *sdialog = data; + GtkAdjustment *adjustment; + GtkRange *range; GtkWidget *w; const gchar *tmp; GtkBuilder *builder; @@ -961,9 +977,13 @@ eabc_details_limit(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget gtk_box_pack_start((GtkBox *)parent, w, FALSE, FALSE, 0); sdialog->timeout_scale = e_builder_get_widget (builder, "timeout-scale"); + range = GTK_RANGE (sdialog->timeout_scale); + adjustment = gtk_range_get_adjustment (range); tmp = e_source_get_property(sdialog->source, "timeout"); - gtk_adjustment_set_value(((GtkRange *)sdialog->timeout_scale)->adjustment, tmp?g_strtod(tmp, NULL):3.0); - g_signal_connect (GTK_RANGE(sdialog->timeout_scale)->adjustment, "value_changed", G_CALLBACK (timeout_changed_cb), sdialog); + gtk_adjustment_set_value (adjustment, tmp?g_strtod(tmp, NULL):3.0); + g_signal_connect ( + adjustment, "value_changed", + G_CALLBACK (timeout_changed_cb), sdialog); sdialog->limit_spinbutton = e_builder_get_widget (builder, "download-limit-spinbutton"); tmp = e_source_get_property(sdialog->source, "limit"); diff --git a/modules/addressbook/autocompletion-config.c b/modules/addressbook/autocompletion-config.c index 6b51427be1..99a8b9b8ae 100644 --- a/modules/addressbook/autocompletion-config.c +++ b/modules/addressbook/autocompletion-config.c @@ -156,7 +156,7 @@ autocompletion_config_new (EShell *shell) gtk_box_pack_start (GTK_BOX (itembox), widget, TRUE, TRUE, 0); e_datetime_format_add_setup_widget ( widget, 0, "addressbook", "table", - DTFormatKindDateTime, _("Table column:")); + DTFormatKindDateTime, _("_Table column:")); gtk_widget_show (widget); itembox = add_section (vbox, _("Autocompletion"), TRUE); diff --git a/modules/addressbook/e-book-shell-backend.c b/modules/addressbook/e-book-shell-backend.c index 74dbbfcf7f..d0340f7974 100644 --- a/modules/addressbook/e-book-shell-backend.c +++ b/modules/addressbook/e-book-shell-backend.c @@ -594,8 +594,8 @@ book_shell_backend_class_init (EBookShellBackendClass *class) PROP_SOURCE_LIST, g_param_spec_object ( "source-list", - _("Source List"), - _("The registry of address books"), + "Source List", + "The registry of address books", E_TYPE_SOURCE_LIST, G_PARAM_READABLE)); } diff --git a/modules/addressbook/e-book-shell-content.c b/modules/addressbook/e-book-shell-content.c index 9642627844..4a48677d13 100644 --- a/modules/addressbook/e-book-shell-content.c +++ b/modules/addressbook/e-book-shell-content.c @@ -189,6 +189,7 @@ book_shell_content_constructed (GObject *object) EShellView *shell_view; EShellWindow *shell_window; EShellContent *shell_content; + EShellTaskbar *shell_taskbar; GConfBridge *bridge; GtkWidget *container; GtkWidget *widget; @@ -202,6 +203,7 @@ book_shell_content_constructed (GObject *object) shell_content = E_SHELL_CONTENT (object); shell_view = e_shell_content_get_shell_view (shell_content); shell_window = e_shell_view_get_shell_window (shell_view); + shell_taskbar = e_shell_view_get_shell_taskbar (shell_view); shell = e_shell_window_get_shell (shell_window); container = GTK_WIDGET (object); @@ -233,6 +235,11 @@ book_shell_content_constructed (GObject *object) widget, "send-message", G_CALLBACK (book_shell_content_send_message_cb), object); + g_signal_connect_swapped ( + widget, "status-message", + G_CALLBACK (e_shell_taskbar_set_message), + shell_taskbar); + widget = e_preview_pane_new (E_WEB_VIEW (widget)); gtk_paned_pack2 (GTK_PANED (container), widget, FALSE, FALSE); priv->preview_pane = g_object_ref (widget); @@ -361,8 +368,8 @@ book_shell_content_class_init (EBookShellContentClass *class) PROP_CURRENT_VIEW, g_param_spec_object ( "current-view", - _("Current View"), - _("The currently selected address book view"), + "Current View", + "The currently selected address book view", E_TYPE_ADDRESSBOOK_VIEW, G_PARAM_READWRITE)); @@ -371,8 +378,8 @@ book_shell_content_class_init (EBookShellContentClass *class) PROP_PREVIEW_CONTACT, g_param_spec_object ( "preview-contact", - _("Previewed Contact"), - _("The contact being shown in the preview pane"), + "Previewed Contact", + "The contact being shown in the preview pane", E_TYPE_CONTACT, G_PARAM_READWRITE)); @@ -381,8 +388,8 @@ book_shell_content_class_init (EBookShellContentClass *class) PROP_PREVIEW_VISIBLE, g_param_spec_boolean ( "preview-visible", - _("Preview is Visible"), - _("Whether the preview pane is visible"), + "Preview is Visible", + "Whether the preview pane is visible", TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); diff --git a/modules/addressbook/e-book-shell-migrate.c b/modules/addressbook/e-book-shell-migrate.c index 55246ce047..5cc22a50d6 100644 --- a/modules/addressbook/e-book-shell-migrate.c +++ b/modules/addressbook/e-book-shell-migrate.c @@ -45,7 +45,6 @@ #include "e-util/e-util.h" #include "e-util/e-util-private.h" #include "e-util/e-xml-utils.h" -#include "e-util/e-folder-map.h" #include "e-book-shell-migrate.h" @@ -67,378 +66,6 @@ typedef struct { GtkWidget *progress; } MigrationContext; -static void -setup_progress_dialog (MigrationContext *context) -{ - GtkWidget *vbox, *hbox; - - context->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (context->window), _("Migrating...")); - gtk_window_set_modal (GTK_WINDOW (context->window), TRUE); - gtk_container_set_border_width (GTK_CONTAINER (context->window), 6); - - vbox = gtk_vbox_new (FALSE, 6); - gtk_widget_show (vbox); - gtk_container_add (GTK_CONTAINER (context->window), vbox); - - context->label = gtk_label_new (""); - gtk_label_set_line_wrap (GTK_LABEL (context->label), TRUE); - gtk_widget_show (context->label); - gtk_box_pack_start (GTK_BOX (vbox), context->label, TRUE, TRUE, 0); - - hbox = gtk_hbox_new (FALSE, 6); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0); - - context->folder_label = gtk_label_new (""); - gtk_widget_show (context->folder_label); - gtk_box_pack_start (GTK_BOX (hbox), context->folder_label, TRUE, TRUE, 0); - - context->progress = gtk_progress_bar_new (); - gtk_widget_show (context->progress); - gtk_box_pack_start (GTK_BOX (hbox), context->progress, TRUE, TRUE, 0); - - gtk_widget_show (context->window); -} - -static void -dialog_close (MigrationContext *context) -{ - gtk_widget_destroy (context->window); -} - -static void -dialog_set_label (MigrationContext *context, const gchar *str) -{ - gtk_label_set_text (GTK_LABEL (context->label), str); - - while (gtk_events_pending ()) - gtk_main_iteration (); - -#ifdef SLOW_MIGRATION - sleep (1); -#endif -} - -static void -dialog_set_folder_name (MigrationContext *context, const gchar *folder_name) -{ - gchar *text; - - text = g_strdup_printf (_("Migrating '%s':"), folder_name); - gtk_label_set_text (GTK_LABEL (context->folder_label), text); - g_free (text); - - gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (context->progress), 0.0); - - while (gtk_events_pending ()) - gtk_main_iteration (); - -#ifdef SLOW_MIGRATION - sleep (1); -#endif -} - -static void -dialog_set_progress (MigrationContext *context, double percent) -{ - gchar text[5]; - - snprintf (text, sizeof (text), "%d%%", (gint) (percent * 100.0f)); - - gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (context->progress), percent); - gtk_progress_bar_set_text (GTK_PROGRESS_BAR (context->progress), text); - - while (gtk_events_pending ()) - gtk_main_iteration (); - -#ifdef SLOW_MIGRATION - sleep (1); -#endif -} - -static gboolean -check_for_conflict (ESourceGroup *group, gchar *name) -{ - GSList *sources; - GSList *s; - - sources = e_source_group_peek_sources (group); - - for (s = sources; s; s = s->next) { - ESource *source = E_SOURCE (s->data); - - if (!strcmp (e_source_peek_name (source), name)) - return TRUE; - } - - return FALSE; -} - -static gchar * -get_source_name (ESourceGroup *group, const gchar *path) -{ -#ifndef G_OS_WIN32 - gchar **p = g_strsplit (path, "/", 0); -#else - gchar **p = g_strsplit_set (path, "\\/", 0); -#endif - gint i, j, starting_index; - gint num_elements; - gboolean conflict; - GString *s = g_string_new (""); - - for (i = 0; p[i]; i ++); - - num_elements = i; - i--; - - /* p[i] is now the last path element */ - - /* check if it conflicts */ - starting_index = i; - do { - g_string_assign (s, ""); - for (j = starting_index; j < num_elements; j += 2) { - if (j != starting_index) - g_string_append_c (s, '_'); - g_string_append (s, p[j]); - } - - conflict = check_for_conflict (group, s->str); - - /* if there was a conflict back up 2 levels (skipping the /subfolder/ element) */ - if (conflict) - starting_index -= 2; - - /* we always break out if we can't go any further, - regardless of whether or not we conflict. */ - if (starting_index < 0) - break; - - } while (conflict); - - g_strfreev (p); - - return g_string_free (s, FALSE); -} - -static void -migrate_contacts (MigrationContext *context, EBook *old_book, EBook *new_book) -{ - EBookQuery *query = e_book_query_any_field_contains (""); - GList *l, *contacts; - gint num_added = 0; - gint num_contacts; - - /* both books are loaded, start the actual migration */ - e_book_get_contacts (old_book, query, &contacts, NULL); - e_book_query_unref (query); - - num_contacts = g_list_length (contacts); - for (l = contacts; l; l = l->next) { - EContact *contact = l->data; - GError *e = NULL; - GList *attrs, *attr; - - /* do some last minute massaging of the contact's attributes */ - - attrs = e_vcard_get_attributes (E_VCARD (contact)); - for (attr = attrs; attr;) { - EVCardAttribute *a = attr->data; - - /* evo 1.4 used the non-standard X-EVOLUTION-OFFICE attribute, - evo 1.5 uses the third element in the ORG list attribute. */ - if (!strcmp ("X-EVOLUTION-OFFICE", e_vcard_attribute_get_name (a))) { - GList *v = e_vcard_attribute_get_values (a); - GList *next_attr; - - if (v && v->data) - e_contact_set (contact, E_CONTACT_OFFICE, v->data); - - next_attr = attr->next; - e_vcard_remove_attribute (E_VCARD (contact), a); - attr = next_attr; - } - /* evo 1.4 didn't put TYPE=VOICE in for phone numbers. - evo 1.5 does. - - so we search through the attribute params for - either TYPE=VOICE or TYPE=FAX. If we find - either we do nothing. If we find neither, we - add TYPE=VOICE. - */ - else if (!strcmp ("TEL", e_vcard_attribute_get_name (a))) { - GList *params, *param; - gboolean found = FALSE; - - params = e_vcard_attribute_get_params (a); - for (param = params; param; param = param->next) { - EVCardAttributeParam *p = param->data; - if (!strcmp (EVC_TYPE, e_vcard_attribute_param_get_name (p))) { - GList *v = e_vcard_attribute_param_get_values (p); - while (v && v->data) { - if (!strcmp ("VOICE", v->data) - || !strcmp ("FAX", v->data)) { - found = TRUE; - break; - } - v = v->next; - } - } - } - - if (!found) - e_vcard_attribute_add_param_with_value (a, - e_vcard_attribute_param_new (EVC_TYPE), - "VOICE"); - attr = attr->next; - } - /* Replace "POSTAL" (1.4) addresses with "OTHER" (1.5) */ - else if (!strcmp ("ADR", e_vcard_attribute_get_name (a))) { - GList *params, *param; - gboolean found = FALSE; - EVCardAttributeParam *p; - - params = e_vcard_attribute_get_params (a); - for (param = params; param; param = param->next) { - p = param->data; - if (!strcmp (EVC_TYPE, e_vcard_attribute_param_get_name (p))) { - GList *v = e_vcard_attribute_param_get_values (p); - while (v && v->data ) { - if (!strcmp ("POSTAL", v->data)) { - found = TRUE; - break; - } - v = v->next; - } - if (found) - break; - } - } - - if (found) { - e_vcard_attribute_param_remove_values (p); - e_vcard_attribute_param_add_value (p, "OTHER"); - } - - attr = attr->next; - } - /* this is kinda gross. The new vcard parser - needs ';'s to be escaped by \'s. but the - 1.4 vcard generator would put unescaped xml - (including entities like >) in the value - of attributes, so we need to go through and - escape those ';'s. */ - else if (!strcmp ("EMAIL", e_vcard_attribute_get_name (a))) { - GList *params; - GList *v = e_vcard_attribute_get_values (a); - - /* Add TYPE=OTHER if there is no type set */ - params = e_vcard_attribute_get_params (a); - if (!params) - e_vcard_attribute_add_param_with_value (a, - e_vcard_attribute_param_new (EVC_TYPE), - "OTHER"); - - if (v && v->data) { - if (!strncmp ((gchar *)v->data, "<?xml", 5)) { - /* k, this is the nasty part. we glomb all the - value strings back together again (if there is - more than one), then work our magic */ - GString *str = g_string_new (""); - while (v) { - g_string_append (str, v->data); - if (v->next) - g_string_append_c (str, ';'); - v = v->next; - } - - e_vcard_attribute_remove_values (a); - e_vcard_attribute_add_value (a, str->str); - g_string_free (str, TRUE); - } - } - - attr = attr->next; - } - else { - attr = attr->next; - } - } - - if (!e_book_add_contact (new_book, - contact, - &e)) - g_warning ("contact add failed: '%s'", e->message); - - num_added ++; - - dialog_set_progress (context, (double)num_added / num_contacts); - } - - g_list_foreach (contacts, (GFunc)g_object_unref, NULL); - g_list_free (contacts); -} - -static void -migrate_contact_folder_to_source (MigrationContext *context, gchar *old_path, ESource *new_source) -{ - gchar *old_uri = g_filename_to_uri (old_path, NULL, NULL); - GError *e = NULL; - - EBook *old_book = NULL, *new_book = NULL; - ESource *old_source; - ESourceGroup *group; - - group = e_source_group_new ("", old_uri); - old_source = e_source_new ("", ""); - e_source_group_add_source (group, old_source, -1); - - dialog_set_folder_name (context, e_source_peek_name (new_source)); - - old_book = e_book_new (old_source, &e); - if (!old_book - || !e_book_open (old_book, TRUE, &e)) { - g_warning ("failed to load source book for migration: '%s'", e->message); - goto finish; - } - - new_book = e_book_new (new_source, &e); - if (!new_book - || !e_book_open (new_book, FALSE, &e)) { - g_warning ("failed to load destination book for migration: '%s'", e->message); - goto finish; - } - - migrate_contacts (context, old_book, new_book); - - finish: - g_object_unref (old_source); - g_object_unref (group); - if (old_book) - g_object_unref (old_book); - if (new_book) - g_object_unref (new_book); - g_free (old_uri); -} - -static void -migrate_contact_folder (MigrationContext *context, gchar *old_path, ESourceGroup *dest_group, gchar *source_name) -{ - ESource *new_source; - - new_source = e_source_new (source_name, source_name); - e_source_set_relative_uri (new_source, e_source_peek_uid (new_source)); - e_source_group_add_source (dest_group, new_source, -1); - - g_hash_table_insert (context->folder_uid_map, g_strdup (old_path), g_strdup (e_source_peek_uid (new_source))); - - migrate_contact_folder_to_source (context, old_path, new_source); - - g_object_unref (new_source); -} - #define LDAP_BASE_URI "ldap://" #define PERSONAL_RELATIVE_URI "system" @@ -524,562 +151,6 @@ create_groups (MigrationContext *context, g_free (base_uri); } -static gboolean -migrate_local_folders (MigrationContext *context, ESourceGroup *on_this_computer, ESource *personal_source) -{ - gchar *old_path = NULL; - GSList *dirs, *l; - gchar *local_contact_folder = NULL; - - old_path = g_strdup_printf ("%s/evolution/local", g_get_home_dir ()); - - dirs = e_folder_map_local_folders (old_path, "contacts"); - - /* migrate the local addressbook first, to local/system */ - local_contact_folder = g_build_filename (g_get_home_dir (), - "evolution", "local", "Contacts", - NULL); - - for (l = dirs; l; l = l->next) { - gchar *source_name; - /* we handle the system folder differently */ - if (personal_source && !strcmp ((gchar *)l->data, local_contact_folder)) { - g_hash_table_insert (context->folder_uid_map, g_strdup (l->data), g_strdup (e_source_peek_uid (personal_source))); - migrate_contact_folder_to_source (context, local_contact_folder, personal_source); - continue; - } - - source_name = get_source_name (on_this_computer, (gchar *)l->data); - migrate_contact_folder (context, l->data, on_this_computer, source_name); - g_free (source_name); - } - - g_slist_foreach (dirs, (GFunc)g_free, NULL); - g_slist_free (dirs); - g_free (local_contact_folder); - g_free (old_path); - - return TRUE; -} - -static gchar * -get_string_child (xmlNode *node, - const gchar *name) -{ - xmlNode *p; - xmlChar *xml_string; - gchar *retval; - - p = e_xml_get_child_by_name (node, (xmlChar *) name); - if (p == NULL) - return NULL; - - p = e_xml_get_child_by_name (p, (xmlChar *) "text"); - if (p == NULL) /* there's no text between the tags, return the empty string */ - return g_strdup(""); - - xml_string = xmlNodeListGetString (node->doc, p, 1); - retval = g_strdup ((gchar *) xml_string); - xmlFree (xml_string); - - return retval; -} - -static gint -get_integer_child (xmlNode *node, - const gchar *name, - gint defval) -{ - xmlNode *p; - xmlChar *xml_string; - gint retval; - - p = e_xml_get_child_by_name (node, (xmlChar *) name); - if (p == NULL) - return defval; - - p = e_xml_get_child_by_name (p, (xmlChar *) "text"); - if (p == NULL) /* there's no text between the tags, return the default */ - return defval; - - xml_string = xmlNodeListGetString (node->doc, p, 1); - retval = atoi ((gchar *)xml_string); - xmlFree (xml_string); - - return retval; -} - -static gboolean -migrate_ldap_servers (MigrationContext *context, ESourceGroup *on_ldap_servers) -{ - gchar *sources_xml = g_strdup_printf ("%s/evolution/addressbook-sources.xml", - g_get_home_dir ()); - - printf ("trying to migrate from %s\n", sources_xml); - - if (g_file_test (sources_xml, G_FILE_TEST_EXISTS)) { - xmlDoc *doc = xmlParseFile (sources_xml); - xmlNode *root; - xmlNode *child; - gint num_contactservers; - gint servernum; - - if (!doc) - return FALSE; - - root = xmlDocGetRootElement (doc); - if (root == NULL || strcmp ((const gchar *)root->name, "addressbooks") != 0) { - xmlFreeDoc (doc); - return FALSE; - } - - /* count the number of servers, so we can give progress */ - num_contactservers = 0; - for (child = root->children; child; child = child->next) { - if (!strcmp ((const gchar *)child->name, "contactserver")) { - num_contactservers++; - } - } - printf ("found %d contact servers to migrate\n", num_contactservers); - - dialog_set_folder_name (context, _("LDAP Servers")); - - servernum = 0; - for (child = root->children; child; child = child->next) { - if (!strcmp ((const gchar *)child->name, "contactserver")) { - gchar *port, *host, *rootdn, *scope, *authmethod, *ssl; - gchar *emailaddr, *binddn, *limitstr; - gint limit; - gchar *name, *description; - GString *uri = g_string_new (""); - ESource *source; - - name = get_string_child (child, "name"); - description = get_string_child (child, "description"); - port = get_string_child (child, "port"); - host = get_string_child (child, "host"); - rootdn = get_string_child (child, "rootdn"); - scope = get_string_child (child, "scope"); - authmethod = get_string_child (child, "authmethod"); - ssl = get_string_child (child, "ssl"); - emailaddr = get_string_child (child, "emailaddr"); - binddn = get_string_child (child, "binddn"); - limit = get_integer_child (child, "limit", 100); - limitstr = g_strdup_printf ("%d", limit); - - g_string_append_printf (uri, - "%s:%s/%s?"/*trigraph prevention*/"?%s", - host, port, rootdn, scope); - - source = e_source_new (name, uri->str); - e_source_set_property (source, "description", description); - e_source_set_property (source, "limit", limitstr); - e_source_set_property (source, "ssl", ssl); - e_source_set_property (source, "auth", authmethod); - if (emailaddr) - e_source_set_property (source, "email_addr", emailaddr); - if (binddn) - e_source_set_property (source, "binddn", binddn); - - e_source_group_add_source (on_ldap_servers, source, -1); - - g_string_free (uri, TRUE); - g_free (port); - g_free (host); - g_free (rootdn); - g_free (scope); - g_free (authmethod); - g_free (ssl); - g_free (emailaddr); - g_free (binddn); - g_free (limitstr); - g_free (name); - g_free (description); - - servernum++; - dialog_set_progress (context, (double)servernum/num_contactservers); - } - } - - xmlFreeDoc (doc); - } - - g_free (sources_xml); - - return TRUE; -} - -static ESource* -get_source_by_name (ESourceList *source_list, const gchar *name) -{ - GSList *groups; - GSList *g; - - groups = e_source_list_peek_groups (source_list); - if (!groups) - return NULL; - - for (g = groups; g; g = g->next) { - GSList *sources; - GSList *s; - ESourceGroup *group = E_SOURCE_GROUP (g->data); - - sources = e_source_group_peek_sources (group); - if (!sources) - continue; - - for (s = sources; s; s = s->next) { - ESource *source = E_SOURCE (s->data); - const gchar *source_name = e_source_peek_name (source); - - if (!strcmp (name, source_name)) - return source; - } - } - - return NULL; -} - -static gboolean -migrate_completion_folders (MigrationContext *context) -{ - GConfClient *client; - const gchar *key; - gchar *uris_xml; - - printf ("trying to migrate completion folders\n"); - - client = gconf_client_get_default (); - key = "/apps/evolution/addressbook/completion/uris"; - uris_xml = gconf_client_get_string (client, key, NULL); - g_object_unref (client); - - if (uris_xml) { - xmlDoc *doc = xmlParseMemory (uris_xml, strlen (uris_xml)); - xmlNode *root; - xmlNode *child; - - if (!doc) - return FALSE; - - dialog_set_folder_name (context, _("Autocompletion Settings")); - - root = xmlDocGetRootElement (doc); - if (root == NULL || strcmp ((const gchar *)root->name, "EvolutionFolderList") != 0) { - xmlFreeDoc (doc); - return FALSE; - } - - for (child = root->children; child; child = child->next) { - if (!strcmp ((const gchar *)child->name, "folder")) { - gchar *physical_uri = e_xml_get_string_prop_by_name (child, (const guchar *)"physical-uri"); - ESource *source = NULL; - - /* if the physical uri is file://... - we look it up in our folder_uid_map - hashtable. If it's a folder we - converted over, we should get back - a uid we can search for. - - if the physical_uri is anything - else, we strip off the args - (anything after;) before searching - for the uri. */ - - if (!strncmp (physical_uri, "file://", 7)) { - gchar *filename = g_filename_from_uri (physical_uri, NULL, NULL); - gchar *uid = NULL; - - if (filename) - uid = g_hash_table_lookup (context->folder_uid_map, - filename); - g_free (filename); - if (uid) - source = e_source_list_peek_source_by_uid (context->source_list, uid); - } - else { - gchar *name = e_xml_get_string_prop_by_name (child, (const guchar *)"display-name"); - - source = get_source_by_name (context->source_list, name); - - g_free (name); - } - - if (source) { - e_source_set_property (source, "completion", "true"); - } - else { - g_warning ("found completion folder with uri '%s' that " - "doesn't correspond to anything we migrated.", physical_uri); - } - - g_free (physical_uri); - } - } - - g_free (uris_xml); - } - else { - g_message ("no completion folder settings to migrate"); - } - - return TRUE; -} - -static void -migrate_contact_lists_for_local_folders (MigrationContext *context, ESourceGroup *on_this_computer) -{ - GSList *sources, *s; - - sources = e_source_group_peek_sources (on_this_computer); - for (s = sources; s; s = s->next) { - ESource *source = s->data; - EBook *book; - EBookQuery *query; - GList *l, *contacts; - gint num_contacts, num_converted; - - dialog_set_folder_name (context, e_source_peek_name (source)); - - book = e_book_new (source, NULL); - if (!book - || !e_book_open (book, TRUE, NULL)) { - gchar *uri = e_source_get_uri (source); - g_warning ("failed to migrate contact lists for source %s", uri); - g_free (uri); - continue; - } - - query = e_book_query_any_field_contains (""); - e_book_get_contacts (book, query, &contacts, NULL); - e_book_query_unref (query); - - num_converted = 0; - num_contacts = g_list_length (contacts); - for (l = contacts; l; l = l->next) { - EContact *contact = l->data; - GError *e = NULL; - GList *attrs, *attr; - gboolean converted = FALSE; - - attrs = e_contact_get_attributes (contact, E_CONTACT_EMAIL); - for (attr = attrs; attr; attr = attr->next) { - EVCardAttribute *a = attr->data; - GList *v = e_vcard_attribute_get_values (a); - - if (v && v->data) { - if (!strncmp ((gchar *)v->data, "<?xml", 5)) { - EDestination *dest = e_destination_import ((gchar *)v->data); - - e_destination_export_to_vcard_attribute (dest, a); - - g_object_unref (dest); - - converted = TRUE; - } - } - } - - if (converted) { - e_contact_set_attributes (contact, E_CONTACT_EMAIL, attrs); - - if (!e_book_commit_contact (book, - contact, - &e)) - g_warning ("contact commit failed: '%s'", e->message); - } - - num_converted ++; - - dialog_set_progress (context, (double)num_converted / num_contacts); - } - - g_list_foreach (contacts, (GFunc)g_object_unref, NULL); - g_list_free (contacts); - - g_object_unref (book); - } -} - -static void -migrate_company_phone_for_local_folders (MigrationContext *context, ESourceGroup *on_this_computer) -{ - GSList *sources, *s; - - sources = e_source_group_peek_sources (on_this_computer); - for (s = sources; s; s = s->next) { - ESource *source = s->data; - EBook *book; - EBookQuery *query; - GList *l, *contacts; - gint num_contacts, num_converted; - - dialog_set_folder_name (context, e_source_peek_name (source)); - - book = e_book_new (source, NULL); - if (!book - || !e_book_open (book, TRUE, NULL)) { - gchar *uri = e_source_get_uri (source); - g_warning ("failed to migrate company phone numbers for source %s", uri); - g_free (uri); - continue; - } - - query = e_book_query_any_field_contains (""); - e_book_get_contacts (book, query, &contacts, NULL); - e_book_query_unref (query); - - num_converted = 0; - num_contacts = g_list_length (contacts); - for (l = contacts; l; l = l->next) { - EContact *contact = l->data; - GError *e = NULL; - GList *attrs, *attr; - gboolean converted = FALSE; - gint num_work_voice = 0; - - attrs = e_vcard_get_attributes (E_VCARD (contact)); - for (attr = attrs; attr;) { - EVCardAttribute *a = attr->data; - GList *next_attr = attr->next; - - if (!strcmp ("TEL", e_vcard_attribute_get_name (a))) { - GList *params, *param; - gboolean found_voice = FALSE; - gboolean found_work = FALSE; - - params = e_vcard_attribute_get_params (a); - for (param = params; param; param = param->next) { - EVCardAttributeParam *p = param->data; - if (!strcmp (EVC_TYPE, e_vcard_attribute_param_get_name (p))) { - GList *v = e_vcard_attribute_param_get_values (p); - while (v && v->data) { - if (!strcmp ("VOICE", v->data)) - found_voice = TRUE; - else if (!strcmp ("WORK", v->data)) - found_work = TRUE; - v = v->next; - } - } - - if (found_work && found_voice) - num_work_voice++; - - if (num_work_voice == 3) { - GList *v = e_vcard_attribute_get_values (a); - - if (v && v->data) - e_contact_set (contact, E_CONTACT_PHONE_COMPANY, v->data); - - e_vcard_remove_attribute (E_VCARD (contact), a); - - converted = TRUE; - break; - } - } - } - - attr = next_attr; - - if (converted) - break; - } - - if (converted) { - if (!e_book_commit_contact (book, - contact, - &e)) - g_warning ("contact commit failed: '%s'", e->message); - } - - num_converted ++; - - dialog_set_progress (context, (double)num_converted / num_contacts); - } - - g_list_foreach (contacts, (GFunc)g_object_unref, NULL); - g_list_free (contacts); - - g_object_unref (book); - } -} - -static void -migrate_pilot_data (const gchar *old_path, const gchar *new_path) -{ - const gchar *dent; - const gchar *ext; - gchar *filename; - GDir *dir; - - if (!(dir = g_dir_open (old_path, 0, NULL))) - return; - - while ((dent = g_dir_read_name (dir))) { - if ((!strncmp (dent, "pilot-map-", 10) && - ((ext = strrchr (dent, '.')) && !strcmp (ext, ".xml"))) || - (!strncmp (dent, "pilot-sync-evolution-addressbook-", 33) && - ((ext = strrchr (dent, '.')) && !strcmp (ext, ".db")))) { - /* src and dest file formats are identical for both map and changelog files */ - guchar inbuf[4096]; - gsize nread, nwritten; - gint fd0, fd1; - gssize n; - - filename = g_build_filename (old_path, dent, NULL); - if ((fd0 = g_open (filename, O_RDONLY | O_BINARY, 0)) == -1) { - g_free (filename); - continue; - } - - g_free (filename); - filename = g_build_filename (new_path, dent, NULL); - if ((fd1 = g_open (filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666)) == -1) { - g_free (filename); - close (fd0); - continue; - } - - do { - do { - n = read (fd0, inbuf, sizeof (inbuf)); - } while (n == -1 && errno == EINTR); - - if (n < 1) - break; - - nread = n; - nwritten = 0; - do { - do { - n = write (fd1, inbuf + nwritten, nread - nwritten); - } while (n == -1 && errno == EINTR); - - if (n > 0) - nwritten += n; - } while (nwritten < nread && n != -1); - - if (n == -1) - break; - } while (1); - - if (n != -1) - n = fsync (fd1); - - if (n == -1) { - g_warning ("Failed to migrate %s: %s", dent, g_strerror (errno)); - g_unlink (filename); - } - - close (fd0); - close (fd1); - g_free (filename); - } - } - - g_dir_close (dir); -} - static MigrationContext * migration_context_new (const gchar *data_dir) { @@ -1121,7 +192,6 @@ e_book_shell_backend_migrate (EShellBackend *shell_backend, ESourceGroup *on_ldap_servers; ESource *personal_source; MigrationContext *context; - gboolean need_dialog = FALSE; const gchar *data_dir; g_return_val_if_fail (E_IS_SHELL_BACKEND (shell_backend), FALSE); @@ -1134,87 +204,6 @@ e_book_shell_backend_migrate (EShellBackend *shell_backend, groups/sources. */ create_groups (context, &on_this_computer, &on_ldap_servers, &personal_source); - /* figure out if we need the dialog displayed */ - if (major == 1 - /* we only need the most recent upgrade point here. - further decomposition will happen below. */ - && (minor < 5 || (minor == 5 && micro <= 10))) - need_dialog = TRUE; - - if (need_dialog) - setup_progress_dialog (context); - - if (major == 1) { - - if (minor < 5 || (minor == 5 && micro <= 2)) { - /* initialize our dialog */ - dialog_set_label (context, - _("The location and hierarchy of the Evolution contact " - "folders has changed since Evolution 1.x.\n\nPlease be " - "patient while Evolution migrates your folders...")); - - if (on_this_computer) - migrate_local_folders (context, on_this_computer, personal_source); - if (on_ldap_servers) - migrate_ldap_servers (context, on_ldap_servers); - - migrate_completion_folders (context); - } - - if (minor < 5 || (minor == 5 && micro <= 7)) { - dialog_set_label (context, - _("The format of mailing list contacts has changed.\n\n" - "Please be patient while Evolution migrates your " - "folders...")); - - migrate_contact_lists_for_local_folders (context, on_this_computer); - } - - if (minor < 5 || (minor == 5 && micro <= 8)) { - dialog_set_label (context, - _("The way Evolution stores some phone numbers has changed.\n\n" - "Please be patient while Evolution migrates your " - "folders...")); - - migrate_company_phone_for_local_folders (context, on_this_computer); - } - - if (minor < 5 || (minor == 5 && micro <= 10)) { - gchar *old_path, *new_path; - - dialog_set_label (context, _("Evolution's Palm Sync changelog and map files have changed.\n\n" - "Please be patient while Evolution migrates your Pilot Sync data...")); - - old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Contacts", NULL); - new_path = g_build_filename (data_dir, "local", "system", NULL); - migrate_pilot_data (old_path, new_path); - g_free (new_path); - g_free (old_path); - } - - /* we only need to do this next step if people ran - older versions of 1.5. We need to clear out the - absolute URI's that were assigned to ESources - during one phase of development, as they take - precedent over relative uris (but aren't updated - when editing an ESource). */ - if (minor == 5 && micro <= 11) { - GSList *g; - for (g = e_source_list_peek_groups (context->source_list); g; g = g->next) { - ESourceGroup *group = g->data; - GSList *s; - - for (s = e_source_group_peek_sources (group); s; s = s->next) { - ESource *source = s->data; - e_source_set_absolute_uri (source, NULL); - } - } - } - } - - if (need_dialog) - dialog_close (context); - if (on_this_computer) g_object_unref (on_this_computer); if (on_ldap_servers) diff --git a/modules/addressbook/e-book-shell-sidebar.c b/modules/addressbook/e-book-shell-sidebar.c index 24a0997173..5ff6c2902c 100644 --- a/modules/addressbook/e-book-shell-sidebar.c +++ b/modules/addressbook/e-book-shell-sidebar.c @@ -178,8 +178,8 @@ book_shell_sidebar_class_init (EBookShellSidebarClass *class) PROP_SELECTOR, g_param_spec_object ( "selector", - _("Source Selector Widget"), - _("This widget displays groups of address books"), + "Source Selector Widget", + "This widget displays groups of address books", E_TYPE_SOURCE_SELECTOR, G_PARAM_READABLE)); } diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c index 0e4b58ffb2..6bb9d7036b 100644 --- a/modules/addressbook/e-book-shell-view-actions.c +++ b/modules/addressbook/e-book-shell-view-actions.c @@ -259,6 +259,7 @@ action_address_book_save_as_cb (GtkAction *action, string = eab_suggest_filename (list); file = e_shell_run_save_dialog ( + /* Translators: This is a save dialog title */ shell, _("Save as vCard"), string, "*.vcf:text/x-vcard,text/directory", NULL, NULL); g_free (string); @@ -536,6 +537,7 @@ action_contact_save_as_cb (GtkAction *action, string = eab_suggest_filename (list); file = e_shell_run_save_dialog ( + /* Translators: This is a save dialog title */ shell, _("Save as vCard"), string, "*.vcf:text/x-vcard,text/directory", NULL, NULL); g_free (string); @@ -808,6 +810,7 @@ static EPopupActionEntry contact_popup_entries[] = { "address-book-rename" }, { "address-book-popup-save-as", + /* Translators: This is an action label */ N_("_Save as vCard..."), "address-book-save-as" }, @@ -953,7 +956,8 @@ static GtkActionEntry lockdown_save_to_disk_entries[] = { { "contact-save-as", GTK_STOCK_SAVE_AS, - N_("Save as vCard..."), + /* Translators: This is an action label */ + N_("_Save as vCard..."), NULL, N_("Save selected contacts as a vCard"), G_CALLBACK (action_contact_save_as_cb) } diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c index 3ecea2c49f..e7b1c7b0b0 100644 --- a/modules/addressbook/e-book-shell-view.c +++ b/modules/addressbook/e-book-shell-view.c @@ -299,6 +299,10 @@ book_shell_view_update_actions (EShellView *shell_view) any_contacts_selected = (single_contact_selected || multiple_contacts_selected); + action = ACTION (ADDRESS_BOOK_MOVE); + sensitive = source_is_editable; + gtk_action_set_sensitive (action, sensitive); + action = ACTION (ADDRESS_BOOK_DELETE); sensitive = can_delete_primary_source; gtk_action_set_sensitive (action, sensitive); diff --git a/modules/addressbook/eab-composer-util.c b/modules/addressbook/eab-composer-util.c index a54f5fbf7d..968a6b3c06 100644 --- a/modules/addressbook/eab-composer-util.c +++ b/modules/addressbook/eab-composer-util.c @@ -150,7 +150,7 @@ eab_send_as_attachment (GList *destinations) camel_mime_part_set_disposition (attachment, "attachment"); e_msg_composer_attach (composer, attachment); - camel_object_unref (attachment); + g_object_unref (attachment); if (destinations->next != NULL) e_composer_header_table_set_subject ( diff --git a/modules/addressbook/ldap-config.ui b/modules/addressbook/ldap-config.ui index c76031deb8..a82e4689d0 100644 --- a/modules/addressbook/ldap-config.ui +++ b/modules/addressbook/ldap-config.ui @@ -38,13 +38,13 @@ </columns> <data> <row> - <col id="0" translatable="yes">389</col> + <col id="0" translatable="no">389</col> </row> <row> - <col id="0" translatable="yes">636</col> + <col id="0" translatable="no">636</col> </row> <row> - <col id="0" translatable="yes">3268</col> + <col id="0" translatable="no">3268</col> </row> </data> </object> @@ -568,7 +568,7 @@ <child> <object class="GtkLabel" id="label575"> <property name="visible">True</property> - <property name="label" translatable="yes">1</property> + <property name="label" translatable="yes" comments="Translators: This is part of 'Timeout: 1 [slider] 5 minutes' option">1</property> </object> <packing> <property name="expand">False</property> @@ -590,7 +590,7 @@ <child> <object class="GtkLabel" id="label576"> <property name="visible">True</property> - <property name="label" translatable="yes">5</property> + <property name="label" translatable="yes" comments="Translators: This is part of 'Timeout: 1 [slider] 5 minutes' option">5</property> </object> <packing> <property name="expand">False</property> @@ -610,7 +610,7 @@ <object class="GtkLabel" id="label574"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">minutes</property> + <property name="label" translatable="yes" comments="Translators: This is part of 'Timeout: 1 [slider] 5 minutes' option">minutes</property> </object> <packing> <property name="left_attach">2</property> diff --git a/modules/calendar/Makefile.am b/modules/calendar/Makefile.am index bbabb6cfb2..0beb1285fa 100644 --- a/modules/calendar/Makefile.am +++ b/modules/calendar/Makefile.am @@ -7,6 +7,7 @@ libevolution_module_calendar_la_CPPFLAGS = \ -I$(top_srcdir) \ -I$(top_srcdir)/widgets \ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ + $(CAMEL_CFLAGS) \ $(GNOME_PLATFORM_CFLAGS) \ $(EVOLUTION_CALENDAR_CFLAGS) diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c index b532af85e5..ce88a18267 100644 --- a/modules/calendar/e-cal-attachment-handler.c +++ b/modules/calendar/e-cal-attachment-handler.c @@ -24,7 +24,7 @@ #include <glib/gi18n.h> #include <libical/ical.h> #include <libecal/e-cal.h> -#include <camel/camel-stream-mem.h> +#include <camel/camel.h> #include <libedataserverui/e-source-selector.h> #include "calendar/common/authentication.h" @@ -79,9 +79,9 @@ attachment_handler_get_component (EAttachment *attachment) buffer = g_byte_array_new (); stream = camel_stream_mem_new (); camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream), buffer); - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); + wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part)); camel_data_wrapper_decode_to_stream (wrapper, stream); - camel_object_unref (stream); + g_object_unref (stream); component = e_cal_util_parse_ics_string ((gchar *) buffer->data); diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 278190eefa..e1f682357c 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -783,8 +783,8 @@ cal_shell_backend_class_init (ECalShellBackendClass *class) PROP_SOURCE_LIST, g_param_spec_object ( "source-list", - _("Source List"), - _("The registry of calendars"), + "Source List", + "The registry of calendars", E_TYPE_SOURCE_LIST, G_PARAM_READABLE)); } diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c index 99fb717c90..a51a072f66 100644 --- a/modules/calendar/e-cal-shell-content.c +++ b/modules/calendar/e-cal-shell-content.c @@ -200,11 +200,15 @@ e_cal_shell_content_save_state (ECalShellContent *cal_shell_content) priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (cal_shell_content); - if (priv->task_table) - cal_shell_content_save_table_state (E_SHELL_CONTENT (cal_shell_content), E_TABLE (priv->task_table)); + if (priv->task_table != NULL) + cal_shell_content_save_table_state ( + E_SHELL_CONTENT (cal_shell_content), + E_TABLE (priv->task_table)); if (priv->memo_table != NULL) - cal_shell_content_save_table_state (E_SHELL_CONTENT (cal_shell_content), E_TABLE (priv->memo_table)); + cal_shell_content_save_table_state ( + E_SHELL_CONTENT (cal_shell_content), + E_TABLE (priv->memo_table)); } static void diff --git a/modules/calendar/e-cal-shell-migrate.c b/modules/calendar/e-cal-shell-migrate.c index f307522a9b..c7511f69f8 100644 --- a/modules/calendar/e-cal-shell-migrate.c +++ b/modules/calendar/e-cal-shell-migrate.c @@ -36,8 +36,6 @@ #include <libedataserver/e-source-list.h> #include <libedataserver/e-xml-hash-utils.h> -#include "e-util/e-bconf-map.h" -#include "e-util/e-folder-map.h" #include "e-util/e-util-private.h" #include "calendar/gui/calendar-config.h" #include "calendar/gui/calendar-config-keys.h" @@ -49,427 +47,6 @@ #define BAD_CONTACTS_BASE_URI "contact://" #define PERSONAL_RELATIVE_URI "system" -static e_gconf_map_t calendar_display_map[] = { - /* /Calendar/Display */ - { "Timezone", "calendar/display/timezone", E_GCONF_MAP_STRING }, - { "Use24HourFormat", "calendar/display/use_24hour_format", E_GCONF_MAP_BOOL }, - { "WeekStartDay", "calendar/display/week_start_day", E_GCONF_MAP_INT }, - { "DayStartHour", "calendar/display/day_start_hour", E_GCONF_MAP_INT }, - { "DayStartMinute", "calendar/display/day_start_minute", E_GCONF_MAP_INT }, - { "DayEndHour", "calendar/display/day_end_hour", E_GCONF_MAP_INT }, - { "DayEndMinute", "calendar/display/day_end_minute", E_GCONF_MAP_INT }, - { "TimeDivisions", "calendar/display/time_divisions", E_GCONF_MAP_INT }, - { "View", "calendar/display/default_view", E_GCONF_MAP_INT }, - { "HPanePosition", "calendar/display/hpane_position", E_GCONF_MAP_FLOAT }, - { "VPanePosition", "calendar/display/vpane_position", E_GCONF_MAP_FLOAT }, - { "MonthHPanePosition", "calendar/display/month_hpane_position", E_GCONF_MAP_FLOAT }, - { "MonthVPanePosition", "calendar/display/month_vpane_position", E_GCONF_MAP_FLOAT }, - { "CompressWeekend", "calendar/display/compress_weekend", E_GCONF_MAP_BOOL }, - { "ShowEventEndTime", "calendar/display/show_event_end", E_GCONF_MAP_BOOL }, - { "WorkingDays", "calendar/display/working_days", E_GCONF_MAP_INT }, - { NULL }, -}; - -static e_gconf_map_t calendar_other_map[] = { - /* /Calendar/Other */ - { "ConfirmDelete", "calendar/prompts/confirm_delete", E_GCONF_MAP_BOOL }, - { "ConfirmExpunge", "calendar/prompts/confirm_purge", E_GCONF_MAP_BOOL }, - { "UseDefaultReminder", "calendar/other/use_default_reminder", E_GCONF_MAP_BOOL }, - { "DefaultReminderInterval", "calendar/other/default_reminder_interval", E_GCONF_MAP_INT }, - { "DefaultReminderUnits", "calendar/other/default_reminder_units", E_GCONF_MAP_STRING }, - { NULL }, -}; - -static e_gconf_map_t calendar_datenavigator_map[] = { - /* /Calendar/DateNavigator */ - { "ShowWeekNumbers", "calendar/display/show_week_numbers", E_GCONF_MAP_BOOL }, - { NULL }, -}; - -static e_gconf_map_t calendar_alarmnotify_map[] = { - /* /Calendar/AlarmNotify */ - { "LastNotificationTime", "calendar/notify/last_notification_time", E_GCONF_MAP_INT }, - { "CalendarToLoad%i", "calendar/notify/calendars", E_GCONF_MAP_STRING|E_GCONF_MAP_LIST }, - { "BlessedProgram%i", "calendar/notify/programs", E_GCONF_MAP_STRING|E_GCONF_MAP_LIST }, - { NULL }, -}; - -static e_gconf_map_list_t calendar_remap_list[] = { - - { "/Calendar/Display", calendar_display_map }, - { "/Calendar/Other/Map", calendar_other_map }, - { "/Calendar/DateNavigator", calendar_datenavigator_map }, - { "/Calendar/AlarmNotify", calendar_alarmnotify_map }, - - { NULL }, -}; - -static GtkWidget *window; -static GtkLabel *label; -static GtkProgressBar *progress; - -#ifndef G_OS_WIN32 - -/* No previous versions have been available on Win32, so don't - * bother with upgrade support from 1.x on Win32. - */ - -static void -setup_progress_dialog (void) -{ - GtkWidget *vbox, *hbox, *w; - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title ((GtkWindow *) window, _("Migrating...")); - gtk_window_set_modal ((GtkWindow *) window, TRUE); - gtk_container_set_border_width ((GtkContainer *) window, 6); - - vbox = gtk_vbox_new (FALSE, 6); - gtk_widget_show (vbox); - gtk_container_add ((GtkContainer *) window, vbox); - - w = gtk_label_new (_("The location and hierarchy of the Evolution calendar " - "folders has changed since Evolution 1.x.\n\nPlease be " - "patient while Evolution migrates your folders...")); - - gtk_label_set_line_wrap ((GtkLabel *) w, TRUE); - gtk_widget_show (w); - gtk_box_pack_start ((GtkBox *) vbox, w, TRUE, TRUE, 0); - - hbox = gtk_hbox_new (FALSE, 6); - gtk_widget_show (hbox); - gtk_box_pack_start ((GtkBox *) vbox, hbox, TRUE, TRUE, 0); - - label = (GtkLabel *) gtk_label_new (""); - gtk_widget_show ((GtkWidget *) label); - gtk_box_pack_start ((GtkBox *) hbox, (GtkWidget *) label, TRUE, TRUE, 0); - - progress = (GtkProgressBar *) gtk_progress_bar_new (); - gtk_widget_show ((GtkWidget *) progress); - gtk_box_pack_start ((GtkBox *) hbox, (GtkWidget *) progress, TRUE, TRUE, 0); - - gtk_widget_show (window); -} - -static void -dialog_close (void) -{ - gtk_widget_destroy ((GtkWidget *) window); -} - -static void -dialog_set_folder_name (const gchar *folder_name) -{ - gchar *text; - - text = g_strdup_printf (_("Migrating '%s':"), folder_name); - gtk_label_set_text (label, text); - g_free (text); - - gtk_progress_bar_set_fraction (progress, 0.0); - - while (gtk_events_pending ()) - gtk_main_iteration (); -} - -static void -dialog_set_progress (double percent) -{ - gchar text[5]; - - snprintf (text, sizeof (text), "%d%%", (gint) (percent * 100.0f)); - - gtk_progress_bar_set_fraction (progress, percent); - gtk_progress_bar_set_text (progress, text); - - while (gtk_events_pending ()) - gtk_main_iteration (); -} - -static gboolean -check_for_conflict (ESourceGroup *group, gchar *name) -{ - GSList *sources; - GSList *s; - - sources = e_source_group_peek_sources (group); - - for (s = sources; s; s = s->next) { - ESource *source = E_SOURCE (s->data); - - if (!strcmp (e_source_peek_name (source), name)) - return TRUE; - } - - return FALSE; -} - -static gchar * -get_source_name (ESourceGroup *group, const gchar *path) -{ - gchar **p = g_strsplit (path, "/", 0); - gint i, j, starting_index; - gint num_elements; - gboolean conflict; - GString *s = g_string_new (NULL); - - for (i = 0; p[i]; i ++); - - num_elements = i; - i--; - - /* p[i] is now the last path element */ - - /* check if it conflicts */ - starting_index = i; - do { - for (j = starting_index; j < num_elements; j += 2) { - if (j != starting_index) - g_string_append_c (s, '_'); - g_string_append (s, p[j]); - } - - conflict = check_for_conflict (group, s->str); - - /* if there was a conflict back up 2 levels (skipping the /subfolder/ element) */ - if (conflict) - starting_index -= 2; - - /* we always break out if we can't go any further, - regardless of whether or not we conflict. */ - if (starting_index < 0) - break; - - } while (conflict); - g_strfreev (p); - - return g_string_free (s, FALSE); -} - -static gboolean -migrate_ical (ECal *old_ecal, ECal *new_ecal) -{ - GList *l, *objects; - gint num_added = 0; - gint num_objects; - gboolean retval = TRUE; - - /* both ecals are loaded, start the actual migration */ - if (!e_cal_get_object_list (old_ecal, "#t", &objects, NULL)) - return FALSE; - - num_objects = g_list_length (objects); - for (l = objects; l; l = l->next) { - icalcomponent *ical_comp = l->data; - GError *error = NULL; - - if (!e_cal_create_object (new_ecal, ical_comp, NULL, &error)) { - g_warning ("Migration of object failed: %s", error->message); - retval = FALSE; - } - - g_clear_error (&error); - - num_added ++; - dialog_set_progress ((double)num_added / num_objects); - } - - g_list_foreach (objects, (GFunc) icalcomponent_free, NULL); - g_list_free (objects); - - return retval; -} - -static gboolean -migrate_ical_folder_to_source (gchar *old_path, ESource *new_source, ECalSourceType type) -{ - ECal *old_ecal = NULL, *new_ecal = NULL; - ESource *old_source; - ESourceGroup *group; - gchar *old_uri = g_strdup_printf ("file://%s", old_path); - GError *error = NULL; - gboolean retval = FALSE; - - group = e_source_group_new ("", old_uri); - old_source = e_source_new ("", ""); - e_source_group_add_source (group, old_source, -1); - - dialog_set_folder_name (e_source_peek_name (new_source)); - - if (!(old_ecal = e_cal_new (old_source, type))) { - g_warning ("could not find a backend for '%s'", e_source_get_uri (old_source)); - goto finish; - } - if (!e_cal_open (old_ecal, FALSE, &error)) { - g_warning ("failed to load source ecal for migration: '%s' (%s)", error->message, - e_source_get_uri (old_source)); - goto finish; - } - - if (!(new_ecal = e_cal_new (new_source, type))) { - g_warning ("could not find a backend for '%s'", e_source_get_uri (new_source)); - goto finish; - } - if (!e_cal_open (new_ecal, FALSE, &error)) { - g_warning ("failed to load destination ecal for migration: '%s' (%s)", error->message, - e_source_get_uri (new_source)); - goto finish; - } - - retval = migrate_ical (old_ecal, new_ecal); - -finish: - g_clear_error (&error); - if (old_ecal) - g_object_unref (old_ecal); - g_object_unref (group); - if (new_ecal) - g_object_unref (new_ecal); - g_free (old_uri); - - return retval; -} - -static gboolean -migrate_ical_folder (gchar *old_path, ESourceGroup *dest_group, gchar *source_name, ECalSourceType type) -{ - ESource *new_source; - gboolean retval; - - new_source = e_source_new (source_name, source_name); - e_source_set_relative_uri (new_source, e_source_peek_uid (new_source)); - e_source_group_add_source (dest_group, new_source, -1); - - retval = migrate_ical_folder_to_source (old_path, new_source, type); - - g_object_unref (new_source); - - return retval; -} - -#endif /* !G_OS_WIN32 */ - -#ifndef G_OS_WIN32 - -static void -migrate_pilot_db_key (const gchar *key, gpointer user_data) -{ - EXmlHash *xmlhash = user_data; - - e_xmlhash_add (xmlhash, key, ""); -} - -static void -migrate_pilot_data (const gchar *component, const gchar *conduit, const gchar *old_path, const gchar *new_path) -{ - gchar *changelog, *map; - const gchar *dent; - const gchar *ext; - gchar *filename; - GDir *dir; - - if (!(dir = g_dir_open (old_path, 0, NULL))) - return; - - map = g_alloca (12 + strlen (conduit)); - sprintf (map, "pilot-map-%s-", conduit); - - changelog = g_alloca (24 + strlen (conduit)); - sprintf (changelog, "pilot-sync-evolution-%s-", conduit); - - while ((dent = g_dir_read_name (dir))) { - if (!strncmp (dent, map, strlen (map)) && - ((ext = strrchr (dent, '.')) && !strcmp (ext, ".xml"))) { - /* pilot map file - src and dest file formats are identical */ - guchar inbuf[4096]; - gsize nread, nwritten; - gint fd0, fd1; - gssize n; - - filename = g_build_filename (old_path, dent, NULL); - if ((fd0 = g_open (filename, O_RDONLY|O_BINARY, 0)) == -1) { - g_free (filename); - continue; - } - - g_free (filename); - filename = g_build_filename (new_path, dent, NULL); - if ((fd1 = g_open (filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666)) == -1) { - g_free (filename); - close (fd0); - continue; - } - - do { - do { - n = read (fd0, inbuf, sizeof (inbuf)); - } while (n == -1 && errno == EINTR); - - if (n < 1) - break; - - nread = n; - nwritten = 0; - do { - do { - n = write (fd1, inbuf + nwritten, nread - nwritten); - } while (n == -1 && errno == EINTR); - - if (n > 0) - nwritten += n; - } while (nwritten < nread && n != -1); - - if (n == -1) - break; - } while (1); - - if (n != -1) - n = fsync (fd1); - - if (n == -1) { - g_warning ("Failed to migrate %s: %s", dent, strerror (errno)); - g_unlink (filename); - } - - close (fd0); - close (fd1); - g_free (filename); - } else if (!strncmp (dent, changelog, strlen (changelog)) && - ((ext = strrchr (dent, '.')) && !strcmp (ext, ".db"))) { - /* src and dest formats differ, src format is db3 while dest format is xml */ - EXmlHash *xmlhash; - EDbHash *dbhash; - struct stat st; - - filename = g_build_filename (old_path, dent, NULL); - if (g_stat (filename, &st) == -1) { - g_free (filename); - continue; - } - - dbhash = e_dbhash_new (filename); - g_free (filename); - - filename = g_strdup_printf ("%s/%s.ics-%s", new_path, component, dent); - if (g_stat (filename, &st) != -1) - g_unlink (filename); - xmlhash = e_xmlhash_new (filename); - g_free (filename); - - e_dbhash_foreach_key (dbhash, migrate_pilot_db_key, xmlhash); - - e_dbhash_destroy (dbhash); - - e_xmlhash_write (xmlhash); - e_xmlhash_destroy (xmlhash); - } - } - - g_dir_close (dir); -} - -#endif - static ESourceGroup * create_calendar_contact_source (ESourceList *source_list) { @@ -624,7 +201,6 @@ e_cal_shell_backend_migrate (EShellBackend *shell_backend, ESourceList *source_list; ECalEvent *ece; ECalEventTargetBackend *target; - gboolean retval = FALSE; g_object_get (shell_backend, "source-list", &source_list, NULL); @@ -635,133 +211,6 @@ e_cal_shell_backend_migrate (EShellBackend *shell_backend, shell_backend, source_list, &on_this_computer, &personal_source, &on_the_web, &contacts); -#ifndef G_OS_WIN32 - if (major == 1) { - xmlDocPtr config_doc = NULL; - gchar *conf_file; - struct stat st; - - conf_file = g_build_filename (g_get_home_dir (), "evolution", "config.xmldb", NULL); - if (lstat (conf_file, &st) == 0 && S_ISREG (st.st_mode)) - config_doc = xmlParseFile (conf_file); - g_free (conf_file); - - if (config_doc && minor <= 2) { - GConfClient *gconf; - gint res = 0; - - /* move bonobo config to gconf */ - gconf = gconf_client_get_default (); - - res = e_bconf_import (gconf, config_doc, calendar_remap_list); - - g_object_unref (gconf); - - xmlFreeDoc(config_doc); - - if (res != 0) { - /* FIXME: set proper domain/code */ - g_set_error(error, 0, 0, _("Unable to migrate old settings from evolution/config.xmldb")); - goto fail; - } - } - - if (minor <= 4) { - GSList *migration_dirs, *l; - gchar *path, *local_cal_folder; - - setup_progress_dialog (); - - path = g_build_filename (g_get_home_dir (), "evolution", "local", NULL); - migration_dirs = e_folder_map_local_folders (path, "calendar"); - local_cal_folder = g_build_filename (path, "Calendar", NULL); - g_free (path); - - if (personal_source) - migrate_ical_folder_to_source (local_cal_folder, personal_source, E_CAL_SOURCE_TYPE_EVENT); - - for (l = migration_dirs; l; l = l->next) { - gchar *source_name; - - if (personal_source && !strcmp ((gchar *)l->data, local_cal_folder)) - continue; - - source_name = get_source_name (on_this_computer, (gchar *)l->data); - - if (!migrate_ical_folder (l->data, on_this_computer, source_name, E_CAL_SOURCE_TYPE_EVENT)) { - /* FIXME: domain/code */ - g_set_error(error, 0, 0, _("Unable to migrate calendar '%s'"), source_name); - g_free(source_name); - goto fail; - } - - g_free (source_name); - } - - g_free (local_cal_folder); - - dialog_close (); - } - - if (minor <= 4 || (minor == 5 && micro < 5)) { - GConfClient *gconf; - GConfValue *gconf_val; - gint i; - const gchar *keys[] = { - CALENDAR_CONFIG_HPANE_POS, - CALENDAR_CONFIG_VPANE_POS, - CALENDAR_CONFIG_MONTH_HPANE_POS, - CALENDAR_CONFIG_MONTH_VPANE_POS, - NULL - }; - - gconf = gconf_client_get_default (); - - for (i = 0; keys[i]; i++) { - gconf_val = gconf_client_get (gconf, keys[i], NULL); - if (gconf_val) { - if (gconf_val->type != GCONF_VALUE_INT) - gconf_client_unset (gconf, keys[i], NULL); - gconf_value_free (gconf_val); - } - } - - g_object_unref (gconf); - } - - if (minor < 5 || (minor == 5 && micro <= 10)) { - gchar *old_path, *new_path; - - old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Calendar", NULL); - new_path = g_build_filename (e_shell_backend_get_data_dir (shell_backend), - "local", "system", NULL); - migrate_pilot_data ("calendar", "calendar", old_path, new_path); - g_free (new_path); - g_free (old_path); - } - - /* we only need to do this next step if people ran - older versions of 1.5. We need to clear out the - absolute URI's that were assigned to ESources - during one phase of development, as they take - precedent over relative uris (but aren't updated - when editing an ESource). */ - if (minor == 5 && micro <= 11) { - GSList *g; - for (g = e_source_list_peek_groups (source_list); g; g = g->next) { - ESourceGroup *group = g->data; - GSList *s; - - for (s = e_source_group_peek_sources (group); s; s = s->next) { - ESource *source = s->data; - e_source_set_absolute_uri (source, NULL); - } - } - } - - } -#endif /* !G_OS_WIN32 */ - e_source_list_sync (source_list, NULL); /** @Event: component.migration @@ -778,8 +227,6 @@ e_cal_shell_backend_migrate (EShellBackend *shell_backend, target = e_cal_event_target_new_module (ece, shell_backend, source_list, 0); e_event_emit ((EEvent *) ece, "module.migration", (EEventTarget *) target); - retval = TRUE; -fail: if (on_this_computer) g_object_unref (on_this_computer); if (on_the_web) @@ -789,6 +236,6 @@ fail: if (personal_source) g_object_unref (personal_source); - return retval; + return TRUE; } diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c index 4545c88c3a..9491d3fee2 100644 --- a/modules/calendar/e-cal-shell-sidebar.c +++ b/modules/calendar/e-cal-shell-sidebar.c @@ -278,9 +278,15 @@ static void cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar, ESource *source) { + EShellView *shell_view; + EShellContent *shell_content; + EShellSidebar *shell_sidebar; + ECalShellContent *cal_shell_content; ECalSourceType source_type; GHashTable *client_table; + ECalModel *model; ECal *client; + icaltimezone *timezone; const gchar *uid; source_type = E_CAL_SOURCE_TYPE_EVENT; @@ -305,7 +311,17 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar, G_CALLBACK (cal_shell_sidebar_default_opened_cb), cal_shell_sidebar); - e_cal_set_default_timezone (client, e_cal_model_get_timezone (e_cal_shell_content_get_model (E_CAL_SHELL_CONTENT (e_shell_view_get_shell_content (e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (cal_shell_sidebar)))))), NULL); + /* FIXME Sidebar should not be accessing the EShellContent. + * This probably needs to be moved to ECalShellView. */ + shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar); + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + + cal_shell_content = E_CAL_SHELL_CONTENT (shell_content); + model = e_cal_shell_content_get_model (cal_shell_content); + timezone = e_cal_model_get_timezone (model); + + e_cal_set_default_timezone (client, timezone, NULL); e_cal_open_async (client, FALSE); } @@ -771,8 +787,8 @@ cal_shell_sidebar_class_init (ECalShellSidebarClass *class) PROP_DATE_NAVIGATOR, g_param_spec_object ( "date-navigator", - _("Date Navigator Widget"), - _("This widget displays a miniature calendar"), + "Date Navigator Widget", + "This widget displays a miniature calendar", E_TYPE_CALENDAR, G_PARAM_READABLE)); @@ -781,8 +797,8 @@ cal_shell_sidebar_class_init (ECalShellSidebarClass *class) PROP_DEFAULT_CLIENT, g_param_spec_object ( "default-client", - _("Default Calendar Client"), - _("Default client for calendar operations"), + "Default Calendar Client", + "Default client for calendar operations", E_TYPE_CAL, G_PARAM_READABLE)); @@ -791,8 +807,8 @@ cal_shell_sidebar_class_init (ECalShellSidebarClass *class) PROP_SELECTOR, g_param_spec_object ( "selector", - _("Source Selector Widget"), - _("This widget displays groups of calendars"), + "Source Selector Widget", + "This widget displays groups of calendars", E_TYPE_SOURCE_SELECTOR, G_PARAM_READABLE)); @@ -926,11 +942,17 @@ void e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar, ESource *source) { + EShellView *shell_view; + EShellContent *shell_content; + EShellSidebar *shell_sidebar; + ECalShellContent *cal_shell_content; ECalSourceType source_type; ESourceSelector *selector; GHashTable *client_table; + ECalModel *model; ECal *default_client; ECal *client; + icaltimezone *timezone; const gchar *uid; const gchar *uri; gchar *message; @@ -989,7 +1011,17 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar, G_CALLBACK (cal_shell_sidebar_client_opened_cb), cal_shell_sidebar); - e_cal_set_default_timezone (client, e_cal_model_get_timezone (e_cal_shell_content_get_model (E_CAL_SHELL_CONTENT (e_shell_view_get_shell_content (e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (cal_shell_sidebar)))))), NULL); + /* FIXME Sidebar should not be accessing the EShellContent. + * This probably needs to be moved to ECalShellView. */ + shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar); + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + + cal_shell_content = E_CAL_SHELL_CONTENT (shell_content); + model = e_cal_shell_content_get_model (cal_shell_content); + timezone = e_cal_model_get_timezone (model); + + e_cal_set_default_timezone (client, timezone, NULL); e_cal_open_async (client, FALSE); } diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c index 9510f066ef..19812751d8 100644 --- a/modules/calendar/e-cal-shell-view-actions.c +++ b/modules/calendar/e-cal-shell-view-actions.c @@ -512,7 +512,7 @@ action_event_copy_cb (GtkAction *action, if (selected->data) { ECalendarViewEvent *event = selected->data; - if (event && event->comp_data && event->comp_data->client) + if (is_comp_data_valid (event) && event->comp_data->client) source_source = e_cal_get_source (event->comp_data->client); } @@ -577,6 +577,10 @@ action_event_delegate_cb (GtkAction *action, g_return_if_fail (g_list_length (selected) == 1); event = selected->data; + + if (!is_comp_data_valid (event)) + return; + client = event->comp_data->client; clone = icalcomponent_new_clone (event->comp_data->icalcomp); @@ -707,6 +711,10 @@ action_event_forward_cb (GtkAction *action, g_return_if_fail (g_list_length (selected) == 1); event = selected->data; + + if (!is_comp_data_valid (event)) + return; + client = event->comp_data->client; icalcomp = event->comp_data->icalcomp; @@ -774,7 +782,7 @@ action_event_move_cb (GtkAction *action, if (selected->data) { ECalendarViewEvent *event = selected->data; - if (event && event->comp_data && event->comp_data->client) + if (is_comp_data_valid (event) && event->comp_data->client) source_source = e_cal_get_source (event->comp_data->client); } @@ -863,6 +871,10 @@ action_event_occurrence_movable_cb (GtkAction *action, g_return_if_fail (g_list_length (selected) == 1); event = selected->data; + + if (!is_comp_data_valid (event)) + return; + client = event->comp_data->client; icalcomp = event->comp_data->icalcomp; @@ -961,6 +973,10 @@ action_event_print_cb (GtkAction *action, g_return_if_fail (g_list_length (selected) == 1); event = selected->data; + + if (!is_comp_data_valid (event)) + return; + client = event->comp_data->client; icalcomp = event->comp_data->icalcomp; @@ -1000,6 +1016,10 @@ action_event_reply_cb (GtkAction *action, g_return_if_fail (g_list_length (selected) == 1); event = selected->data; + + if (!is_comp_data_valid (event)) + return; + client = event->comp_data->client; icalcomp = event->comp_data->icalcomp; @@ -1040,6 +1060,10 @@ action_event_reply_all_cb (GtkAction *action, g_return_if_fail (g_list_length (selected) == 1); event = selected->data; + + if (!is_comp_data_valid (event)) + return; + client = event->comp_data->client; icalcomp = event->comp_data->icalcomp; @@ -1090,6 +1114,10 @@ action_event_save_as_cb (GtkAction *action, g_return_if_fail (g_list_length (selected) == 1); event = selected->data; + + if (!is_comp_data_valid (event)) + return; + client = event->comp_data->client; icalcomp = event->comp_data->icalcomp; @@ -1148,6 +1176,10 @@ edit_event_as (ECalShellView *cal_shell_view, gboolean as_meeting) g_return_if_fail (g_list_length (selected) == 1); event = selected->data; + + if (!is_comp_data_valid (event)) + return; + client = event->comp_data->client; icalcomp = event->comp_data->icalcomp; @@ -1216,6 +1248,26 @@ quit_calendar_cb (GtkAction *action, } static void +quit_calendar_cb (GtkAction *action, + ECalShellView *cal_shell_view) +{ + EShellView *shell_view; + EShellWindow *shell_window; + GdkEvent *event; + + shell_view = E_SHELL_VIEW (cal_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + + /* Synthesize a delete_event on this window. */ + event = gdk_event_new (GDK_DELETE); + event->any.window = g_object_ref (gtk_widget_get_window (GTK_WIDGET (shell_window))); + event->any.send_event = TRUE; + gtk_main_do_event (event); + gdk_event_free (event); + +} + +static void action_event_schedule_appointment_cb (GtkAction *action, ECalShellView *cal_shell_view) { diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c index 43b8ae61cd..11b6ec243d 100644 --- a/modules/calendar/e-cal-shell-view-private.c +++ b/modules/calendar/e-cal-shell-view-private.c @@ -690,6 +690,10 @@ e_cal_shell_view_private_dispose (ECalShellView *cal_shell_view) if (priv->cal_shell_content) e_cal_shell_content_save_state (priv->cal_shell_content); + /* Calling calendar's save state from here, because it is too late in its dispose */ + if (priv->cal_shell_content) + e_cal_shell_content_save_state (priv->cal_shell_content); + DISPOSE (priv->cal_shell_backend); DISPOSE (priv->cal_shell_content); DISPOSE (priv->cal_shell_sidebar); @@ -834,6 +838,9 @@ e_cal_shell_view_transfer_item_to (ECalShellView *cal_shell_view, g_return_if_fail (event != NULL); g_return_if_fail (E_IS_CAL (destination_client)); + if (!is_comp_data_valid (event)) + return; + icalcomp_event = event->comp_data->icalcomp; uid = icalcomponent_get_uid (icalcomp_event); diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c index c4f52de83a..218bd7d4da 100644 --- a/modules/calendar/e-cal-shell-view.c +++ b/modules/calendar/e-cal-shell-view.c @@ -341,7 +341,7 @@ cal_shell_view_update_actions (EShellView *shell_view) gboolean user_org = FALSE; gboolean read_only = TRUE; - if (!event || !event->comp_data) + if (!is_comp_data_valid (event)) continue; client = event->comp_data->client; @@ -497,6 +497,10 @@ cal_shell_view_class_init (ECalShellViewClass *class, shell_view_class->new_shell_sidebar = e_cal_shell_sidebar_new; shell_view_class->execute_search = cal_shell_view_execute_search; shell_view_class->update_actions = cal_shell_view_update_actions; + + if (e_shell_get_express_mode(e_shell_get_default())) + shell_view_class->construct_searchbar = NULL; + } static void diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index b0635b6e38..a51a5fc98e 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -584,8 +584,8 @@ memo_shell_backend_class_init (EMemoShellBackendClass *class) PROP_SOURCE_LIST, g_param_spec_object ( "source-list", - _("Source List"), - _("The registry of memo lists"), + "Source List", + "The registry of memo lists", E_TYPE_SOURCE_LIST, G_PARAM_READABLE)); } diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c index d56a6105d1..279f063035 100644 --- a/modules/calendar/e-memo-shell-content.c +++ b/modules/calendar/e-memo-shell-content.c @@ -604,8 +604,8 @@ memo_shell_content_class_init (EMemoShellContentClass *class) PROP_MODEL, g_param_spec_object ( "model", - _("Model"), - _("The memo table model"), + "Model", + "The memo table model", E_TYPE_CAL_MODEL, G_PARAM_READABLE)); @@ -614,8 +614,8 @@ memo_shell_content_class_init (EMemoShellContentClass *class) PROP_PREVIEW_VISIBLE, g_param_spec_boolean ( "preview-visible", - _("Preview is Visible"), - _("Whether the preview pane is visible"), + "Preview is Visible", + "Whether the preview pane is visible", TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c index 3c52672063..771a889845 100644 --- a/modules/calendar/e-memo-shell-migrate.c +++ b/modules/calendar/e-memo-shell-migrate.c @@ -23,7 +23,7 @@ #include <string.h> #include <glib/gi18n.h> -#include <camel/camel-url.h> +#include <camel/camel.h> #include <libedataserver/e-account.h> #include <libedataserver/e-account-list.h> #include <libedataserver/e-source.h> diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index 3e14f6a9c0..416759213e 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -272,9 +272,15 @@ static void memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar, ESource *source) { + EShellView *shell_view; + EShellContent *shell_content; + EShellSidebar *shell_sidebar; + EMemoShellContent *memo_shell_content; ECalSourceType source_type; GHashTable *client_table; + ECalModel *model; ECal *client; + icaltimezone *timezone; const gchar *uid; source_type = E_CAL_SOURCE_TYPE_JOURNAL; @@ -299,7 +305,17 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar, G_CALLBACK (memo_shell_sidebar_default_opened_cb), memo_shell_sidebar); - e_cal_set_default_timezone (client, e_cal_model_get_timezone (e_memo_shell_content_get_memo_model (E_MEMO_SHELL_CONTENT (e_shell_view_get_shell_content (e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (memo_shell_sidebar)))))), NULL); + /* FIXME Sidebar should not be accessing the EShellContent. + * This probably needs to be moved to EMemoShellView. */ + shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar); + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + + memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content); + model = e_memo_shell_content_get_memo_model (memo_shell_content); + timezone = e_cal_model_get_timezone (model); + + e_cal_set_default_timezone (client, timezone, NULL); e_cal_open_async (client, FALSE); } @@ -676,8 +692,8 @@ memo_shell_sidebar_class_init (EMemoShellSidebarClass *class) PROP_DEFAULT_CLIENT, g_param_spec_object ( "default-client", - _("Default Memo Client"), - _("Default client for memo operations"), + "Default Memo Client", + "Default client for memo operations", E_TYPE_CAL, G_PARAM_READABLE)); @@ -686,8 +702,8 @@ memo_shell_sidebar_class_init (EMemoShellSidebarClass *class) PROP_SELECTOR, g_param_spec_object ( "selector", - _("Source Selector Widget"), - _("This widget displays groups of memo lists"), + "Source Selector Widget", + "This widget displays groups of memo lists", E_TYPE_SOURCE_SELECTOR, G_PARAM_READABLE)); @@ -813,11 +829,17 @@ void e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar, ESource *source) { + EShellView *shell_view; + EShellContent *shell_content; + EShellSidebar *shell_sidebar; + EMemoShellContent *memo_shell_content; ECalSourceType source_type; ESourceSelector *selector; GHashTable *client_table; + ECalModel *model; ECal *default_client; ECal *client; + icaltimezone *timezone; const gchar *uid; const gchar *uri; gchar *message; @@ -876,7 +898,17 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar, G_CALLBACK (memo_shell_sidebar_client_opened_cb), memo_shell_sidebar); - e_cal_set_default_timezone (client, e_cal_model_get_timezone (e_memo_shell_content_get_memo_model (E_MEMO_SHELL_CONTENT (e_shell_view_get_shell_content (e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (memo_shell_sidebar)))))), NULL); + /* FIXME Sidebar should not be accessing the EShellContent. + * This probably needs to be moved to EMemoShellView. */ + shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar); + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + + memo_shell_content = E_MEMO_SHELL_CONTENT (shell_content); + model = e_memo_shell_content_get_memo_model (memo_shell_content); + timezone = e_cal_model_get_timezone (model); + + e_cal_set_default_timezone (client, timezone, NULL); e_cal_open_async (client, FALSE); } diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c index e428c9413e..c5f0a9927a 100644 --- a/modules/calendar/e-task-shell-backend.c +++ b/modules/calendar/e-task-shell-backend.c @@ -594,8 +594,8 @@ task_shell_backend_class_init (ETaskShellBackendClass *class) PROP_SOURCE_LIST, g_param_spec_object ( "source-list", - _("Source List"), - _("The registry of task lists"), + "Source List", + "The registry of task lists", E_TYPE_SOURCE_LIST, G_PARAM_READABLE)); } diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index 910b4da48e..fdbfa758a4 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -626,8 +626,8 @@ task_shell_content_class_init (ETaskShellContentClass *class) PROP_MODEL, g_param_spec_object ( "model", - _("Model"), - _("The task table model"), + "Model", + "The task table model", E_TYPE_CAL_MODEL, G_PARAM_READABLE)); @@ -636,8 +636,8 @@ task_shell_content_class_init (ETaskShellContentClass *class) PROP_PREVIEW_VISIBLE, g_param_spec_boolean ( "preview-visible", - _("Preview is Visible"), - _("Whether the preview pane is visible"), + "Preview is Visible", + "Whether the preview pane is visible", TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); diff --git a/modules/calendar/e-task-shell-migrate.c b/modules/calendar/e-task-shell-migrate.c index 3c3210b472..9fe9870c73 100644 --- a/modules/calendar/e-task-shell-migrate.c +++ b/modules/calendar/e-task-shell-migrate.c @@ -37,8 +37,6 @@ #include <libedataserver/e-xml-hash-utils.h> #include <libedataserver/e-xml-utils.h> -#include "e-util/e-bconf-map.h" -#include "e-util/e-folder-map.h" #include "e-util/e-util-private.h" #include "calendar/gui/calendar-config.h" #include "calendar/gui/calendar-config-keys.h" @@ -47,396 +45,6 @@ #define WEBCAL_BASE_URI "webcal://" #define PERSONAL_RELATIVE_URI "system" -static e_gconf_map_t calendar_tasks_map[] = { - /* /Calendar/Tasks */ - { "HideCompletedTasks", "calendar/tasks/hide_completed", E_GCONF_MAP_BOOL }, - { "HideCompletedTasksUnits", "calendar/tasks/hide_completed_units", E_GCONF_MAP_STRING }, - { "HideCompletedTasksValue", "calendar/tasks/hide_completed_value", E_GCONF_MAP_INT }, - { NULL }, -}; - -static e_gconf_map_t calendar_tasks_colours_map[] = { - /* /Calendar/Tasks/Colors */ - { "TasksDueToday", "calendar/tasks/colors/due_today", E_GCONF_MAP_STRING }, - { "TasksOverDue", "calendar/tasks/colors/overdue", E_GCONF_MAP_STRING }, - { "TasksDueToday", "calendar/tasks/colors/due_today", E_GCONF_MAP_STRING }, - { NULL }, -}; - -static e_gconf_map_list_t task_remap_list[] = { - - { "/Calendar/Tasks", calendar_tasks_map }, - { "/Calendar/Tasks/Colors", calendar_tasks_colours_map }, - - { NULL }, -}; - -static GtkWidget *window; -static GtkLabel *label; -static GtkProgressBar *progress; - -#ifndef G_OS_WIN32 - -/* No previous versions have been available on Win32, so don't - * bother with upgrade support from 1.x on Win32. - */ - -static void -setup_progress_dialog (void) -{ - GtkWidget *vbox, *hbox, *w; - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title ((GtkWindow *) window, _("Migrating...")); - gtk_window_set_modal ((GtkWindow *) window, TRUE); - gtk_container_set_border_width ((GtkContainer *) window, 6); - - vbox = gtk_vbox_new (FALSE, 6); - gtk_widget_show (vbox); - gtk_container_add ((GtkContainer *) window, vbox); - - w = gtk_label_new (_("The location and hierarchy of the Evolution task " - "folders has changed since Evolution 1.x.\n\nPlease be " - "patient while Evolution migrates your folders...")); - - gtk_label_set_line_wrap ((GtkLabel *) w, TRUE); - gtk_widget_show (w); - gtk_box_pack_start ((GtkBox *) vbox, w, TRUE, TRUE, 0); - - hbox = gtk_hbox_new (FALSE, 6); - gtk_widget_show (hbox); - gtk_box_pack_start ((GtkBox *) vbox, hbox, TRUE, TRUE, 0); - - label = (GtkLabel *) gtk_label_new (""); - gtk_widget_show ((GtkWidget *) label); - gtk_box_pack_start ((GtkBox *) hbox, (GtkWidget *) label, TRUE, TRUE, 0); - - progress = (GtkProgressBar *) gtk_progress_bar_new (); - gtk_widget_show ((GtkWidget *) progress); - gtk_box_pack_start ((GtkBox *) hbox, (GtkWidget *) progress, TRUE, TRUE, 0); - - gtk_widget_show (window); -} - -static void -dialog_close (void) -{ - gtk_widget_destroy ((GtkWidget *) window); -} - -static void -dialog_set_folder_name (const gchar *folder_name) -{ - gchar *text; - - text = g_strdup_printf (_("Migrating '%s':"), folder_name); - gtk_label_set_text (label, text); - g_free (text); - - gtk_progress_bar_set_fraction (progress, 0.0); - - while (gtk_events_pending ()) - gtk_main_iteration (); -} - -static void -dialog_set_progress (double percent) -{ - gchar text[5]; - - snprintf (text, sizeof (text), "%d%%", (gint) (percent * 100.0f)); - - gtk_progress_bar_set_fraction (progress, percent); - gtk_progress_bar_set_text (progress, text); - - while (gtk_events_pending ()) - gtk_main_iteration (); -} - -static gboolean -check_for_conflict (ESourceGroup *group, gchar *name) -{ - GSList *sources; - GSList *s; - - sources = e_source_group_peek_sources (group); - - for (s = sources; s; s = s->next) { - ESource *source = E_SOURCE (s->data); - - if (!strcmp (e_source_peek_name (source), name)) - return TRUE; - } - - return FALSE; -} - -static gchar * -get_source_name (ESourceGroup *group, const gchar *path) -{ - gchar **p = g_strsplit (path, "/", 0); - gint i, j, starting_index; - gint num_elements; - gboolean conflict; - GString *s = g_string_new (NULL); - - for (i = 0; p[i]; i ++); - - num_elements = i; - i--; - - /* p[i] is now the last path element */ - - /* check if it conflicts */ - starting_index = i; - do { - for (j = starting_index; j < num_elements; j += 2) { - if (j != starting_index) - g_string_append_c (s, '_'); - g_string_append (s, p[j]); - } - - conflict = check_for_conflict (group, s->str); - - /* if there was a conflict back up 2 levels (skipping the /subfolder/ element) */ - if (conflict) - starting_index -= 2; - - /* we always break out if we can't go any further, - regardless of whether or not we conflict. */ - if (starting_index < 0) - break; - - } while (conflict); - g_strfreev (p); - - return g_string_free (s, FALSE); -} - -static gboolean -migrate_ical (ECal *old_ecal, ECal *new_ecal) -{ - GList *l, *objects; - gint num_added = 0; - gint num_objects; - gboolean retval = TRUE; - - /* both ecals are loaded, start the actual migration */ - if (!e_cal_get_object_list (old_ecal, "#t", &objects, NULL)) - return FALSE; - - num_objects = g_list_length (objects); - for (l = objects; l; l = l->next) { - icalcomponent *ical_comp = l->data; - GError *error = NULL; - - if (!e_cal_create_object (new_ecal, ical_comp, NULL, &error)) { - g_warning ("Migration of object failed: %s", error->message); - retval = FALSE; - } - - g_clear_error (&error); - - num_added ++; - dialog_set_progress ((double)num_added / num_objects); - } - - g_list_foreach (objects, (GFunc) icalcomponent_free, NULL); - g_list_free (objects); - - return retval; -} - -static gboolean -migrate_ical_folder_to_source (gchar *old_path, ESource *new_source, ECalSourceType type) -{ - ECal *old_ecal = NULL, *new_ecal = NULL; - ESource *old_source; - ESourceGroup *group; - gchar *old_uri = g_strdup_printf ("file://%s", old_path); - GError *error = NULL; - gboolean retval = FALSE; - - group = e_source_group_new ("", old_uri); - old_source = e_source_new ("", ""); - e_source_group_add_source (group, old_source, -1); - - dialog_set_folder_name (e_source_peek_name (new_source)); - - if (!(old_ecal = e_cal_new (old_source, type))) { - g_warning ("could not find a backend for '%s'", e_source_get_uri (old_source)); - goto finish; - } - if (!e_cal_open (old_ecal, FALSE, &error)) { - g_warning ("failed to load source ecal for migration: '%s' (%s)", error->message, - e_source_get_uri (old_source)); - goto finish; - } - - if (!(new_ecal = e_cal_new (new_source, type))) { - g_warning ("could not find a backend for '%s'", e_source_get_uri (new_source)); - goto finish; - } - if (!e_cal_open (new_ecal, FALSE, &error)) { - g_warning ("failed to load destination ecal for migration: '%s' (%s)", error->message, - e_source_get_uri (new_source)); - goto finish; - } - - retval = migrate_ical (old_ecal, new_ecal); - -finish: - g_clear_error (&error); - if (old_ecal) - g_object_unref (old_ecal); - g_object_unref (group); - if (new_ecal) - g_object_unref (new_ecal); - g_free (old_uri); - - return retval; -} - -static gboolean -migrate_ical_folder (gchar *old_path, ESourceGroup *dest_group, gchar *source_name, ECalSourceType type) -{ - ESource *new_source; - gboolean retval; - - new_source = e_source_new (source_name, source_name); - e_source_set_relative_uri (new_source, e_source_peek_uid (new_source)); - e_source_group_add_source (dest_group, new_source, -1); - - retval = migrate_ical_folder_to_source (old_path, new_source, type); - - g_object_unref (new_source); - - return retval; -} - -#endif /* !G_OS_WIN32 */ - -#ifndef G_OS_WIN32 - -static void -migrate_pilot_db_key (const gchar *key, gpointer user_data) -{ - EXmlHash *xmlhash = user_data; - - e_xmlhash_add (xmlhash, key, ""); -} - -static void -migrate_pilot_data (const gchar *component, const gchar *conduit, const gchar *old_path, const gchar *new_path) -{ - gchar *changelog, *map; - const gchar *dent; - const gchar *ext; - gchar *filename; - GDir *dir; - - if (!(dir = g_dir_open (old_path, 0, NULL))) - return; - - map = g_alloca (12 + strlen (conduit)); - sprintf (map, "pilot-map-%s-", conduit); - - changelog = g_alloca (24 + strlen (conduit)); - sprintf (changelog, "pilot-sync-evolution-%s-", conduit); - - while ((dent = g_dir_read_name (dir))) { - if (!strncmp (dent, map, strlen (map)) && - ((ext = strrchr (dent, '.')) && !strcmp (ext, ".xml"))) { - /* pilot map file - src and dest file formats are identical */ - guchar inbuf[4096]; - gsize nread, nwritten; - gint fd0, fd1; - gssize n; - - filename = g_build_filename (old_path, dent, NULL); - if ((fd0 = g_open (filename, O_RDONLY|O_BINARY, 0)) == -1) { - g_free (filename); - continue; - } - - g_free (filename); - filename = g_build_filename (new_path, dent, NULL); - if ((fd1 = g_open (filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666)) == -1) { - g_free (filename); - close (fd0); - continue; - } - - do { - do { - n = read (fd0, inbuf, sizeof (inbuf)); - } while (n == -1 && errno == EINTR); - - if (n < 1) - break; - - nread = n; - nwritten = 0; - do { - do { - n = write (fd1, inbuf + nwritten, nread - nwritten); - } while (n == -1 && errno == EINTR); - - if (n > 0) - nwritten += n; - } while (nwritten < nread && n != -1); - - if (n == -1) - break; - } while (1); - - if (n != -1) - n = fsync (fd1); - - if (n == -1) { - g_warning ("Failed to migrate %s: %s", dent, strerror (errno)); - g_unlink (filename); - } - - close (fd0); - close (fd1); - g_free (filename); - } else if (!strncmp (dent, changelog, strlen (changelog)) && - ((ext = strrchr (dent, '.')) && !strcmp (ext, ".db"))) { - /* src and dest formats differ, src format is db3 while dest format is xml */ - EXmlHash *xmlhash; - EDbHash *dbhash; - struct stat st; - - filename = g_build_filename (old_path, dent, NULL); - if (g_stat (filename, &st) == -1) { - g_free (filename); - continue; - } - - dbhash = e_dbhash_new (filename); - g_free (filename); - - filename = g_strdup_printf ("%s/%s.ics-%s", new_path, component, dent); - if (g_stat (filename, &st) != -1) - g_unlink (filename); - xmlhash = e_xmlhash_new (filename); - g_free (filename); - - e_dbhash_foreach_key (dbhash, migrate_pilot_db_key, xmlhash); - - e_dbhash_destroy (dbhash); - - e_xmlhash_write (xmlhash); - e_xmlhash_destroy (xmlhash); - } - } - - g_dir_close (dir); -} - -#endif - static void create_task_sources (EShellBackend *shell_backend, ESourceList *source_list, @@ -553,7 +161,6 @@ e_task_shell_backend_migrate (EShellBackend *shell_backend, ESourceGroup *on_the_web = NULL; ESource *personal_source = NULL; ESourceList *source_list; - gboolean retval = FALSE; g_object_get (shell_backend, "source-list", &source_list, NULL); @@ -564,106 +171,8 @@ e_task_shell_backend_migrate (EShellBackend *shell_backend, shell_backend, source_list, &on_this_computer, &on_the_web, &personal_source); -#ifndef G_OS_WIN32 - if (major == 1) { - xmlDocPtr config_doc = NULL; - gchar *conf_file; - - conf_file = g_build_filename (g_get_home_dir (), "evolution", "config.xmldb", NULL); - if (g_file_test (conf_file, G_FILE_TEST_IS_REGULAR)) - config_doc = e_xml_parse_file (conf_file); - g_free (conf_file); - - if (config_doc && minor <= 2) { - GConfClient *gconf; - gint res = 0; - - /* move bonobo config to gconf */ - gconf = gconf_client_get_default (); - - res = e_bconf_import (gconf, config_doc, task_remap_list); - - g_object_unref (gconf); - - xmlFreeDoc(config_doc); - - if (res != 0) { - g_set_error(error, 0, 0, _("Unable to migrate old settings from evolution/config.xmldb")); - goto fail; - } - } - - if (minor <= 4) { - GSList *migration_dirs, *l; - gchar *path, *local_task_folder; - - setup_progress_dialog (); - - path = g_build_filename (g_get_home_dir (), "evolution", "local", NULL); - migration_dirs = e_folder_map_local_folders (path, "tasks"); - local_task_folder = g_build_filename (path, "Tasks", NULL); - g_free (path); - - if (personal_source) - migrate_ical_folder_to_source (local_task_folder, personal_source, E_CAL_SOURCE_TYPE_TODO); - - for (l = migration_dirs; l; l = l->next) { - gchar *source_name; - - if (personal_source && !strcmp ((gchar *)l->data, local_task_folder)) - continue; - - source_name = get_source_name (on_this_computer, (gchar *)l->data); - - if (!migrate_ical_folder (l->data, on_this_computer, source_name, E_CAL_SOURCE_TYPE_TODO)) { - /* FIXME: domain/code */ - g_set_error(error, 0, 0, _("Unable to migrate tasks '%s'"), source_name); - g_free(source_name); - goto fail; - } - - g_free (source_name); - } - - g_free (local_task_folder); - - dialog_close (); - } - - if (minor < 5 || (minor == 5 && micro <= 10)) { - gchar *old_path, *new_path; - - old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Tasks", NULL); - new_path = g_build_filename (e_shell_backend_get_data_dir (shell_backend), - "local", "system", NULL); - migrate_pilot_data ("tasks", "todo", old_path, new_path); - g_free (new_path); - g_free (old_path); - } - - /* we only need to do this next step if people ran - older versions of 1.5. We need to clear out the - absolute URI's that were assigned to ESources - during one phase of development, as they take - precedent over relative uris (but aren't updated - when editing an ESource). */ - if (minor == 5 && micro <= 11) { - GSList *g; - for (g = e_source_list_peek_groups (source_list); g; g = g->next) { - ESourceGroup *group = g->data; - GSList *s; - - for (s = e_source_group_peek_sources (group); s; s = s->next) { - ESource *source = s->data; - e_source_set_absolute_uri (source, NULL); - } - } - } - } -#endif /* !G_OS_WIN32 */ e_source_list_sync (source_list, NULL); - retval = TRUE; -fail: + if (on_this_computer) g_object_unref (on_this_computer); if (on_the_web) @@ -671,5 +180,5 @@ fail: if (personal_source) g_object_unref (personal_source); - return retval; + return TRUE; } diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c index 87127ba634..07eb43bdbf 100644 --- a/modules/calendar/e-task-shell-sidebar.c +++ b/modules/calendar/e-task-shell-sidebar.c @@ -272,9 +272,15 @@ static void task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar, ESource *source) { + EShellView *shell_view; + EShellContent *shell_content; + EShellSidebar *shell_sidebar; + ETaskShellContent *task_shell_content; ECalSourceType source_type; GHashTable *client_table; + ECalModel *model; ECal *client; + icaltimezone *timezone; const gchar *uid; source_type = E_CAL_SOURCE_TYPE_TODO; @@ -299,7 +305,17 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar, G_CALLBACK (task_shell_sidebar_default_opened_cb), task_shell_sidebar); - e_cal_set_default_timezone (client, e_cal_model_get_timezone (e_task_shell_content_get_task_model (E_TASK_SHELL_CONTENT (e_shell_view_get_shell_content (e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (task_shell_sidebar)))))), NULL); + /* FIXME Sidebar should not be accessing the EShellContent. + * This probably needs to be moved to ETaskShellView. */ + shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar); + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + + task_shell_content = E_TASK_SHELL_CONTENT (shell_content); + model = e_task_shell_content_get_task_model (task_shell_content); + timezone = e_cal_model_get_timezone (model); + + e_cal_set_default_timezone (client, timezone, NULL); e_cal_open_async (client, FALSE); } @@ -676,8 +692,8 @@ task_shell_sidebar_class_init (ETaskShellSidebarClass *class) PROP_DEFAULT_CLIENT, g_param_spec_object ( "default-client", - _("Default Task Client"), - _("Default client for task operations"), + "Default Task Client", + "Default client for task operations", E_TYPE_CAL, G_PARAM_READABLE)); @@ -686,8 +702,8 @@ task_shell_sidebar_class_init (ETaskShellSidebarClass *class) PROP_SELECTOR, g_param_spec_object ( "selector", - _("Source Selector Widget"), - _("This widget displays groups of task lists"), + "Source Selector Widget", + "This widget displays groups of task lists", E_TYPE_SOURCE_SELECTOR, G_PARAM_READABLE)); @@ -813,11 +829,17 @@ void e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar, ESource *source) { + EShellView *shell_view; + EShellContent *shell_content; + EShellSidebar *shell_sidebar; + ETaskShellContent *task_shell_content; ECalSourceType source_type; ESourceSelector *selector; GHashTable *client_table; + ECalModel *model; ECal *default_client; ECal *client; + icaltimezone *timezone; const gchar *uid; const gchar *uri; gchar *message; @@ -876,7 +898,17 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar, G_CALLBACK (task_shell_sidebar_client_opened_cb), task_shell_sidebar); - e_cal_set_default_timezone (client, e_cal_model_get_timezone (e_task_shell_content_get_task_model (E_TASK_SHELL_CONTENT (e_shell_view_get_shell_content (e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (task_shell_sidebar)))))), NULL); + /* FIXME Sidebar should not be accessing the EShellContent. + * This probably needs to be moved to ETaskShellView. */ + shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar); + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_content = e_shell_view_get_shell_content (shell_view); + + task_shell_content = E_TASK_SHELL_CONTENT (shell_content); + model = e_task_shell_content_get_task_model (task_shell_content); + timezone = e_cal_model_get_timezone (model); + + e_cal_set_default_timezone (client, timezone, NULL); e_cal_open_async (client, FALSE); } diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c index 310200d6a7..5372299956 100644 --- a/modules/calendar/e-task-shell-view-actions.c +++ b/modules/calendar/e-task-shell-view-actions.c @@ -541,6 +541,7 @@ action_task_purge_cb (GtkAction *action, { EShellView *shell_view; EShellWindow *shell_window; + GtkWidget *content_area; GtkWidget *dialog; GtkWidget *widget; gboolean active; @@ -565,9 +566,9 @@ action_task_purge_cb (GtkAction *action, gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_NO); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); widget = gtk_check_button_new_with_label (_("Do not ask me again")); - gtk_box_pack_start ( - GTK_BOX (GTK_DIALOG (dialog)->vbox), widget, TRUE, TRUE, 6); + gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 6); gtk_widget_show (widget); response = gtk_dialog_run (GTK_DIALOG (dialog)); diff --git a/modules/mail/e-mail-attachment-handler.c b/modules/mail/e-mail-attachment-handler.c index 166522a827..55de059d12 100644 --- a/modules/mail/e-mail-attachment-handler.c +++ b/modules/mail/e-mail-attachment-handler.c @@ -22,8 +22,6 @@ #include "e-mail-attachment-handler.h" #include <glib/gi18n.h> -#include <camel/camel-folder.h> -#include <camel/camel-stream-mem.h> #include "e-util/e-alert-dialog.h" #include "mail/em-composer-utils.h" @@ -71,7 +69,7 @@ mail_attachment_handler_forward (GtkAction *action, attachment = E_ATTACHMENT (selected->data); mime_part = e_attachment_get_mime_part (attachment); - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); + wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part)); em_utils_forward_message (CAMEL_MIME_MESSAGE (wrapper), NULL); @@ -93,7 +91,7 @@ mail_attachment_handler_reply_all (GtkAction *action, attachment = E_ATTACHMENT (selected->data); mime_part = e_attachment_get_mime_part (attachment); - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); + wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part)); em_utils_reply_to_message ( NULL, NULL, CAMEL_MIME_MESSAGE (wrapper), @@ -117,7 +115,7 @@ mail_attachment_handler_reply_sender (GtkAction *action, attachment = E_ATTACHMENT (selected->data); mime_part = e_attachment_get_mime_part (attachment); - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); + wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part)); em_utils_reply_to_message ( NULL, NULL, CAMEL_MIME_MESSAGE (wrapper), @@ -207,8 +205,8 @@ mail_attachment_handler_message_rfc822 (EAttachmentView *view, success = TRUE; exit: - camel_object_unref (message); - camel_object_unref (stream); + g_object_unref (message); + g_object_unref (stream); gtk_drag_finish (drag_context, success, FALSE, time); } @@ -296,7 +294,7 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view, e_attachment_load_handle_error, parent); g_object_unref (attachment); - camel_object_unref (message); + g_object_unref (message); goto exit; } @@ -311,25 +309,25 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view, message = camel_folder_get_message ( folder, uids->pdata[ii], &ex); if (message == NULL) { - camel_object_unref (multipart); + g_object_unref (multipart); goto exit; } mime_part = camel_mime_part_new (); wrapper = CAMEL_DATA_WRAPPER (message); camel_mime_part_set_disposition (mime_part, "inline"); - camel_medium_set_content_object ( + camel_medium_set_content ( CAMEL_MEDIUM (mime_part), wrapper); camel_mime_part_set_content_type (mime_part, "message/rfc822"); camel_multipart_add_part (multipart, mime_part); - camel_object_unref (mime_part); + g_object_unref (mime_part); - camel_object_unref (message); + g_object_unref (message); } mime_part = camel_mime_part_new (); wrapper = CAMEL_DATA_WRAPPER (multipart); - camel_medium_set_content_object (CAMEL_MEDIUM (mime_part), wrapper); + camel_medium_set_content (CAMEL_MEDIUM (mime_part), wrapper); /* Translators: This is only for multiple messages. */ description = g_strdup_printf (_("%d attached messages"), uids->len); @@ -344,36 +342,26 @@ mail_attachment_handler_x_uid_list (EAttachmentView *view, e_attachment_load_handle_error, parent); g_object_unref (attachment); - camel_object_unref (mime_part); - camel_object_unref (multipart); + g_object_unref (mime_part); + g_object_unref (multipart); exit: if (camel_exception_is_set (&ex)) { - gchar *folder_name; + const gchar *folder_name = data; if (folder != NULL) - camel_object_get ( - folder, NULL, CAMEL_FOLDER_NAME, - &folder_name, NULL); - else - folder_name = g_strdup (data); + folder_name = camel_folder_get_name (folder); e_alert_run_dialog_for_args ( parent, "mail-composer:attach-nomessages", folder_name, camel_exception_get_description (&ex), NULL); - if (folder != NULL) - camel_object_free ( - folder, CAMEL_FOLDER_NAME, folder_name); - else - g_free (folder_name); - camel_exception_clear (&ex); } if (folder != NULL) - camel_object_unref (folder); + g_object_unref (folder); g_ptr_array_free (uids, TRUE); @@ -401,7 +389,7 @@ mail_attachment_handler_update_actions (EAttachmentView *view) if (!CAMEL_IS_MIME_PART (mime_part)) goto exit; - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); + wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part)); visible = CAMEL_IS_MIME_MESSAGE (wrapper); diff --git a/modules/mail/e-mail-junk-hook.c b/modules/mail/e-mail-junk-hook.c index f17290f99d..ae87df1b30 100644 --- a/modules/mail/e-mail-junk-hook.c +++ b/modules/mail/e-mail-junk-hook.c @@ -22,7 +22,6 @@ #include "e-mail-junk-hook.h" #include <glib/gi18n.h> -#include <camel/camel-junk-plugin.h> #include "e-util/e-alert-dialog.h" #include "shell/e-shell.h" diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c index b3eb0a97c1..5c16a34b21 100644 --- a/modules/mail/e-mail-shell-backend.c +++ b/modules/mail/e-mail-shell-backend.c @@ -22,10 +22,6 @@ #include "e-mail-shell-backend.h" #include <glib/gi18n.h> -#include <camel/camel-disco-store.h> -#include <camel/camel-offline-store.h> -#include <camel/camel-session.h> -#include <camel/camel-url.h> #include "e-util/e-account-utils.h" #include "e-util/e-binding.h" @@ -35,6 +31,7 @@ #include "shell/e-shell-window.h" #include "composer/e-msg-composer.h" #include "widgets/misc/e-preferences-window.h" +#include "widgets/misc/e-web-view.h" #include "e-mail-shell-settings.h" #include "e-mail-shell-sidebar.h" @@ -74,6 +71,9 @@ struct _EMailShellBackendPrivate { static gpointer parent_class; static GType mail_shell_backend_type; +static void mbox_create_preview_cb (GObject *preview, GtkWidget **preview_widget); +static void mbox_fill_preview_cb (GObject *preview, CamelMimeMessage *msg); + static void mail_shell_backend_init_importers (void) { @@ -84,6 +84,7 @@ mail_shell_backend_init_importers (void) importer = mbox_importer_peek (); e_import_class_add_importer (import_class, importer, NULL, NULL); + mbox_importer_set_preview_funcs (mbox_create_preview_cb, mbox_fill_preview_cb); importer = elm_importer_peek (); e_import_class_add_importer (import_class, importer, NULL, NULL); @@ -774,3 +775,31 @@ e_mail_labels_get_filter_options (void) return g_slist_reverse (list); } + +/* utility functions for mbox importer */ +static void +mbox_create_preview_cb (GObject *preview, GtkWidget **preview_widget) +{ + EMFormatHTMLDisplay *format; + + g_return_if_fail (preview != NULL); + g_return_if_fail (preview_widget != NULL); + + format = em_format_html_display_new (); + g_object_set_data_full (preview, "mbox-imp-formatter", format, g_object_unref); + *preview_widget = GTK_WIDGET (EM_FORMAT_HTML (format)->html); +} + +static void +mbox_fill_preview_cb (GObject *preview, CamelMimeMessage *msg) +{ + EMFormatHTMLDisplay *format; + + g_return_if_fail (preview != NULL); + g_return_if_fail (msg != NULL); + + format = g_object_get_data (preview, "mbox-imp-formatter"); + g_return_if_fail (format != NULL); + + em_format_format (EM_FORMAT (format), NULL, NULL, msg); +} diff --git a/modules/mail/e-mail-shell-backend.h b/modules/mail/e-mail-shell-backend.h index 36f4064e68..031efab150 100644 --- a/modules/mail/e-mail-shell-backend.h +++ b/modules/mail/e-mail-shell-backend.h @@ -24,8 +24,6 @@ #include <mail/e-mail-backend.h> -#include <camel/camel-folder.h> -#include <camel/camel-store.h> #include <e-util/e-signature-list.h> #include <libedataserver/e-account-list.h> diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index aa2718dcec..ecd592f32b 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -22,7 +22,6 @@ #include "e-mail-shell-content.h" #include <glib/gi18n.h> -#include <camel/camel-store.h> #include <libedataserver/e-data-server-util.h> #include "e-util/e-util-private.h" @@ -452,10 +451,6 @@ mail_shell_content_constructed (GObject *object) key = "/apps/evolution/mail/display/paned_size"; gconf_bridge_bind_property (bridge, key, object, "vposition"); - object = G_OBJECT (shell_content); - key = "/apps/evolution/mail/display/show_deleted"; - gconf_bridge_bind_property (bridge, key, object, "show-deleted"); - /* Message list customizations. */ reader = E_MAIL_READER (shell_content); @@ -688,8 +683,8 @@ mail_shell_content_class_init (EMailShellContentClass *class) PROP_GROUP_BY_THREADS, g_param_spec_boolean ( "group-by-threads", - _("Group by Threads"), - _("Whether to group messages by threads"), + "Group by Threads", + "Whether to group messages by threads", FALSE, G_PARAM_READWRITE)); @@ -698,8 +693,8 @@ mail_shell_content_class_init (EMailShellContentClass *class) PROP_PREVIEW_VISIBLE, g_param_spec_boolean ( "preview-visible", - _("Preview is Visible"), - _("Whether the preview pane is visible"), + "Preview is Visible", + "Whether the preview pane is visible", TRUE, G_PARAM_READWRITE)); diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c index 48fd042d58..7303aeea5b 100644 --- a/modules/mail/e-mail-shell-settings.c +++ b/modules/mail/e-mail-shell-settings.c @@ -58,7 +58,7 @@ e_mail_shell_settings_init (EShell *shell) NULL, G_PARAM_READWRITE)); - camel_object_ref (session); + g_object_ref (session); e_shell_settings_set_pointer ( shell_settings, "mail-session", session); diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c index 9b3c2fedd0..ac736a0a67 100644 --- a/modules/mail/e-mail-shell-sidebar.c +++ b/modules/mail/e-mail-shell-sidebar.c @@ -196,11 +196,7 @@ guess_screen_width (EMailShellSidebar *sidebar) GdkRectangle rect; toplevel = gtk_widget_get_toplevel (widget); -#if GTK_CHECK_VERSION(2,19,7) if (toplevel && gtk_widget_get_realized (toplevel)) -#else - if (toplevel && GTK_WIDGET_REALIZED (toplevel)) -#endif monitor = gdk_screen_get_monitor_at_window ( screen, gtk_widget_get_window (toplevel)); else { diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index f534c2a276..3ba34e68c0 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -19,6 +19,7 @@ * */ +#include "mail/mail-folder-cache.h" #include "e-mail-shell-view-private.h" static void @@ -232,7 +233,10 @@ action_mail_folder_mark_all_as_read_cb (GtkAction *action, g_return_if_fail (folder != NULL); key = "/apps/evolution/mail/prompts/mark_all_read"; - prompt = "mail:ask-mark-all-read"; + if (mail_folder_cache_get_folder_has_children (mail_folder_cache_get_default (), folder, NULL)) + prompt = "mail:ask-mark-all-read-sub"; + else + prompt = "mail:ask-mark-all-read"; if (!em_utils_prompt_user (parent, key, prompt, NULL)) return; @@ -410,53 +414,6 @@ action_mail_global_expunge_cb (GtkAction *action, } static void -action_mail_hide_deleted_cb (GtkToggleAction *action, - EMailShellView *mail_shell_view) -{ - GtkWidget *message_list; - EMailReader *reader; - gboolean active; - - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); - message_list = e_mail_reader_get_message_list (reader); - - active = gtk_toggle_action_get_active (action); - message_list_set_hidedeleted (MESSAGE_LIST (message_list), active); -} - -static void -action_mail_hide_read_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - GtkWidget *message_list; - EMailReader *reader; - - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); - message_list = e_mail_reader_get_message_list (reader); - - message_list_hide_add ( - MESSAGE_LIST (message_list), - "(match-all (system-flag \"seen\"))", - ML_HIDE_SAME, ML_HIDE_SAME); -} - -static void -action_mail_hide_selected_cb (GtkAction *action, - EMailShellView *mail_shell_view) -{ - GtkWidget *message_list; - EMailReader *reader; - GPtrArray *uids; - - reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); - message_list = e_mail_reader_get_message_list (reader); - uids = e_mail_reader_get_selected_uids (reader); - - message_list_hide_uids (MESSAGE_LIST (message_list), uids); - em_utils_uids_free (uids); -} - -static void action_mail_label_cb (GtkToggleAction *action, EMailShellView *mail_shell_view) { @@ -611,16 +568,18 @@ action_mail_label_none_cb (GtkAction *action, } static void -action_mail_show_hidden_cb (GtkAction *action, - EMailShellView *mail_shell_view) +action_mail_show_deleted_cb (GtkToggleAction *action, + EMailShellView *mail_shell_view) { GtkWidget *message_list; EMailReader *reader; + gboolean active; reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); message_list = e_mail_reader_get_message_list (reader); - message_list_hide_clear (MESSAGE_LIST (message_list)); + active = gtk_toggle_action_get_active (action); + message_list_set_hidedeleted (MESSAGE_LIST (message_list), !active); } static void @@ -996,27 +955,6 @@ static GtkActionEntry mail_entries[] = { NULL, /* XXX Add a tooltip! */ G_CALLBACK (action_mail_label_none_cb) }, - { "mail-hide-read", - NULL, - N_("Hide _Read Messages"), - NULL, - N_("Temporarily hide all messages that have already been read"), - G_CALLBACK (action_mail_hide_read_cb) }, - - { "mail-hide-selected", - NULL, - N_("Hide S_elected Messages"), - NULL, - N_("Temporarily hide the selected messages"), - G_CALLBACK (action_mail_hide_selected_cb) }, - - { "mail-show-hidden", - NULL, - N_("Show Hidde_n Messages"), - NULL, - N_("Show messages that have been temporarily hidden"), - G_CALLBACK (action_mail_show_hidden_cb) }, - { "mail-smart-backward", NULL, NULL, /* No menu item; key press only */ @@ -1146,15 +1084,6 @@ static EPopupActionEntry mail_popup_entries[] = { static GtkToggleActionEntry mail_toggle_entries[] = { - { "mail-hide-deleted", - NULL, - N_("Hide _Deleted Messages"), - NULL, - N_("Hide deleted messages rather than displaying " - "them with a line through them"), - G_CALLBACK (action_mail_hide_deleted_cb), - TRUE }, - { "mail-preview", NULL, N_("Show Message _Preview"), @@ -1163,6 +1092,14 @@ static GtkToggleActionEntry mail_toggle_entries[] = { NULL, /* Handled by property bindings */ TRUE }, + { "mail-show-deleted", + NULL, + N_("Show _Deleted Messages"), + NULL, + N_("Show deleted messages with a line through them"), + G_CALLBACK (action_mail_show_deleted_cb), + FALSE }, + { "mail-threads-group-by", NULL, N_("_Group By Threads"), @@ -1404,6 +1341,10 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) bridge = gconf_bridge_get (); + object = G_OBJECT (ACTION (MAIL_SHOW_DELETED)); + key = "/apps/evolution/mail/display/show_deleted"; + gconf_bridge_bind_property (bridge, key, object, "active"); + object = G_OBJECT (ACTION (MAIL_VIEW_VERTICAL)); key = "/apps/evolution/mail/display/layout"; gconf_bridge_bind_property (bridge, key, object, "current-value"); @@ -1442,11 +1383,9 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) ACTION (MAIL_PREVIEW), "active", ACTION (MAIL_VIEW_VERTICAL), "sensitive"); - /* XXX The boolean sense of the GConf key is the inverse of - * the menu item, so we have to maintain two properties. */ - e_mutual_binding_new_with_negation ( - mail_shell_content, "show-deleted", - ACTION (MAIL_HIDE_DELETED), "active"); + e_mutual_binding_new ( + ACTION (MAIL_SHOW_DELETED), "active", + mail_shell_content, "show-deleted"); /* Keep the sensitivity of "Create Search Folder from Search" * in sync with "Save Search" so that its only selectable when diff --git a/modules/mail/e-mail-shell-view-actions.h b/modules/mail/e-mail-shell-view-actions.h index addd67452b..cc7552e27c 100644 --- a/modules/mail/e-mail-shell-view-actions.h +++ b/modules/mail/e-mail-shell-view-actions.h @@ -99,12 +99,6 @@ E_SHELL_WINDOW_ACTION ((window), "mail-forward-inline") #define E_SHELL_WINDOW_ACTION_MAIL_FORWARD_QUOTED(window) \ E_SHELL_WINDOW_ACTION ((window), "mail-forward-quoted") -#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_DELETED(window) \ - E_SHELL_WINDOW_ACTION ((window), "mail-hide-deleted") -#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_READ(window) \ - E_SHELL_WINDOW_ACTION ((window), "mail-hide-read") -#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_SELECTED(window) \ - E_SHELL_WINDOW_ACTION ((window), "mail-hide-selected") #define E_SHELL_WINDOW_ACTION_MAIL_LABEL_NEW(window) \ E_SHELL_WINDOW_ACTION ((window), "mail-label-new") #define E_SHELL_WINDOW_ACTION_MAIL_LABEL_NONE(window) \ @@ -173,8 +167,8 @@ E_SHELL_WINDOW_ACTION ((window), "mail-select-all") #define E_SHELL_WINDOW_ACTION_MAIL_SHOW_ALL_HEADERS(window) \ E_SHELL_WINDOW_ACTION ((window), "mail-show-all-headers") -#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_HIDDEN(window) \ - E_SHELL_WINDOW_ACTION ((window), "mail-show-hidden") +#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_DELETED(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-show-deleted") #define E_SHELL_WINDOW_ACTION_MAIL_SHOW_SOURCE(window) \ E_SHELL_WINDOW_ACTION ((window), "mail-show-source") #define E_SHELL_WINDOW_ACTION_MAIL_SMART_BACKWARD(window) \ diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index 2cc46da1b7..8a45c4b853 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -257,19 +257,6 @@ mail_shell_view_reader_changed_cb (EMailShellView *mail_shell_view, } static void -mail_shell_view_reader_status_message_cb (EMailShellView *mail_shell_view, - const gchar *status_message) -{ - EShellView *shell_view; - EShellTaskbar *shell_taskbar; - - shell_view = E_SHELL_VIEW (mail_shell_view); - shell_taskbar = e_shell_view_get_shell_taskbar (shell_view); - - e_shell_taskbar_set_message (shell_taskbar, status_message); -} - -static void mail_shell_view_scroll_cb (EMailShellView *mail_shell_view, GtkOrientation orientation, GtkScrollType scroll_type, @@ -426,6 +413,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) EShellContent *shell_content; EShellSettings *shell_settings; EShellSidebar *shell_sidebar; + EShellTaskbar *shell_taskbar; EShellWindow *shell_window; EShellSearchbar *searchbar; EMFormatHTMLDisplay *html_display; @@ -447,6 +435,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) shell_backend = e_shell_view_get_shell_backend (shell_view); shell_content = e_shell_view_get_shell_content (shell_view); shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + shell_taskbar = e_shell_view_get_shell_taskbar (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); ui_manager = e_shell_window_get_ui_manager (shell_window); @@ -574,8 +563,8 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) g_signal_connect_swapped ( web_view, "status-message", - G_CALLBACK (mail_shell_view_reader_status_message_cb), - mail_shell_view); + G_CALLBACK (e_shell_taskbar_set_message), + shell_taskbar); /* Need to keep the handler ID so we can disconnect it in * dispose(). The shell outlives us and we don't want it @@ -636,12 +625,12 @@ e_mail_shell_view_private_dispose (EMailShellView *mail_shell_view) DISPOSE (priv->search_rules[ii]); if (priv->search_account_all != NULL) { - camel_object_unref (priv->search_account_all); + g_object_unref (priv->search_account_all); priv->search_account_all = NULL; } if (priv->search_account_current != NULL) { - camel_object_unref (priv->search_account_current); + g_object_unref (priv->search_account_current); priv->search_account_current = NULL; } @@ -832,12 +821,13 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) EShellView *shell_view; EMailReader *reader; CamelStore *local_store; + CamelStore *parent_store; CamelFolder *folder; GPtrArray *uids; GString *buffer; const gchar *display_name; + const gchar *folder_name; const gchar *folder_uri; - gchar *folder_name; gchar *title; guint32 num_deleted; guint32 num_junked; @@ -874,15 +864,14 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) return; } - camel_object_get ( - folder, NULL, - CAMEL_FOLDER_NAME, &folder_name, - CAMEL_FOLDER_DELETED, &num_deleted, - CAMEL_FOLDER_JUNKED, &num_junked, - CAMEL_FOLDER_JUNKED_NOT_DELETED, &num_junked_not_deleted, - CAMEL_FOLDER_UNREAD, &num_unread, - CAMEL_FOLDER_VISIBLE, &num_visible, - NULL); + folder_name = camel_folder_get_name (folder); + parent_store = camel_folder_get_parent_store (folder); + + num_deleted = folder->summary->deleted_count; + num_junked = folder->summary->junk_count; + num_junked_not_deleted = folder->summary->junk_not_deleted_count; + num_unread = folder->summary->unread_count; + num_visible = folder->summary->visible_count; buffer = g_string_sized_new (256); uids = e_mail_reader_get_selected_uids (reader); @@ -953,7 +942,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) em_utils_uids_free (uids); /* Choose a suitable folder name for displaying. */ - if (folder->parent_store == local_store && ( + if (parent_store == local_store && ( strcmp (folder_name, "Drafts") == 0 || strcmp (folder_name, "Inbox") == 0 || strcmp (folder_name, "Outbox") == 0 || @@ -970,6 +959,5 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) e_shell_view_set_title (shell_view, title); g_free (title); - camel_object_free (folder, CAMEL_FOLDER_NAME, folder_name); g_string_free (buffer, TRUE); } diff --git a/modules/mail/e-mail-shell-view-private.h b/modules/mail/e-mail-shell-view-private.h index de237aff96..a8a86c5054 100644 --- a/modules/mail/e-mail-shell-view-private.h +++ b/modules/mail/e-mail-shell-view-private.h @@ -26,12 +26,6 @@ #include <glib/gi18n.h> #include <gtkhtml/gtkhtml.h> -#include <camel/camel-disco-store.h> -#include <camel/camel-offline-store.h> -#include <camel/camel-operation.h> -#include <camel/camel-vee-folder.h> -#include <camel/camel-vee-store.h> -#include <camel/camel-vtrash-folder.h> #include <camel/camel-search-private.h> /* for camel_search_word */ #include "e-util/e-util.h" diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c index c3429859f7..e69ae55220 100644 --- a/modules/mail/e-mail-shell-view.c +++ b/modules/mail/e-mail-shell-view.c @@ -62,12 +62,12 @@ search_results_exec (SearchResultsMsg *msg) camel_operation_register (msg->cancel); copied_list = g_list_copy (msg->folder_list); - g_list_foreach (copied_list, (GFunc) camel_object_ref, NULL); + g_list_foreach (copied_list, (GFunc) g_object_ref, NULL); camel_vee_folder_set_folders ( CAMEL_VEE_FOLDER (msg->folder), copied_list); - g_list_foreach (copied_list, (GFunc) camel_object_unref, NULL); + g_list_foreach (copied_list, (GFunc) g_object_unref, NULL); g_list_free (copied_list); } @@ -79,9 +79,9 @@ search_results_done (SearchResultsMsg *msg) static void search_results_free (SearchResultsMsg *msg) { - camel_object_unref (msg->folder); + g_object_unref (msg->folder); - g_list_foreach (msg->folder_list, (GFunc) camel_object_unref, NULL); + g_list_foreach (msg->folder_list, (GFunc) g_object_unref, NULL); g_list_free (msg->folder_list); } @@ -101,7 +101,7 @@ mail_shell_view_setup_search_results_folder (CamelFolder *folder, SearchResultsMsg *msg; gint id; - camel_object_ref (folder); + g_object_ref (folder); msg = mail_msg_new (&search_results_setup_info); msg->folder = folder; @@ -487,7 +487,7 @@ all_accounts: text = e_shell_searchbar_get_search_text (searchbar); if (text == NULL || *text == '\0') { if (priv->search_account_all != NULL) { - camel_object_unref (priv->search_account_all); + g_object_unref (priv->search_account_all); priv->search_account_all = NULL; } @@ -614,7 +614,7 @@ current_account: text = e_shell_searchbar_get_search_text (searchbar); if (text == NULL || *text == '\0') { if (priv->search_account_current != NULL) { - camel_object_unref (priv->search_account_current); + g_object_unref (priv->search_account_current); priv->search_account_current = NULL; } @@ -664,7 +664,7 @@ current_account: /* Create a new search folder. */ - store = folder->parent_store; + store = camel_folder_get_parent_store (folder); list = NULL; /* list of CamelFolders */ if (store->folders != NULL) { diff --git a/modules/mail/em-account-prefs.c b/modules/mail/em-account-prefs.c index df1cdeef27..0ac397fc72 100644 --- a/modules/mail/em-account-prefs.c +++ b/modules/mail/em-account-prefs.c @@ -30,8 +30,6 @@ #include <config.h> #endif -#include <camel/camel-url.h> - #include <glib/gi18n.h> #include "e-util/e-alert-dialog.h" diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c index 49f2fda5b6..7c0f39ea31 100644 --- a/modules/mail/em-composer-prefs.c +++ b/modules/mail/em-composer-prefs.c @@ -38,8 +38,6 @@ #include "composer/e-msg-composer.h" #include "shell/e-shell-utils.h" -#include <camel/camel-iconv.h> - #include <glib/gi18n.h> #include <glib/gstdio.h> diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c index a885c72744..11795a92d8 100644 --- a/modules/mail/em-mailer-prefs.c +++ b/modules/mail/em-mailer-prefs.c @@ -30,7 +30,6 @@ #include "em-mailer-prefs.h" #include "em-format/em-format.h" -#include <camel/camel-iconv.h> #include <gtkhtml/gtkhtml-properties.h> #include <libxml/tree.h> @@ -219,8 +218,15 @@ jh_add_cb (GtkWidget *widget, gpointer user_data) { EMMailerPrefs *prefs = (EMMailerPrefs *) user_data; GtkWidget *dialog, *l1, *l2, *entry1, *entry2, *vbox, *hbox; + GtkWidget *content_area; gint response; - dialog = gtk_dialog_new_with_buttons (_("Add Custom Junk Header"), (GtkWindow *)gtk_widget_get_toplevel (widget), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); + + dialog = gtk_dialog_new_with_buttons ( + _("Add Custom Junk Header"), + (GtkWindow *) gtk_widget_get_toplevel (widget), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, + GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); vbox = gtk_vbox_new (FALSE, 6); hbox = gtk_hbox_new (FALSE, 0); @@ -238,7 +244,8 @@ jh_add_cb (GtkWidget *widget, gpointer user_data) gtk_box_pack_start ((GtkBox *)vbox, hbox, FALSE, FALSE, 6); gtk_widget_show_all (vbox); - gtk_container_add ((GtkContainer *)((GtkDialog *)dialog)->vbox, vbox); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); + gtk_container_add (GTK_CONTAINER (content_area), vbox); response = gtk_dialog_run ((GtkDialog *)dialog); if (response == GTK_RESPONSE_ACCEPT) { const gchar *name = gtk_entry_get_text ((GtkEntry *)entry1); diff --git a/modules/mail/em-network-prefs.c b/modules/mail/em-network-prefs.c index 6b419d0c2e..85a0a82ca3 100644 --- a/modules/mail/em-network-prefs.c +++ b/modules/mail/em-network-prefs.c @@ -283,12 +283,16 @@ emnp_free(EConfig *ec, GSList *items, gpointer data) static void emnp_set_markups (EMNetworkPrefs *prefs) { - gtk_label_set_use_markup (GTK_LABEL (GTK_BIN(prefs->sys_proxy)->child), TRUE); - gtk_label_set_use_markup (GTK_LABEL (GTK_BIN(prefs->no_proxy)->child), TRUE); - gtk_label_set_use_markup (GTK_LABEL (GTK_BIN(prefs->manual_proxy)->child), TRUE); -#if 0 - gtk_label_set_use_markup (GTK_LABEL (GTK_BIN(prefs->auto_proxy)->child), TRUE); -#endif + GtkWidget *child; + + child = gtk_bin_get_child (GTK_BIN (prefs->sys_proxy)); + gtk_label_set_use_markup (GTK_LABEL (child), TRUE); + + child = gtk_bin_get_child (GTK_BIN (prefs->no_proxy)); + gtk_label_set_use_markup (GTK_LABEL (child), TRUE); + + child = gtk_bin_get_child (GTK_BIN (prefs->manual_proxy)); + gtk_label_set_use_markup (GTK_LABEL (child), TRUE); } static void diff --git a/modules/mailto-handler/Makefile.am b/modules/mailto-handler/Makefile.am new file mode 100644 index 0000000000..8e61f34693 --- /dev/null +++ b/modules/mailto-handler/Makefile.am @@ -0,0 +1,54 @@ +module_LTLIBRARIES = libevolution-module-mailto-handler.la + +libevolution_module_mailto_handler_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + -I$(top_srcdir) \ + -DG_LOG_DOMAIN=\"evolution-mailto-handler\" \ + $(GNOME_PLATFORM_CFLAGS) + +libevolution_module_mailto_handler_la_SOURCES = \ + evolution-mailto-handler.c + +libevolution_module_mailto_handler_la_LIBADD = \ + $(top_builddir)/e-util/libeutil.la \ + $(top_builddir)/shell/libeshell.la \ + $(GNOME_PLATFORM_LIBS) + +libevolution_module_mailto_handler_la_LDFLAGS = \ + -module -avoid-version $(NO_UNDEFINED) + +schemadir = $(GCONF_SCHEMA_FILE_DIR) +schema_in_files = apps-evolution-mail-prompts-checkdefault.schemas.in +schema_DATA = $(schema_in_files:.schemas.in=.schemas) + +@INTLTOOL_SCHEMAS_RULE@ + +if GCONF_SCHEMAS_INSTALL + +if OS_WIN32 +install-data-local: + if test -z "$(DESTDIR)" ; then \ + for p in $(schema_DATA) ; do \ + (echo set GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE); \ + echo $(GCONFTOOL) --makefile-install-rule $$p) >_temp.bat; \ + cmd /c _temp.bat; \ + rm _temp.bat; \ + done \ + fi +else +install-data-local: + if test -z "$(DESTDIR)" ; then \ + for p in $(schema_DATA) ; do \ + GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \ + $(GCONFTOOL) --makefile-install-rule $$p; \ + done \ + fi +endif + +endif + +EXTRA_DIST = $(schema_in_files) + +DISTCLEANFILES = $(schema_DATA) + +-include $(top_srcdir)/git.mk diff --git a/modules/mailto-handler/apps-evolution-mail-prompts-checkdefault.schemas.in b/modules/mailto-handler/apps-evolution-mail-prompts-checkdefault.schemas.in new file mode 100644 index 0000000000..cdcaf7892a --- /dev/null +++ b/modules/mailto-handler/apps-evolution-mail-prompts-checkdefault.schemas.in @@ -0,0 +1,16 @@ +<gconfschemafile> + <schemalist> + <schema> + <key>/schemas/apps/evolution/mail/prompts/checkdefault</key> + <applyto>/apps/evolution/mail/prompts/checkdefault</applyto> + <owner>evolution-mail</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Check whether Evolution is the default mailer</short> + <long>Every time Evolution starts, check whether or not it is the default mailer.</long> + </locale> + </schema> + </schemalist> +</gconfschemafile> + diff --git a/modules/mailto-handler/evolution-mailto-handler.c b/modules/mailto-handler/evolution-mailto-handler.c new file mode 100644 index 0000000000..076f2e0686 --- /dev/null +++ b/modules/mailto-handler/evolution-mailto-handler.c @@ -0,0 +1,274 @@ +/* + * evolution-mailto-handler.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#include <config.h> +#include <glib/gi18n-lib.h> + +#include <shell/e-shell.h> +#include <e-util/e-binding.h> +#include <e-util/e-extension.h> + +/* Standard GObject macros */ +#define E_TYPE_MAILTO_HANDLER \ + (e_mailto_handler_get_type ()) +#define E_MAILTO_HANDLER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MAILTO_HANDLER, EMailtoHandler)) + +#define MAILTO_COMMAND \ + "evolution --component=mail %s" + +typedef struct _EMailtoHandler EMailtoHandler; +typedef struct _EMailtoHandlerClass EMailtoHandlerClass; + +struct _EMailtoHandler { + EExtension parent; +}; + +struct _EMailtoHandlerClass { + EExtensionClass parent_class; +}; + +/* Module Entry Points */ +void e_module_load (GTypeModule *type_module); +void e_module_unload (GTypeModule *type_module); + +/* Forward Declarations */ +GType e_mailto_handler_get_type (void); + +G_DEFINE_DYNAMIC_TYPE (EMailtoHandler, e_mailto_handler, E_TYPE_EXTENSION) + +static EShell * +mailto_handler_get_shell (EMailtoHandler *extension) +{ + EExtensible *extensible; + + extensible = e_extension_get_extensible (E_EXTENSION (extension)); + + return E_SHELL (extensible); +} + +static gboolean +mailto_handler_is_evolution (const gchar *mailto_command) +{ + gint argc; + gchar **argv; + gchar *basename; + gboolean is_evolution; + + if (mailto_command == NULL) + return FALSE; + + /* Tokenize the mailto command. */ + if (!g_shell_parse_argv (mailto_command, &argc, &argv, NULL)) + return FALSE; + + g_return_val_if_fail (argc > 0, FALSE); + + /* Check the basename of the first token. */ + basename = g_path_get_basename (argv[0]); + is_evolution = g_str_has_prefix (basename, "evolution"); + g_free (basename); + + g_strfreev (argv); + + return is_evolution; +} + +static gboolean +mailto_handler_prompt (EMailtoHandler *extension) +{ + EShell *shell; + EShellSettings *shell_settings; + GtkWidget *container; + GtkWidget *dialog; + GtkWidget *widget; + const gchar *text; + gchar *markup; + gint response; + + shell = mailto_handler_get_shell (extension); + shell_settings = e_shell_get_shell_settings (shell); + + dialog = gtk_dialog_new_with_buttons ( + "", NULL, 0, + GTK_STOCK_NO, GTK_RESPONSE_NO, + GTK_STOCK_YES, GTK_RESPONSE_YES, + NULL); + + gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES); + gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); + + container = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); + + widget = gtk_hbox_new (FALSE, 12); + gtk_container_set_border_width (GTK_CONTAINER (widget), 5); + gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); + gtk_widget_show (widget); + + container = widget; + + widget = gtk_image_new_from_stock ( + GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + widget = gtk_vbox_new (FALSE, 12); + gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); + gtk_widget_show (widget); + + container = widget; + + text = _("Do you want to make Evolution your default email client?"); + markup = g_markup_printf_escaped ("<b>%s</b>", text); + widget = gtk_label_new (NULL); + gtk_label_set_markup (GTK_LABEL (widget), markup); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + g_free (markup); + + text = _("_Do not show this message again"); + widget = gtk_check_button_new_with_mnemonic (text); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 12); + gtk_widget_show (widget); + + e_mutual_binding_new_with_negation ( + shell_settings, "mailto-handler-check", + widget, "active"); + + /* Direct input focus away from the checkbox. */ + widget = gtk_dialog_get_widget_for_response ( + GTK_DIALOG (dialog), GTK_RESPONSE_YES); + gtk_widget_grab_focus (widget); + + response = gtk_dialog_run (GTK_DIALOG (dialog)); + + gtk_widget_destroy (dialog); + + return (response == GTK_RESPONSE_YES); +} + +static void +mailto_handler_check (EMailtoHandler *extension) +{ + EShell *shell; + EShellSettings *shell_settings; + gboolean check_mailto_handler = TRUE; + gchar *mailto_command = NULL; + + shell = mailto_handler_get_shell (extension); + shell_settings = e_shell_get_shell_settings (shell); + + g_object_get ( + shell_settings, + "mailto-handler-command", &mailto_command, + "mailto-handler-check", &check_mailto_handler, + NULL); + + /* Should we check the "mailto" URI handler? */ + if (!check_mailto_handler) + goto exit; + + /* Is Evolution already handling "mailto" URIs? */ + if (mailto_handler_is_evolution (mailto_command)) + goto exit; + + /* Does the user want Evolution to handle them? */ + if (!mailto_handler_prompt (extension)) + goto exit; + + /* Configure Evolution to be the "mailto" URI handler. */ + + g_object_set ( + shell_settings, + "mailto-handler-command", MAILTO_COMMAND, + "mailto-handler-enabled", TRUE, + "mailto-handler-needs-terminal", FALSE, + NULL); + +exit: + g_free (mailto_command); +} + +static void +mailto_handler_constructed (GObject *object) +{ + EShell *shell; + EShellSettings *shell_settings; + EMailtoHandler *extension; + + extension = E_MAILTO_HANDLER (object); + + shell = mailto_handler_get_shell (extension); + shell_settings = e_shell_get_shell_settings (shell); + + e_shell_settings_install_property_for_key ( + "mailto-handler-check", + "/apps/evolution/mail/prompts/checkdefault"); + + e_shell_settings_install_property_for_key ( + "mailto-handler-command", + "/desktop/gnome/url-handlers/mailto/command"); + + e_shell_settings_install_property_for_key ( + "mailto-handler-enabled", + "/desktop/gnome/url-handlers/mailto/enabled"); + + e_shell_settings_install_property_for_key ( + "mailto-handler-needs-terminal", + "/desktop/gnome/url-handlers/mailto/needs_terminal"); + + g_signal_connect_swapped ( + shell, "event::ready-to-start", + G_CALLBACK (mailto_handler_check), extension); +} + +static void +e_mailto_handler_class_init (EMailtoHandlerClass *class) +{ + GObjectClass *object_class; + EExtensionClass *extension_class; + + object_class = G_OBJECT_CLASS (class); + object_class->constructed = mailto_handler_constructed; + + extension_class = E_EXTENSION_CLASS (class); + extension_class->extensible_type = E_TYPE_SHELL; +} + +static void +e_mailto_handler_class_finalize (EMailtoHandlerClass *class) +{ +} + +static void +e_mailto_handler_init (EMailtoHandler *extension) +{ +} + +G_MODULE_EXPORT void +e_module_load (GTypeModule *type_module) +{ + e_mailto_handler_register_type (type_module); +} + +G_MODULE_EXPORT void +e_module_unload (GTypeModule *type_module) +{ +} diff --git a/modules/plugin-mono/Camel.cs b/modules/plugin-mono/Camel.cs index 4ad80e7012..c415498c02 100644 --- a/modules/plugin-mono/Camel.cs +++ b/modules/plugin-mono/Camel.cs @@ -261,69 +261,7 @@ namespace Camel { remove { removeEvent("finalize", ref finalise_id, value); } } - public event MetaChangedEvent MetaChanged { - add { addEvent("meta_changed", ref meta_changed_id, (CamelEventFunc)metaChangedHook, value); } - remove { removeEvent("meta_changed", ref meta_changed_id, value); } - } - - [DllImport("camel-1.2")] static extern IntPtr camel_object_get_ptr(IntPtr raw, ref CamelException ex, int tag); [DllImport("camel-1.2")] static extern void camel_object_free(IntPtr raw, int tag, IntPtr val); - [DllImport("camel-1.2")] static extern int camel_object_get_int(IntPtr raw, ref CamelException ex, int tag); - - // maybe we want an indexer class to get properties? - // e.g. name = folder.properties[Folder.Tag.NAME] - public String getString(int type) { - String s; - IntPtr o; - CamelException ex = new CamelException(); - - o = camel_object_get_ptr(cobject, ref ex, type); - if (ex.id != 0) - throw new Camel.Exception(ex); - - s = Marshal.PtrToStringAuto(o); - camel_object_free(cobject, type, o); - - return s; - } - - public Camel.Object getObject(int type) { - IntPtr o; - Camel.Object co; - CamelException ex = new CamelException(); - - o = camel_object_get_ptr(cobject, ref ex, type); - if (ex.id != 0) - throw new Camel.Exception(ex); - - co = fromCamel(o); - camel_object_free(cobject, type, o); - - return co; - } - - public int getInt(int type) { - int r; - CamelException ex = new CamelException(); - - r = camel_object_get_int(cobject, ref ex, type); - if (ex.id != 0) - throw new Camel.Exception(ex); - - return r; - } - - // meta-data - [DllImport("camel-1.2")] static extern String camel_object_meta_get(IntPtr raw, string name); - [DllImport("camel-1.2")] static extern bool camel_object_meta_set(IntPtr raw, string name, string value); - - public String metaGet(String name) { - return camel_object_meta_get(cobject, name); - } - - public bool metaSet(String name, String value) { - return camel_object_meta_set(cobject, name, value); - } } public class Provider { diff --git a/modules/plugin-mono/e-plugin-mono.c b/modules/plugin-mono/e-plugin-mono.c index f1fe76ff49..eb4b60cf97 100644 --- a/modules/plugin-mono/e-plugin-mono.c +++ b/modules/plugin-mono/e-plugin-mono.c @@ -121,6 +121,11 @@ plugin_mono_invoke (EPlugin *plugin, plugin_mono = E_PLUGIN_MONO (plugin); priv = plugin_mono->priv; + if (!domain) { + mono_config_parse (NULL); + domain = mono_jit_init (plugin_mono->location); + } + /* We need to do this every time since we may * be called from any thread for some uses. */ mono_thread_attach (domain); @@ -258,7 +263,4 @@ e_plugin_mono_register_type (GTypeModule *type_module) plugin_mono_type = g_type_module_register_type ( type_module, E_TYPE_PLUGIN, "EPluginMono", &type_info, 0); - - domain = mono_jit_init ("Evolution"); - mono_thread_attach (domain); } diff --git a/modules/plugin-python/Makefile.am b/modules/plugin-python/Makefile.am index 4aaf14a7b2..6bc2dcf91c 100644 --- a/modules/plugin-python/Makefile.am +++ b/modules/plugin-python/Makefile.am @@ -13,7 +13,7 @@ libevolution_module_plugin_python_la_SOURCES = \ e-plugin-python.h libevolution_module_plugin_python_la_LIBADD = \ - -lpthread -ldl -lutil -lm \ + -ldl -lutil -lm \ $(top_builddir)/e-util/libeutil.la \ $(E_UTIL_LIBS) \ $(PY_LIBS) |