[gimp/gimp-2-10] app: improve placement of new tools with existing toolrc
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: improve placement of new tools with existing toolrc
- Date: Fri, 10 Jan 2020 16:45:14 +0000 (UTC)
commit 81435646279145a2e55f892b2fc34f4171af757c
Author: Ell <ell_se yahoo com>
Date: Fri Jan 10 18:36:27 2020 +0200
app: improve placement of new tools with existing toolrc
When ordering tools according to an existing toolrc file (which
is always present in a pre-existing profile), preserve the default
placement of newly-added tools, instead of always adding them to
the bottom of the list.
(cherry picked from commit 58d04375c9692a5651d059923661b3babae5fa9f)
app/tools/gimp-tools.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/app/tools/gimp-tools.c b/app/tools/gimp-tools.c
index 895ceb13b2..2073d9cf05 100644
--- a/app/tools/gimp-tools.c
+++ b/app/tools/gimp-tools.c
@@ -275,12 +275,11 @@ gimp_tools_restore (Gimp *gimp)
if (gimp_config_deserialize_gfile (GIMP_CONFIG (gimp_list), file,
NULL, &error))
{
- gint n = gimp_container_get_n_children (gimp->tool_info_list);
- gint i;
+ gint i = 0;
- for (list = GIMP_LIST (gimp_list)->queue->head, i = 0;
+ for (list = GIMP_LIST (gimp_list)->queue->head;
list;
- list = g_list_next (list), i++)
+ list = g_list_next (list))
{
const gchar *name = gimp_object_get_name (list->data);
@@ -289,12 +288,21 @@ gimp_tools_restore (Gimp *gimp)
if (object)
{
+ while (! gimp_container_get_child_by_name (
+ gimp_list,
+ gimp_object_get_name (
+ gimp_container_get_child_by_index (
+ gimp->tool_info_list, i))))
+ {
+ i++;
+ }
+
g_object_set (object,
"visible", GIMP_TOOL_INFO (list->data)->visible,
NULL);
gimp_container_reorder (gimp->tool_info_list,
- object, MIN (i, n - 1));
+ object, i++);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]