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().
This commit is contained in:
Michael Natterer 2009-06-05 22:21:19 +02:00
parent 8f37a96d70
commit 38e9012023
1 changed files with 39 additions and 10 deletions

View File

@ -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);