[gimp] Bug 575158 – default view prefs should affect no-image window



commit 38e901202372413635b3bbf3506a9d543f69e983
Author: Michael Natterer <mitch gimp org>
Date:   Fri Jun 5 22:21:19 2009 +0200

    Bug 575158 â?? default view prefs should affect no-image window
    
    Add gimp_display_shell_sync_config() which copies the prefs settings
    to the display shell and call it from gimp_display_shell_new() and
    gimp_display_shell_fill().
---
 app/display/gimpdisplayshell.c |   49 +++++++++++++++++++++++++++++++--------
 1 files changed, 39 insertions(+), 10 deletions(-)

diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index 88ff73f..25e2af3 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -816,6 +816,41 @@ gimp_display_shell_zoom_button_callback (GimpDisplayShell *shell,
     }
 }
 
+static void
+gimp_display_shell_sync_config (GimpDisplayShell  *shell,
+                                GimpDisplayConfig *config)
+{
+  gimp_config_sync (G_OBJECT (config->default_view),
+                    G_OBJECT (shell->options), 0);
+  gimp_config_sync (G_OBJECT (config->default_fullscreen_view),
+                    G_OBJECT (shell->fullscreen_options), 0);
+
+  if (shell->display && shell->display->shell)
+    {
+      /*  if the shell is already fully constructed, use proper API
+       *  so the actions are updated accordingly.
+       */
+      gimp_display_shell_set_snap_to_guides  (shell,
+                                              config->default_snap_to_guides);
+      gimp_display_shell_set_snap_to_grid    (shell,
+                                              config->default_snap_to_grid);
+      gimp_display_shell_set_snap_to_canvas  (shell,
+                                              config->default_snap_to_canvas);
+      gimp_display_shell_set_snap_to_vectors (shell,
+                                              config->default_snap_to_path);
+    }
+  else
+    {
+      /*  otherwise the shell is currently being constructed and
+       *  display->shell is NULL.
+       */
+      shell->snap_to_guides  = config->default_snap_to_guides;
+      shell->snap_to_grid    = config->default_snap_to_grid;
+      shell->snap_to_canvas  = config->default_snap_to_canvas;
+      shell->snap_to_vectors = config->default_snap_to_path;
+    }
+}
+
 
 /*  public functions  */
 
@@ -886,16 +921,6 @@ gimp_display_shell_new (GimpDisplay       *display,
 
   shell->dot_for_dot = display->config->default_dot_for_dot;
 
-  gimp_config_sync (G_OBJECT (display->config->default_view),
-                    G_OBJECT (shell->options), 0);
-  gimp_config_sync (G_OBJECT (display->config->default_fullscreen_view),
-                    G_OBJECT (shell->fullscreen_options), 0);
-
-  shell->snap_to_guides  = display->config->default_snap_to_guides;
-  shell->snap_to_grid    = display->config->default_snap_to_grid;
-  shell->snap_to_canvas  = display->config->default_snap_to_canvas;
-  shell->snap_to_vectors = display->config->default_snap_to_path;
-
   screen = gtk_widget_get_screen (GTK_WIDGET (shell));
 
   if (display->config->monitor_res_from_gdk)
@@ -938,6 +963,8 @@ gimp_display_shell_new (GimpDisplay       *display,
                     G_CALLBACK (gimp_display_shell_hide_tooltip),
                     shell);
 
+  gimp_display_shell_sync_config (shell, display->config);
+
   /*  GtkTable widgets are not able to shrink a row/column correctly if
    *  widgets are attached with GTK_EXPAND even if those widgets have
    *  other rows/columns in their rowspan/colspan where they could
@@ -1461,6 +1488,8 @@ gimp_display_shell_fill (GimpDisplayShell *shell,
 
   gimp_statusbar_fill (GIMP_STATUSBAR (shell->statusbar));
 
+  gimp_display_shell_sync_config (shell, shell->display->config);
+
   gimp_display_shell_appearance_update (shell);
 
   gimp_help_set_help_data (shell->canvas, NULL, NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]