Merge branch 'wip/otte/for-master' into 'master'

Wip/otte/for master

See merge request GNOME/gtk!2122
This commit is contained in:
Matthias Clasen 2020-06-21 05:58:15 +00:00
commit 97b10df723
3 changed files with 6 additions and 41 deletions

View File

@ -471,29 +471,6 @@ get_title (gpointer item)
return g_strdup ((char *)g_object_get_data (G_OBJECT (item), "title"));
}
static gboolean
set_item (GBinding *binding,
const GValue *from,
GValue *to,
gpointer data)
{
GObject *source = g_binding_get_source (binding);
GListModel *model;
guint selected;
gpointer item;
selected = g_value_get_uint (from);
model = gtk_drop_down_get_model (GTK_DROP_DOWN (source));
item = g_list_model_get_item (model, selected);
g_value_set_object (to, item);
g_clear_object (&item);
return TRUE;
}
GtkWidget *
create_color_grid (void)
{
@ -663,11 +640,7 @@ do_listview_colors (GtkWidget *do_widget)
gtk_drop_down_set_model (GTK_DROP_DOWN (dropdown), G_LIST_MODEL (sorters));
g_object_unref (sorters);
g_object_bind_property_full (dropdown, "selected",
model, "sorter",
G_BINDING_SYNC_CREATE,
set_item, NULL,
NULL, NULL);
g_object_bind_property (dropdown, "selected-item", model, "sorter", G_BINDING_SYNC_CREATE);
factories = g_list_store_new (GTK_TYPE_LIST_ITEM_FACTORY);
@ -698,11 +671,7 @@ do_listview_colors (GtkWidget *do_widget)
gtk_drop_down_set_model (GTK_DROP_DOWN (dropdown), G_LIST_MODEL (factories));
g_object_unref (factories);
g_object_bind_property_full (dropdown, "selected",
gridview, "factory",
G_BINDING_SYNC_CREATE,
set_item, NULL,
NULL, NULL);
g_object_bind_property (dropdown, "selected-item", gridview, "factory", G_BINDING_SYNC_CREATE);
g_object_unref (model);
}

View File

@ -216,6 +216,9 @@ selection_changed (GtkSingleSelection *selection,
if (GTK_IS_STRING_FILTER (filter))
gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "");
gtk_single_selection_set_selected (GTK_SINGLE_SELECTION (self->popup_selection), selected);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SELECTED]);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SELECTED_ITEM]);
}
static void
@ -809,9 +812,6 @@ gtk_drop_down_set_selected (GtkDropDown *self,
return;
gtk_single_selection_set_selected (GTK_SINGLE_SELECTION (self->selection), position);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SELECTED]);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SELECTED_ITEM]);
}
/**

View File

@ -6929,17 +6929,13 @@ filter_combo_changed (GtkDropDown *dropdown,
GParamSpec *pspec,
GtkFileChooserWidget *impl)
{
gint new_index;
GtkFileFilter *new_filter;
new_index = gtk_drop_down_get_selected (dropdown);
new_filter = g_list_model_get_item (G_LIST_MODEL (impl->filters), new_index);
set_current_filter (impl, new_filter);
new_filter = gtk_drop_down_get_selected_item (dropdown);
if (impl->location_entry != NULL)
_gtk_file_chooser_entry_set_file_filter (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
new_filter);
g_object_unref (new_filter);
}
static gboolean