[gimp/wip/Jehan/layers-dockable-refresh] app: make sure the GimpContainerPopup shows the right item as selected…
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/Jehan/layers-dockable-refresh] app: make sure the GimpContainerPopup shows the right item as selected…
- Date: Fri, 5 Nov 2021 18:58:49 +0000 (UTC)
commit 8ab6b0f0a42d08423602c17158c178a88daf8e97
Author: Jehan <jehan girinstud io>
Date: Fri Nov 5 19:55:57 2021 +0100
app: make sure the GimpContainerPopup shows the right item as selected…
… for the case of data managed by the GimpContext.
Checking stable and dev builds, it looks this just never worked and used
to just show no selection. Now it is more annoying as it shows a
selected item, but not the right one. Just make sure it shows whatever
is currently selected.
app/widgets/gimpcontainerpopup.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
---
diff --git a/app/widgets/gimpcontainerpopup.c b/app/widgets/gimpcontainerpopup.c
index 22b713a640..76a0ba0355 100644
--- a/app/widgets/gimpcontainerpopup.c
+++ b/app/widgets/gimpcontainerpopup.c
@@ -275,10 +275,12 @@ gimp_container_popup_set_view_size (GimpContainerPopup *popup,
static void
gimp_container_popup_create_view (GimpContainerPopup *popup)
{
- GimpEditor *editor;
- GtkWidget *button;
- gint rows;
- gint columns;
+ GimpEditor *editor;
+ GtkWidget *button;
+ const gchar *signal_name;
+ GType children_type;
+ gint rows;
+ gint columns;
popup->editor = g_object_new (GIMP_TYPE_CONTAINER_EDITOR,
"view-type", popup->view_type,
@@ -353,6 +355,26 @@ gimp_container_popup_create_view (GimpContainerPopup *popup)
popup);
gtk_widget_grab_focus (GTK_WIDGET (popup->editor));
+
+ /* Special-casing the object types managed by the context to make sure
+ * the right items are selected when opening the popup.
+ */
+ children_type = gimp_container_get_children_type (popup->container);
+ signal_name = gimp_context_type_to_signal_name (children_type);
+
+ if (signal_name)
+ {
+ GimpObject *object;
+ GList *items = NULL;
+
+ object = gimp_context_get_by_type (popup->context, children_type);
+ if (object)
+ items = g_list_prepend (NULL, object);
+
+ gimp_container_view_select_items (popup->editor->view, items);
+
+ g_list_free (items);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]