From 7950d6a0c6efd6c4d48afd99c138f38952bdd1bb Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 21 Apr 2012 14:52:23 -0400 Subject: Adapt to libedataserver[ui] changes. --- plugins/addressbook-file/addressbook-file.c | 2 +- plugins/bbdb/bbdb.c | 68 ++++++++++++++++++---------- plugins/calendar-file/calendar-file.c | 2 +- plugins/default-source/default-source.c | 2 +- plugins/itip-formatter/itip-formatter.c | 28 ++++++------ plugins/itip-formatter/itip-view.c | 12 ++--- plugins/pst-import/pst-importer.c | 4 +- plugins/publish-calendar/url-editor-dialog.c | 2 +- plugins/save-calendar/csv-format.c | 4 +- plugins/save-calendar/ical-format.c | 4 +- plugins/save-calendar/rdf-format.c | 9 ++-- 11 files changed, 81 insertions(+), 56 deletions(-) (limited to 'plugins') diff --git a/plugins/addressbook-file/addressbook-file.c b/plugins/addressbook-file/addressbook-file.c index 37ed087c01..40d6458b19 100644 --- a/plugins/addressbook-file/addressbook-file.c +++ b/plugins/addressbook-file/addressbook-file.c @@ -63,7 +63,7 @@ e_book_file_dummy (EPlugin *epl, return NULL; } - e_source_set_relative_uri (source, e_source_peek_uid (source)); + e_source_set_relative_uri (source, e_source_get_uid (source)); return NULL; } diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c index 1fa392b09f..69115ddd02 100644 --- a/plugins/bbdb/bbdb.c +++ b/plugins/bbdb/bbdb.c @@ -427,9 +427,11 @@ bbdb_create_book_client (gint type) /* Open the appropriate addresbook. */ if (type == GAIM_ADDRESSBOOK) - uri = g_settings_get_string (settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM); + uri = g_settings_get_string ( + settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM); else - uri = g_settings_get_string (settings, CONF_KEY_WHICH_ADDRESSBOOK); + uri = g_settings_get_string ( + settings, CONF_KEY_WHICH_ADDRESSBOOK); g_object_unref (G_OBJECT (settings)); if (uri == NULL) @@ -520,12 +522,17 @@ enable_toggled_cb (GtkWidget *widget, if (active && !addressbook) { const gchar *uri = NULL; - selected_source = e_source_combo_box_get_active ( + selected_source = e_source_combo_box_ref_active ( E_SOURCE_COMBO_BOX (stuff->combo_box)); - if (selected_source != NULL) + if (selected_source != NULL) { uri = e_source_get_uri (selected_source); - - g_settings_set_string (settings, CONF_KEY_WHICH_ADDRESSBOOK, uri ? uri : ""); + g_settings_set_string ( + settings, CONF_KEY_WHICH_ADDRESSBOOK, uri); + g_object_unref (selected_source); + } else { + g_settings_set_string ( + settings, CONF_KEY_WHICH_ADDRESSBOOK, ""); + } } g_free (addressbook); @@ -547,12 +554,23 @@ enable_gaim_toggled_cb (GtkWidget *widget, /* Save the new setting to GSettings */ g_settings_set_boolean (settings, CONF_KEY_ENABLE_GAIM, active); - addressbook_gaim = g_settings_get_string (settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM); + addressbook_gaim = g_settings_get_string ( + settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM); gtk_widget_set_sensitive (stuff->gaim_combo_box, active); if (active && !addressbook_gaim) { - selected_source = e_source_combo_box_get_active ( + const gchar *uri = NULL; + + selected_source = e_source_combo_box_ref_active ( E_SOURCE_COMBO_BOX (stuff->gaim_combo_box)); - g_settings_set_string (settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM, e_source_get_uri (selected_source)); + if (selected_source != NULL) { + uri = e_source_get_uri (selected_source); + g_settings_set_string ( + settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM, uri); + g_object_unref (selected_source); + } else { + g_settings_set_string ( + settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM, ""); + } } g_free (addressbook_gaim); @@ -569,34 +587,38 @@ static void source_changed_cb (ESourceComboBox *source_combo_box, struct bbdb_stuff *stuff) { + GSettings *settings; ESource *source; - GSettings *settings = g_settings_new (CONF_SCHEMA); - - source = e_source_combo_box_get_active (source_combo_box); + const gchar *uri; - g_settings_set_string ( - settings, - CONF_KEY_WHICH_ADDRESSBOOK, - source ? e_source_get_uri (source) : ""); + source = e_source_combo_box_ref_active (source_combo_box); + uri = (source != NULL) ? e_source_get_uri (source) : ""; + settings = g_settings_new (CONF_SCHEMA); + g_settings_set_string (settings, CONF_KEY_WHICH_ADDRESSBOOK, uri); g_object_unref (settings); + + if (source != NULL) + g_object_unref (source); } static void gaim_source_changed_cb (ESourceComboBox *source_combo_box, struct bbdb_stuff *stuff) { + GSettings *settings; ESource *source; - GSettings *settings = g_settings_new (CONF_SCHEMA); - - source = e_source_combo_box_get_active (source_combo_box); + const gchar *uri; - g_settings_set_string ( - settings, - CONF_KEY_WHICH_ADDRESSBOOK_GAIM, - source ? e_source_get_uri (source) : ""); + source = e_source_combo_box_ref_active (source_combo_box); + uri = (source != NULL) ? e_source_get_uri (source) : ""; + settings = g_settings_new (CONF_SCHEMA); + g_settings_set_string (settings, CONF_KEY_WHICH_ADDRESSBOOK_GAIM, uri); g_object_unref (settings); + + if (source != NULL) + g_object_unref (source); } static GtkWidget * diff --git a/plugins/calendar-file/calendar-file.c b/plugins/calendar-file/calendar-file.c index 0afb158552..32ba96aa8a 100644 --- a/plugins/calendar-file/calendar-file.c +++ b/plugins/calendar-file/calendar-file.c @@ -124,7 +124,7 @@ e_calendar_file_customs (EPlugin *epl, if (relative_uri && g_str_equal (relative_uri, "system")) return NULL; - e_source_set_relative_uri (source, e_source_peek_uid (source)); + e_source_set_relative_uri (source, e_source_get_uid (source)); mainbox = gtk_vbox_new (FALSE, 2); g_object_get (data->parent, "n-rows", &n_rows, NULL); diff --git a/plugins/default-source/default-source.c b/plugins/default-source/default-source.c index c80aba39cd..0e4ce12b94 100644 --- a/plugins/default-source/default-source.c +++ b/plugins/default-source/default-source.c @@ -62,7 +62,7 @@ mark_default_source_in_list (ESourceList *source_list, g_return_if_fail (source_list != NULL); g_return_if_fail (source != NULL); - source = e_source_list_peek_source_by_uid (source_list, e_source_peek_uid (source)); + source = e_source_list_peek_source_by_uid (source_list, e_source_get_uid (source)); for (g = e_source_list_peek_groups (source_list); g; g = g->next) { ESourceGroup *group = g->data; diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index b8fd802676..16f7a21d53 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -440,7 +440,7 @@ get_real_item (ItipPURI *pitip) source = e_client_get_source (E_CLIENT (pitip->current_client)); if (source) - comp = g_hash_table_lookup (pitip->real_comps, e_source_peek_uid (source)); + comp = g_hash_table_lookup (pitip->real_comps, e_source_get_uid (source)); if (!comp) { return NULL; @@ -502,7 +502,7 @@ add_failed_to_load_msg (ItipView *view, /* Translators: The first '%s' is replaced with a calendar name, * the second '%s' with an error message */ - msg = g_strdup_printf (_("Failed to load the calendar '%s' (%s)"), e_source_peek_name (source), error->message); + msg = g_strdup_printf (_("Failed to load the calendar '%s' (%s)"), e_source_get_display_name (source), error->message); itip_view_add_lower_info_item (view, ITIP_VIEW_INFO_ITEM_TYPE_WARNING, msg); @@ -544,7 +544,7 @@ cal_opened_cb (GObject *source_object, cal_client = E_CAL_CLIENT (client); g_return_if_fail (cal_client != NULL); - uid = e_source_peek_uid (source); + uid = e_source_get_uid (source); source_type = e_cal_client_get_source_type (cal_client); g_hash_table_insert ( pitip->clients[source_type], g_strdup (uid), cal_client); @@ -586,7 +586,7 @@ start_calendar_server (ItipPURI *pitip, g_return_if_fail (source != NULL); - client = g_hash_table_lookup (pitip->clients[type], e_source_peek_uid (source)); + client = g_hash_table_lookup (pitip->clients[type], e_source_get_uid (source)); if (client) { pitip->current_client = client; @@ -663,7 +663,7 @@ find_cal_update_ui (FormatItipFindData *fd, if (cal_client && g_hash_table_lookup (fd->conflicts, cal_client)) { itip_view_add_upper_info_item_printf (view, ITIP_VIEW_INFO_ITEM_TYPE_WARNING, - _("An appointment in the calendar '%s' conflicts with this meeting"), e_source_peek_name (source)); + _("An appointment in the calendar '%s' conflicts with this meeting"), e_source_get_display_name (source)); } /* search for a master object if the detached object doesn't exist in the calendar */ @@ -687,7 +687,7 @@ find_cal_update_ui (FormatItipFindData *fd, /* FIXME Check read only state of calendar? */ itip_view_add_lower_info_item_printf (view, ITIP_VIEW_INFO_ITEM_TYPE_INFO, - _("Found the appointment in the calendar '%s'"), e_source_peek_name (source)); + _("Found the appointment in the calendar '%s'"), e_source_get_display_name (source)); set_buttons_sensitive (pitip, view); } else if (!pitip->current_client) @@ -878,7 +878,7 @@ get_object_without_rid_ready_cb (GObject *source_object, if (comp) { ESource *source = e_client_get_source (E_CLIENT (cal_client)); - g_hash_table_insert (fd->puri->real_comps, g_strdup (e_source_peek_uid (source)), comp); + g_hash_table_insert (fd->puri->real_comps, g_strdup (e_source_get_uid (source)), comp); } find_cal_update_ui (fd, cal_client); @@ -929,7 +929,7 @@ get_object_with_rid_ready_cb (GObject *source_object, if (comp) { ESource *source = e_client_get_source (E_CLIENT (cal_client)); - g_hash_table_insert (fd->puri->real_comps, g_strdup (e_source_peek_uid (source)), comp); + g_hash_table_insert (fd->puri->real_comps, g_strdup (e_source_get_uid (source)), comp); } find_cal_update_ui (fd, cal_client); @@ -1037,7 +1037,7 @@ find_cal_opened_cb (GObject *source_object, cal_client = E_CAL_CLIENT (client); source_type = e_cal_client_get_source_type (cal_client); - uid = e_source_peek_uid (source); + uid = e_source_get_uid (source); g_hash_table_insert ( pitip->clients[source_type], g_strdup (uid), cal_client); @@ -1500,7 +1500,7 @@ receive_objects_ready_cb (GObject *ecalclient, itip_view_add_lower_info_item_printf ( view, ITIP_VIEW_INFO_ITEM_TYPE_INFO, _("Unable to send item to calendar '%s'. %s"), - e_source_peek_name (source), error ? error->message : _("Unknown error")); + e_source_get_display_name (source), error ? error->message : _("Unknown error")); } g_clear_error (&error); return; @@ -1514,24 +1514,24 @@ receive_objects_ready_cb (GObject *ecalclient, case ITIP_VIEW_RESPONSE_ACCEPT: itip_view_add_lower_info_item_printf ( view, ITIP_VIEW_INFO_ITEM_TYPE_INFO, - _("Sent to calendar '%s' as accepted"), e_source_peek_name (source)); + _("Sent to calendar '%s' as accepted"), e_source_get_display_name (source)); break; case ITIP_VIEW_RESPONSE_TENTATIVE: itip_view_add_lower_info_item_printf ( view, ITIP_VIEW_INFO_ITEM_TYPE_INFO, - _("Sent to calendar '%s' as tentative"), e_source_peek_name (source)); + _("Sent to calendar '%s' as tentative"), e_source_get_display_name (source)); break; case ITIP_VIEW_RESPONSE_DECLINE: /* FIXME some calendars just might not save it at all, is this accurate? */ itip_view_add_lower_info_item_printf ( view, ITIP_VIEW_INFO_ITEM_TYPE_INFO, - _("Sent to calendar '%s' as declined"), e_source_peek_name (source)); + _("Sent to calendar '%s' as declined"), e_source_get_display_name (source)); break; case ITIP_VIEW_RESPONSE_CANCEL: /* FIXME some calendars just might not save it at all, is this accurate? */ itip_view_add_lower_info_item_printf ( view, ITIP_VIEW_INFO_ITEM_TYPE_INFO, - _("Sent to calendar '%s' as canceled"), e_source_peek_name (source)); + _("Sent to calendar '%s' as canceled"), e_source_get_display_name (source)); break; default: g_assert_not_reached (); diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c index 018ae98f00..c92ac60fa8 100644 --- a/plugins/itip-formatter/itip-view.c +++ b/plugins/itip-formatter/itip-view.c @@ -943,7 +943,7 @@ source_changed_cb (WebKitDOMElement *select, source = itip_view_get_source (view); - d(printf("Source changed to '%s'\n", e_source_peek_name (source))); + d(printf("Source changed to '%s'\n", e_source_get_display_name (source))); g_signal_emit (view, signals[SOURCE_SELECTED], 0, source); } @@ -2207,13 +2207,13 @@ source_list_changed_cb (ESourceList *source_list, view->priv->dom_document, "OPTION", NULL); webkit_dom_html_option_element_set_value ( WEBKIT_DOM_HTML_OPTION_ELEMENT (option), - e_source_peek_uid (source)); + e_source_get_uid (source)); webkit_dom_html_option_element_set_label ( WEBKIT_DOM_HTML_OPTION_ELEMENT (option), - e_source_peek_name (source)); + e_source_get_display_name (source)); webkit_dom_html_element_set_inner_html ( WEBKIT_DOM_HTML_ELEMENT (option), - e_source_peek_name (source), NULL); + e_source_get_display_name (source), NULL); webkit_dom_html_element_set_class_name ( WEBKIT_DOM_HTML_ELEMENT (option), "calendar"); @@ -2271,7 +2271,7 @@ itip_view_set_source (ItipView *view, g_return_if_fail (ITIP_IS_VIEW (view)); - d(printf("Settings default source '%s'\n", e_source_peek_name (source))); + d(printf("Settings default source '%s'\n", e_source_get_display_name (source))); if (!view->priv->dom_document) return; @@ -2312,7 +2312,7 @@ itip_view_set_source (ItipView *view, option = WEBKIT_DOM_HTML_OPTION_ELEMENT (node); value = webkit_dom_html_option_element_get_value (option); - if (g_strcmp0 (value, e_source_peek_uid (source)) == 0) { + if (g_strcmp0 (value, e_source_get_uid (source)) == 0) { webkit_dom_html_option_element_set_selected ( option, TRUE); diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index e86fa2ab81..abea9be61d 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -666,7 +666,7 @@ open_client (PstImporter *m, combo = g_datalist_get_data (&m->target->data, get_source_combo_key (source_type)); g_return_if_fail (combo != NULL); - source = e_source_combo_box_get_active (combo); + source = e_source_combo_box_ref_active (combo); g_return_if_fail (source != NULL); m->waiting_open++; @@ -675,6 +675,8 @@ open_client (PstImporter *m, source, source_type, FALSE, m->cancellable, e_client_utils_authenticate_handler, NULL, client_opened_cb, m); + + g_object_unref (source); } static void diff --git a/plugins/publish-calendar/url-editor-dialog.c b/plugins/publish-calendar/url-editor-dialog.c index db3dd28bdc..2d9efb6380 100644 --- a/plugins/publish-calendar/url-editor-dialog.c +++ b/plugins/publish-calendar/url-editor-dialog.c @@ -589,7 +589,7 @@ url_editor_dialog_run (UrlEditorDialog *dialog) l = e_source_selector_get_selection (E_SOURCE_SELECTOR (dialog->events_selector)); for (p = l; p; p = g_slist_next (p)) - dialog->uri->events = g_slist_append (dialog->uri->events, g_strdup (e_source_peek_uid (p->data))); + dialog->uri->events = g_slist_append (dialog->uri->events, g_strdup (e_source_get_uid (p->data))); } gtk_widget_hide (GTK_WIDGET (dialog)); diff --git a/plugins/save-calendar/csv-format.c b/plugins/save-calendar/csv-format.c index f9d97fcf68..021123d7fd 100644 --- a/plugins/save-calendar/csv-format.c +++ b/plugins/save-calendar/csv-format.c @@ -337,14 +337,14 @@ do_save_calendar_csv (FormatHandler *handler, if (!dest_uri) return; - primary_source = e_source_selector_get_primary_selection (selector); - /* open source client */ + primary_source = e_source_selector_ref_primary_selection (selector); source_client = e_cal_client_new (primary_source, type, &error); if (source_client) g_signal_connect ( source_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); + g_object_unref (primary_source); if (!source_client || !e_client_open_sync (E_CLIENT (source_client), TRUE, NULL, &error)) { display_error_message ( diff --git a/plugins/save-calendar/ical-format.c b/plugins/save-calendar/ical-format.c index 77e5558e29..47cc15f9d7 100644 --- a/plugins/save-calendar/ical-format.c +++ b/plugins/save-calendar/ical-format.c @@ -97,17 +97,17 @@ do_save_calendar_ical (FormatHandler *handler, GSList *objects = NULL; icalcomponent *top_level = NULL; - primary_source = e_source_selector_get_primary_selection (selector); - if (!dest_uri) return; /* open source client */ + primary_source = e_source_selector_ref_primary_selection (selector); source_client = e_cal_client_new (primary_source, type, &error); if (source_client) g_signal_connect ( source_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); + g_object_unref (primary_source); if (!source_client || !e_client_open_sync (E_CLIENT (source_client), TRUE, NULL, &error)) { display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error->message); diff --git a/plugins/save-calendar/rdf-format.c b/plugins/save-calendar/rdf-format.c index 11c29fa854..2e2e92e19a 100644 --- a/plugins/save-calendar/rdf-format.c +++ b/plugins/save-calendar/rdf-format.c @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -201,14 +202,14 @@ do_save_calendar_rdf (FormatHandler *handler, if (!dest_uri) return; - primary_source = e_source_selector_get_primary_selection (selector); - /* open source client */ + primary_source = e_source_selector_ref_primary_selection (selector); source_client = e_cal_client_new (primary_source, type, &error); if (source_client) g_signal_connect ( source_client, "authenticate", G_CALLBACK (e_client_utils_authenticate_handler), NULL); + g_object_unref (primary_source); if (!source_client || !e_client_open_sync (E_CLIENT (source_client), TRUE, NULL, &error)) { display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error); @@ -249,9 +250,9 @@ do_save_calendar_rdf (FormatHandler *handler, xmlNewChild (fnode, NULL, (const guchar *)"method", (const guchar *)"PUBLISH"); - xmlNewChild (fnode, NULL, (const guchar *)"x-wr:relcalid", (guchar *)e_source_peek_uid (primary_source)); + xmlNewChild (fnode, NULL, (const guchar *)"x-wr:relcalid", (guchar *)e_source_get_uid (primary_source)); - xmlNewChild (fnode, NULL, (const guchar *)"x-wr:calname", (guchar *)e_source_peek_name (primary_source)); + xmlNewChild (fnode, NULL, (const guchar *)"x-wr:calname", (guchar *)e_source_get_display_name (primary_source)); /* Version of this RDF-format */ xmlNewChild (fnode, NULL, (const guchar *)"version", (const guchar *)"2.0"); -- cgit v1.2.3