[gimp] Bug 675436 - Tabs always present when docks shown and absent when docks hidden
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 675436 - Tabs always present when docks shown and absent when docks hidden
- Date: Sun, 21 Jul 2013 16:20:33 +0000 (UTC)
commit 816f651b8277ee9720c52a13f7abd3a074dc82dc
Author: Jehan <jehan girinstud io>
Date: Wed Jul 3 19:44:53 2013 +0900
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.
app/display/gimpdisplayshell.c | 11 ++++++++-
app/display/gimpimagewindow.c | 45 +++++++++++++++++++++++++++++----------
app/display/gimpimagewindow.h | 2 +
3 files changed, 45 insertions(+), 13 deletions(-)
---
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index 897c3ef..afbcbfb 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -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
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index c9ccf18..ffec137 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -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 */
diff --git a/app/display/gimpimagewindow.h b/app/display/gimpimagewindow.h
index f239629..14fb14e 100644
--- a/app/display/gimpimagewindow.h
+++ b/app/display/gimpimagewindow.h
@@ -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__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]