Commit 816f651b authored by Jehan's avatar Jehan

Bug 675436 - Tabs always present when docks shown and absent when docks hidden

The main change is that even with only 1 image in single window mode,
there is now a tab.
Also whatever the number of images when you hide docks with Tab, no tabs
are shown.
parent 092f239d
......@@ -1327,12 +1327,15 @@ gimp_display_shell_reconnect (GimpDisplayShell *shell)
void
gimp_display_shell_empty (GimpDisplayShell *shell)
{
GimpContext *user_context;
GimpContext *user_context;
GimpImageWindow *window;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (GIMP_IS_DISPLAY (shell->display));
g_return_if_fail (gimp_display_get_image (shell->display) == NULL);
window = gimp_display_shell_get_window (shell);
if (shell->fill_idle_id)
{
g_source_remove (shell->fill_idle_id);
......@@ -1346,6 +1349,7 @@ gimp_display_shell_empty (GimpDisplayShell *shell)
gimp_display_shell_sync_config (shell, shell->display->config);
gimp_display_shell_appearance_update (shell);
gimp_image_window_update_tabs (window);
#if 0
gimp_help_set_help_data (shell->canvas,
_("Drop image files here to open them"), NULL);
......@@ -1387,10 +1391,14 @@ gimp_display_shell_fill (GimpDisplayShell *shell,
GimpUnit unit,
gdouble scale)
{
GimpImageWindow *window;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (GIMP_IS_DISPLAY (shell->display));
g_return_if_fail (GIMP_IS_IMAGE (image));
window = gimp_display_shell_get_window (shell);
gimp_display_shell_set_unit (shell, unit);
gimp_display_shell_set_initial_scale (shell, scale, NULL, NULL);
gimp_display_shell_scale_changed (shell);
......@@ -1398,6 +1406,7 @@ gimp_display_shell_fill (GimpDisplayShell *shell,
gimp_display_shell_sync_config (shell, shell->display->config);
gimp_display_shell_appearance_update (shell);
gimp_image_window_update_tabs (window);
#if 0
gimp_help_set_help_data (shell->canvas, NULL, NULL);
#endif
......
......@@ -1051,12 +1051,6 @@ gimp_image_window_add_shell (GimpImageWindow *window,
private->shells = g_list_append (private->shells, shell);
if (g_list_length (private->shells) > 1)
{
gimp_image_window_keep_canvas_pos (window);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (private->notebook), TRUE);
}
tab_label = gimp_image_window_create_tab_label (window, shell);
gtk_notebook_append_page (GTK_NOTEBOOK (private->notebook),
......@@ -1095,12 +1089,6 @@ gimp_image_window_remove_shell (GimpImageWindow *window,
gtk_container_remove (GTK_CONTAINER (private->notebook),
GTK_WIDGET (shell));
if (g_list_length (private->shells) == 1)
{
gimp_image_window_keep_canvas_pos (window);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (private->notebook), FALSE);
}
}
gint
......@@ -1509,6 +1497,38 @@ gimp_image_window_keep_canvas_pos (GimpImageWindow *window)
}
/**
* gimp_image_window_update_tabs:
* @window: the Image Window to update.
*
* Holds the logics of whether shell tabs are to be shown or not in the
* Image Window @window. This function should be called after every
* change to @window where one might expect tab visibility to change.
*
* No direct call to gtk_notebook_set_show_tabs() should ever be made.
* If we change the logics of tab hiding, we should only change this
* procedure instead.
**/
void
gimp_image_window_update_tabs (GimpImageWindow *window)
{
GimpImageWindowPrivate *private;
GimpGuiConfig *config;
g_return_if_fail (GIMP_IS_IMAGE_WINDOW (window));
private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
config = GIMP_GUI_CONFIG (private->gimp->config);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (private->notebook),
config->single_window_mode &&
! config->hide_docks &&
((private->active_shell &&
private->active_shell->display &&
gimp_display_get_image (private->active_shell->display)) ||
g_list_length (private->shells) > 1));
}
/* private functions */
static void
......@@ -1545,6 +1565,7 @@ gimp_image_window_config_notify (GimpImageWindow *window,
gimp_image_window_keep_canvas_pos (window);
gtk_widget_set_visible (private->left_docks, show_docks);
gtk_widget_set_visible (private->right_docks, show_docks);
gimp_image_window_update_tabs (window);
}
/* Session management */
......
......@@ -92,4 +92,6 @@ GtkWidget * gimp_image_window_get_default_dockbook (GimpImageWindow *win
void gimp_image_window_keep_canvas_pos (GimpImageWindow *window);
void gimp_image_window_update_tabs (GimpImageWindow *window);
#endif /* __GIMP_IMAGE_WINDOW_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment