[gimp] app: Make Recently Used Docks work with GIMP 2.6 dockrc files
- From: Martin Nordholts <martinn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: Make Recently Used Docks work with GIMP 2.6 dockrc files
- Date: Sat, 20 Feb 2010 12:03:36 +0000 (UTC)
commit ea6efc3885c2b57812cfcd2a47dc569d49ef11bf
Author: Martin Nordholts <martinn src gnome org>
Date: Sat Feb 20 13:05:00 2010 +0100
app: Make Recently Used Docks work with GIMP 2.6 dockrc files
In GIMP 2.6 dockrc did not contain the factory entries for the session
infos, so set that up manually if needed. Also take the opportunity to
add a copyright notice to dialogs.c since tha file is almost rewritten
by now...
app/dialogs/dialogs.c | 27 +++++++++++++++++++++
app/tests/gimpdir/dockrc-expected | 44 +++++++++++++++++++++++++++++++++++
app/tests/test-session-management.c | 2 +-
3 files changed, 72 insertions(+), 1 deletions(-)
---
diff --git a/app/dialogs/dialogs.c b/app/dialogs/dialogs.c
index fa20019..62f1fbf 100644
--- a/app/dialogs/dialogs.c
+++ b/app/dialogs/dialogs.c
@@ -1,6 +1,9 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
+ * dialogs.c
+ * Copyright (C) 2010 Martin Nordholts <martinn src gnome org>
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
@@ -420,6 +423,23 @@ dialogs_exit (Gimp *gimp)
}
}
+static void
+dialogs_ensure_factory_entry_on_recent_dock (GimpSessionInfo *info)
+{
+ if (! gimp_session_info_get_factory_entry (info))
+ {
+ GimpDialogFactoryEntry *entry = NULL;
+
+ /* The recent docks container only contains session infos for
+ * dock windows
+ */
+ entry = gimp_dialog_factory_find_entry (global_dialog_factory,
+ "gimp-dock-window");
+
+ gimp_session_info_set_factory_entry (info, entry);
+ }
+}
+
void
dialogs_load_recent_docks (Gimp *gimp)
{
@@ -443,6 +463,13 @@ dialogs_load_recent_docks (Gimp *gimp)
g_clear_error (&error);
}
+ /* In GIMP 2.6 dockrc did not contain the factory entries for the
+ * session infos, so set that up manually if needed
+ */
+ gimp_container_foreach (global_recent_docks,
+ (GFunc) dialogs_ensure_factory_entry_on_recent_dock,
+ NULL);
+
gimp_list_reverse (GIMP_LIST (global_recent_docks));
g_free (filename);
diff --git a/app/tests/gimpdir/dockrc-expected b/app/tests/gimpdir/dockrc-expected
new file mode 100644
index 0000000..045fa4b
--- /dev/null
+++ b/app/tests/gimpdir/dockrc-expected
@@ -0,0 +1,44 @@
+# recently closed docks
+
+(GimpSessionInfo "Palettes - FG/BG - Images"
+ (factory-entry "gimp-dock-window")
+ (position 586 116)
+ (size 200 573)
+ (open-on-exit)
+ (aux-info
+ (show-image-menu "false")
+ (follow-active-image "true"))
+ (gimp-dock
+ (book
+ (current-page 0)
+ (dockable "gimp-palette-list"
+ (tab-style preview)))
+ (book
+ (position 141)
+ (current-page 0)
+ (dockable "gimp-color-editor"
+ (tab-style preview)
+ (aux-info
+ (current-page "GimpColorSelect"))))
+ (book
+ (position 414)
+ (current-page 0)
+ (dockable "gimp-image-list"
+ (tab-style preview)))))
+(GimpSessionInfo "Selection, Fonts"
+ (factory-entry "gimp-dock-window")
+ (position 200 179)
+ (size 200 300)
+ (open-on-exit)
+ (aux-info
+ (show-image-menu "false")
+ (follow-active-image "true"))
+ (gimp-dock
+ (book
+ (current-page 1)
+ (dockable "gimp-selection-editor"
+ (tab-style icon))
+ (dockable "gimp-font-list"
+ (tab-style preview)))))
+
+# end of recently closed docks
diff --git a/app/tests/test-session-management.c b/app/tests/test-session-management.c
index 48f79bb..f998e81 100644
--- a/app/tests/test-session-management.c
+++ b/app/tests/test-session-management.c
@@ -85,7 +85,7 @@ int main(int argc, char **argv)
* variant
*/
sessionrc_filename = gimp_personal_rc_file ("sessionrc-expected");
- dockrc_filename = gimp_personal_rc_file ("dockrc");
+ dockrc_filename = gimp_personal_rc_file ("dockrc-expected");
/* Remeber the modtimes and MD5s */
if (!gimp_test_get_file_state_verbose (sessionrc_filename,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]