Replaces e_source_combo_box_get_active().
Returns a new ESource reference that the caller must unreference.
e_source_combo_box_new
e_source_combo_box_get_source_list
e_source_combo_box_set_source_list
-e_source_combo_box_get_active
+e_source_combo_box_ref_active
e_source_combo_box_set_active
<SUBSECTION Standard>
E_SOURCE_COMBO_BOX
ESource *source;
gpointer parent;
- source = e_source_combo_box_get_active (source_combo_box);
+ source = e_source_combo_box_ref_active (source_combo_box);
parent = gtk_widget_get_toplevel (GTK_WIDGET (name_selector_dialog));
parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
source, E_CLIENT_SOURCE_TYPE_CONTACTS, TRUE, cancellable,
e_client_utils_authenticate_handler, parent,
book_loaded_cb, g_object_ref (name_selector_dialog));
+
+ g_object_unref (source);
}
/* --------------- *
}
/**
- * e_source_combo_box_get_active:
+ * e_source_combo_box_ref_active:
* @combo_box: an #ESourceComboBox
*
* Returns the #ESource corresponding to the currently active item,
* or %NULL if there is no active item.
*
+ * The returned #ESource is referenced for thread-safety and must be
+ * unreferenced with g_object_unref() when finished with it.
+ *
* Returns: an #ESource or %NULL
*
- * Since: 2.22
+ * Since: 3.6
**/
ESource *
-e_source_combo_box_get_active (ESourceComboBox *combo_box)
+e_source_combo_box_ref_active (ESourceComboBox *combo_box)
{
GtkComboBox *gtk_combo_box;
GtkTreeIter iter;
gtk_combo_box_get_model (gtk_combo_box),
&iter, COLUMN_SOURCE, &source, -1);
- if (source != NULL)
- g_object_unref (source);
-
return source;
}
void e_source_combo_box_set_source_list
(ESourceComboBox *combo_box,
ESourceList *source_list);
-ESource * e_source_combo_box_get_active
- (ESourceComboBox *combo_box);
-void e_source_combo_box_set_active
- (ESourceComboBox *combo_box,
+ESource * e_source_combo_box_ref_active (ESourceComboBox *combo_box);
+void e_source_combo_box_set_active (ESourceComboBox *combo_box,
ESource *source);
G_END_DECLS
{
ESource *source;
- source = e_source_combo_box_get_active (combo_box);
- g_print ("source selected: \"%s\"\n", e_source_get_display_name (source));
+ source = e_source_combo_box_ref_active (combo_box);
+ if (source != NULL) {
+ const gchar *display_name;
+ display_name = e_source_get_display_name (source);
+ g_print ("source selected: \"%s\"\n", display_name);
+ g_object_unref (source);
+ } else {
+ g_print ("source selected: (none)\n");
+ }
}
static gint