[gimp] app: Add option in the windows menu to hide the image tab bar.
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: Add option in the windows menu to hide the image tab bar.
- Date: Tue, 23 Oct 2018 09:56:11 +0000 (UTC)
commit 1ca2d744111f53dae8f7311833aa2ea646c555a1
Author: Sergio Jiménez Herena <sergio jimenez herena gmail com>
Date: Thu Oct 18 15:47:30 2018 +0200
app: Add option in the windows menu to hide the image tab bar.
(cherry picked from commit 360aee10d8cc0de55072f78095e064f2e35bd5df)
app/actions/windows-actions.c | 9 +++++++++
app/actions/windows-commands.c | 17 +++++++++++++++++
app/actions/windows-commands.h | 4 ++++
app/config/gimpguiconfig.c | 16 ++++++++++++++++
app/config/gimpguiconfig.h | 1 +
app/config/gimprc-blurbs.h | 3 +++
app/display/gimpimagewindow.c | 5 +++++
app/gui/session.c | 22 ++++++++++++++++++++++
app/widgets/gimphelp-ids.h | 1 +
menus/image-menu.xml.in | 1 +
10 files changed, 79 insertions(+)
---
diff --git a/app/actions/windows-actions.c b/app/actions/windows-actions.c
index a9a6258174..6284b89f8d 100644
--- a/app/actions/windows-actions.c
+++ b/app/actions/windows-actions.c
@@ -126,6 +126,13 @@ static const GimpToggleActionEntry windows_toggle_actions[] =
FALSE,
GIMP_HELP_WINDOWS_HIDE_DOCKS },
+ { "windows-show-tabs", NULL,
+ NC_("windows-action", "Show Tabs"), NULL,
+ NC_("windows-action", "When enabled, the image tabs bar is shown."),
+ G_CALLBACK (windows_show_tabs_cmd_callback),
+ FALSE,
+ GIMP_HELP_WINDOWS_SHOW_TABS },
+
{ "windows-use-single-window-mode", NULL,
NC_("windows-action", "Single-Window Mode"), NULL,
NC_("windows-action", "When enabled, GIMP is in a single-window mode."),
@@ -249,6 +256,7 @@ windows_actions_update (GimpActionGroup *group,
SET_ACTIVE ("windows-use-single-window-mode", config->single_window_mode);
SET_ACTIVE ("windows-hide-docks", config->hide_docks);
+ SET_ACTIVE ("windows-show-tabs", config->show_tabs);
switch (config->tabs_position)
{
@@ -271,6 +279,7 @@ windows_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_active (group, action, TRUE);
gimp_action_group_set_action_sensitive (group, "windows-tab-position", config->single_window_mode);
+ gimp_action_group_set_action_sensitive (group, "windows-show-tabs", config->single_window_mode);
#undef SET_ACTIVE
}
diff --git a/app/actions/windows-commands.c b/app/actions/windows-commands.c
index 02d2e5ce34..c3e7479dcd 100644
--- a/app/actions/windows-commands.c
+++ b/app/actions/windows-commands.c
@@ -65,6 +65,23 @@ windows_hide_docks_cmd_callback (GtkAction *action,
NULL);
}
+void
+windows_show_tabs_cmd_callback (GtkAction *action,
+ gpointer data)
+{
+ Gimp *gimp;
+ gboolean active;
+ return_if_no_gimp (gimp, data);
+
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+
+ if (active != GIMP_GUI_CONFIG (gimp->config)->show_tabs)
+ g_object_set (gimp->config,
+ "show-tabs", active,
+ NULL);
+}
+
+
void
windows_set_tabs_position_cmd_callback (GtkAction *action,
GtkAction *current,
diff --git a/app/actions/windows-commands.h b/app/actions/windows-commands.h
index c4d9a2a98e..88955b3dd4 100644
--- a/app/actions/windows-commands.h
+++ b/app/actions/windows-commands.h
@@ -21,6 +21,10 @@
void windows_hide_docks_cmd_callback (GtkAction *action,
gpointer data);
+
+void windows_show_tabs_cmd_callback (GtkAction *action,
+ gpointer data);
+
void windows_set_tabs_position_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data);
diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c
index 57c5bc11f7..3848828a45 100644
--- a/app/config/gimpguiconfig.c
+++ b/app/config/gimpguiconfig.c
@@ -88,6 +88,7 @@ enum
PROP_HIDE_DOCKS,
PROP_SINGLE_WINDOW_MODE,
+ PROP_SHOW_TABS,
PROP_TABS_POSITION,
PROP_LAST_TIP_SHOWN,
@@ -426,6 +427,15 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
G_PARAM_CONSTRUCT |
GIMP_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class, PROP_SHOW_TABS,
+ g_param_spec_boolean ("show-tabs",
+ NULL,
+ SHOW_TABS_BLURB,
+ TRUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ GIMP_PARAM_STATIC_STRINGS));
+
g_object_class_install_property (object_class, PROP_TABS_POSITION,
g_param_spec_enum ("tabs-position", NULL, NULL,
GIMP_TYPE_POSITION,
@@ -669,6 +679,9 @@ gimp_gui_config_set_property (GObject *object,
case PROP_SINGLE_WINDOW_MODE:
gui_config->single_window_mode = g_value_get_boolean (value);
break;
+ case PROP_SHOW_TABS:
+ gui_config->show_tabs = g_value_get_boolean (value);
+ break;
case PROP_TABS_POSITION:
gui_config->tabs_position = g_value_get_enum (value);
break;
@@ -826,6 +839,9 @@ gimp_gui_config_get_property (GObject *object,
case PROP_SINGLE_WINDOW_MODE:
g_value_set_boolean (value, gui_config->single_window_mode);
break;
+ case PROP_SHOW_TABS:
+ g_value_set_boolean (value, gui_config->show_tabs);
+ break;
case PROP_TABS_POSITION:
g_value_set_enum (value, gui_config->tabs_position);
break;
diff --git a/app/config/gimpguiconfig.h b/app/config/gimpguiconfig.h
index d3e94de0ee..85036d12d7 100644
--- a/app/config/gimpguiconfig.h
+++ b/app/config/gimpguiconfig.h
@@ -85,6 +85,7 @@ struct _GimpGuiConfig
/* saved in sessionrc */
gboolean hide_docks;
gboolean single_window_mode;
+ gboolean show_tabs;
GimpPosition tabs_position;
gint last_tip_shown;
};
diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h
index 41a0726caa..a28a115e51 100644
--- a/app/config/gimprc-blurbs.h
+++ b/app/config/gimprc-blurbs.h
@@ -418,6 +418,9 @@ _("Use GIMP in a single-window mode.")
#define HIDE_DOCKS_BLURB \
_("Hide docks and other windows, leaving only image windows.")
+#define SHOW_TABS_BLURB \
+_("Show the image tabs bar in single window mode.")
+
#define PLAYGROUND_NPD_TOOL_BLURB \
_("Enable the N-Point Deformation tool.")
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index c5a4ee3c71..4fa5622a5c 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -477,6 +477,9 @@ gimp_image_window_constructed (GObject *object)
g_signal_connect_object (config, "notify::single-window-mode",
G_CALLBACK (gimp_image_window_config_notify),
window, G_CONNECT_SWAPPED);
+ g_signal_connect_object (config, "notify::show-tabs",
+ G_CALLBACK (gimp_image_window_config_notify),
+ window, G_CONNECT_SWAPPED);
g_signal_connect_object (config, "notify::hide-docks",
G_CALLBACK (gimp_image_window_config_notify),
window, G_CONNECT_SWAPPED);
@@ -1722,6 +1725,7 @@ gimp_image_window_update_tabs (GimpImageWindow *window)
/* Tab visibility. */
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (private->notebook),
config->single_window_mode &&
+ config->show_tabs &&
! config->hide_docks &&
((private->active_shell &&
private->active_shell->display &&
@@ -1782,6 +1786,7 @@ gimp_image_window_config_notify (GimpImageWindow *window,
/* Dock column visibility */
if (strcmp (pspec->name, "single-window-mode") == 0 ||
strcmp (pspec->name, "hide-docks") == 0 ||
+ strcmp (pspec->name, "show-tabs") == 0 ||
strcmp (pspec->name, "tabs-position") == 0)
{
if (strcmp (pspec->name, "single-window-mode") == 0 ||
diff --git a/app/gui/session.c b/app/gui/session.c
index 4c28c780d9..251bac53e6 100644
--- a/app/gui/session.c
+++ b/app/gui/session.c
@@ -51,6 +51,7 @@ enum
SESSION_INFO = 1,
HIDE_DOCKS,
SINGLE_WINDOW_MODE,
+ SHOW_TABS,
TABS_POSITION,
LAST_TIP_SHOWN
};
@@ -106,6 +107,8 @@ session_init (Gimp *gimp)
GINT_TO_POINTER (HIDE_DOCKS));
g_scanner_scope_add_symbol (scanner, 0, "single-window-mode",
GINT_TO_POINTER (SINGLE_WINDOW_MODE));
+ g_scanner_scope_add_symbol (scanner, 0, "show-tabs",
+ GINT_TO_POINTER (SHOW_TABS));
g_scanner_scope_add_symbol (scanner, 0, "tabs-position",
GINT_TO_POINTER (TABS_POSITION));
g_scanner_scope_add_symbol (scanner, 0, "last-tip-shown",
@@ -246,6 +249,19 @@ session_init (Gimp *gimp)
"single-window-mode", single_window_mode,
NULL);
}
+ else if (scanner->value.v_symbol == GINT_TO_POINTER (SHOW_TABS))
+ {
+ gboolean show_tabs;
+
+ token = G_TOKEN_IDENTIFIER;
+
+ if (! gimp_scanner_parse_boolean (scanner, &show_tabs))
+ break;
+
+ g_object_set (gimp->config,
+ "show-tabs", show_tabs,
+ NULL);
+ }
else if (scanner->value.v_symbol == GINT_TO_POINTER (TABS_POSITION))
{
gint tabs_position;
@@ -384,6 +400,12 @@ session_save (Gimp *gimp,
"yes" : "no");
gimp_config_writer_close (writer);
+ gimp_config_writer_open (writer, "show-tabs");
+ gimp_config_writer_printf (writer,
+ GIMP_GUI_CONFIG (gimp->config)->show_tabs ?
+ "yes" : "no");
+ gimp_config_writer_close (writer);
+
gimp_config_writer_open (writer, "tabs-position");
gimp_config_writer_printf (writer, "%d",
GIMP_GUI_CONFIG (gimp->config)->tabs_position);
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index 4e998f1ede..69478f472d 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -718,6 +718,7 @@
#define GIMP_HELP_WINDOWS_SHOW_DOCK "gimp-windows-show-dock"
#define GIMP_HELP_WINDOWS_HIDE_DOCKS "gimp-windows-hide-docks"
+#define GIMP_HELP_WINDOWS_SHOW_TABS "gimp-windows-show-tabs"
#define GIMP_HELP_WINDOWS_TABS_POSITION "gimp-windows-tabs-position"
#define GIMP_HELP_WINDOWS_USE_SINGLE_WINDOW_MODE "gimp-windows-use-single-window-mode"
#define GIMP_HELP_WINDOWS_OPEN_RECENT_DOCK "gimp-windows-open-recent-dock"
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 839c2e4904..7a3bd08ed0 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -843,6 +843,7 @@
</placeholder>
<separator />
<menuitem action="windows-hide-docks" />
+ <menuitem action="windows-show-tabs" />
<menu action="windows-tab-position" name="Position">
<menuitem action="windows-tabs-position-top" />
<menuitem action="windows-tabs-position-bottom" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]