GtkSingleSelection
GTK_INVALID_LIST_POSITION
gtk_single_selection_new
+gtk_single_selection_get_model
gtk_single_selection_get_selected
gtk_single_selection_set_selected
gtk_single_selection_get_selected_item
case PROP_MODEL:
gtk_single_selection_clear_model (self);
self->model = g_value_dup_object (value);
- if (self->model)
- g_signal_connect (self->model, "items-changed",
- G_CALLBACK (gtk_single_selection_items_changed_cb), self);
+ g_signal_connect (self->model, "items-changed",
+ G_CALLBACK (gtk_single_selection_items_changed_cb), self);
if (self->autoselect)
gtk_single_selection_set_selected (self, 0);
break;
P_("The model"),
P_("The model being managed"),
G_TYPE_LIST_MODEL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, N_PROPS, properties);
}
NULL);
}
+/**
+ * gtk_single_selection_get_model:
+ * @self: a #GtkSingleSelection
+ *
+ * Gets the model that @self is wrapping.
+ *
+ * Returns: (transfer none): The model being wrapped
+ **/
+GListModel *
+gtk_single_selection_get_model (GtkSingleSelection *self)
+{
+ g_return_val_if_fail (GTK_IS_SINGLE_SELECTION (self), NULL);
+
+ return self->model;
+}
+
/**
* gtk_single_selection_get_selected:
* @self: a #GtkSingleSelection
G_DECLARE_FINAL_TYPE (GtkSingleSelection, gtk_single_selection, GTK, SINGLE_SELECTION, GObject)
GDK_AVAILABLE_IN_ALL
-GtkSingleSelection * gtk_single_selection_new (GListModel *model);
+GtkSingleSelection * gtk_single_selection_new (GListModel *model);
+GDK_AVAILABLE_IN_ALL
+GListModel * gtk_single_selection_get_model (GtkSingleSelection *self);
GDK_AVAILABLE_IN_ALL
guint gtk_single_selection_get_selected (GtkSingleSelection *self);
GDK_AVAILABLE_IN_ALL
instance = G_OBJECT (g_object_ref (gdk_surface_new_temp (display,
&(GdkRectangle) { 0, 0, 100, 100 })));
}
- else if (g_type_is_a (type, GTK_TYPE_FILTER_LIST_MODEL))
+ else if (g_type_is_a (type, GTK_TYPE_FILTER_LIST_MODEL) ||
+ g_type_is_a (type, GTK_TYPE_SINGLE_SELECTION))
{
GListStore *list_store = g_list_store_new (G_TYPE_OBJECT);
instance = g_object_new (type,
G_GNUC_END_IGNORE_DEPRECATIONS
- if (g_type_is_a (type, GTK_TYPE_FILTER_LIST_MODEL) &&
+ if ((g_type_is_a (type, GTK_TYPE_FILTER_LIST_MODEL) ||
+ g_type_is_a (type, GTK_TYPE_SINGLE_SELECTION)) &&
strcmp (pspec->name, "model") == 0)
continue;
NULL);
gdk_content_formats_unref (formats);
}
- else if (g_type_is_a (type, GTK_TYPE_FILTER_LIST_MODEL))
+ else if (g_type_is_a (type, GTK_TYPE_FILTER_LIST_MODEL) ||
+ g_type_is_a (type, GTK_TYPE_SINGLE_SELECTION))
{
GListStore *list_store = g_list_store_new (G_TYPE_OBJECT);
instance = g_object_new (type,
NULL);
gdk_content_formats_unref (formats);
}
- else if (g_type_is_a (test_type, GTK_TYPE_FILTER_LIST_MODEL))
+ else if (g_type_is_a (test_type, GTK_TYPE_FILTER_LIST_MODEL) ||
+ g_type_is_a (test_type, GTK_TYPE_SINGLE_SELECTION))
{
GListStore *list_store = g_list_store_new (G_TYPE_OBJECT);
object = g_object_new (test_type,