Commit 1ca2d744 authored by Sergio Jiménez Herena's avatar Sergio Jiménez Herena Committed by Michael Natterer
Browse files

app: Add option in the windows menu to hide the image tab bar.

(cherry picked from commit 360aee10)
parent 1915c175
...@@ -126,6 +126,13 @@ static const GimpToggleActionEntry windows_toggle_actions[] = ...@@ -126,6 +126,13 @@ static const GimpToggleActionEntry windows_toggle_actions[] =
FALSE, FALSE,
GIMP_HELP_WINDOWS_HIDE_DOCKS }, 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, { "windows-use-single-window-mode", NULL,
NC_("windows-action", "Single-Window Mode"), NULL, NC_("windows-action", "Single-Window Mode"), NULL,
NC_("windows-action", "When enabled, GIMP is in a single-window mode."), NC_("windows-action", "When enabled, GIMP is in a single-window mode."),
...@@ -249,6 +256,7 @@ windows_actions_update (GimpActionGroup *group, ...@@ -249,6 +256,7 @@ windows_actions_update (GimpActionGroup *group,
SET_ACTIVE ("windows-use-single-window-mode", config->single_window_mode); SET_ACTIVE ("windows-use-single-window-mode", config->single_window_mode);
SET_ACTIVE ("windows-hide-docks", config->hide_docks); SET_ACTIVE ("windows-hide-docks", config->hide_docks);
SET_ACTIVE ("windows-show-tabs", config->show_tabs);
switch (config->tabs_position) switch (config->tabs_position)
{ {
...@@ -271,6 +279,7 @@ windows_actions_update (GimpActionGroup *group, ...@@ -271,6 +279,7 @@ windows_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_active (group, action, TRUE); 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-tab-position", config->single_window_mode);
gimp_action_group_set_action_sensitive (group, "windows-show-tabs", config->single_window_mode);
#undef SET_ACTIVE #undef SET_ACTIVE
} }
......
...@@ -65,6 +65,23 @@ windows_hide_docks_cmd_callback (GtkAction *action, ...@@ -65,6 +65,23 @@ windows_hide_docks_cmd_callback (GtkAction *action,
NULL); 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 void
windows_set_tabs_position_cmd_callback (GtkAction *action, windows_set_tabs_position_cmd_callback (GtkAction *action,
GtkAction *current, GtkAction *current,
......
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
void windows_hide_docks_cmd_callback (GtkAction *action, void windows_hide_docks_cmd_callback (GtkAction *action,
gpointer data); gpointer data);
void windows_show_tabs_cmd_callback (GtkAction *action,
gpointer data);
void windows_set_tabs_position_cmd_callback (GtkAction *action, void windows_set_tabs_position_cmd_callback (GtkAction *action,
GtkAction *current, GtkAction *current,
gpointer data); gpointer data);
......
...@@ -88,6 +88,7 @@ enum ...@@ -88,6 +88,7 @@ enum
PROP_HIDE_DOCKS, PROP_HIDE_DOCKS,
PROP_SINGLE_WINDOW_MODE, PROP_SINGLE_WINDOW_MODE,
PROP_SHOW_TABS,
PROP_TABS_POSITION, PROP_TABS_POSITION,
PROP_LAST_TIP_SHOWN, PROP_LAST_TIP_SHOWN,
...@@ -426,6 +427,15 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass) ...@@ -426,6 +427,15 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT |
GIMP_PARAM_STATIC_STRINGS)); 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_object_class_install_property (object_class, PROP_TABS_POSITION,
g_param_spec_enum ("tabs-position", NULL, NULL, g_param_spec_enum ("tabs-position", NULL, NULL,
GIMP_TYPE_POSITION, GIMP_TYPE_POSITION,
...@@ -669,6 +679,9 @@ gimp_gui_config_set_property (GObject *object, ...@@ -669,6 +679,9 @@ gimp_gui_config_set_property (GObject *object,
case PROP_SINGLE_WINDOW_MODE: case PROP_SINGLE_WINDOW_MODE:
gui_config->single_window_mode = g_value_get_boolean (value); gui_config->single_window_mode = g_value_get_boolean (value);
break; break;
case PROP_SHOW_TABS:
gui_config->show_tabs = g_value_get_boolean (value);
break;
case PROP_TABS_POSITION: case PROP_TABS_POSITION:
gui_config->tabs_position = g_value_get_enum (value); gui_config->tabs_position = g_value_get_enum (value);
break; break;
...@@ -826,6 +839,9 @@ gimp_gui_config_get_property (GObject *object, ...@@ -826,6 +839,9 @@ gimp_gui_config_get_property (GObject *object,
case PROP_SINGLE_WINDOW_MODE: case PROP_SINGLE_WINDOW_MODE:
g_value_set_boolean (value, gui_config->single_window_mode); g_value_set_boolean (value, gui_config->single_window_mode);
break; break;
case PROP_SHOW_TABS:
g_value_set_boolean (value, gui_config->show_tabs);
break;
case PROP_TABS_POSITION: case PROP_TABS_POSITION:
g_value_set_enum (value, gui_config->tabs_position); g_value_set_enum (value, gui_config->tabs_position);
break; break;
......
...@@ -85,6 +85,7 @@ struct _GimpGuiConfig ...@@ -85,6 +85,7 @@ struct _GimpGuiConfig
/* saved in sessionrc */ /* saved in sessionrc */
gboolean hide_docks; gboolean hide_docks;
gboolean single_window_mode; gboolean single_window_mode;
gboolean show_tabs;
GimpPosition tabs_position; GimpPosition tabs_position;
gint last_tip_shown; gint last_tip_shown;
}; };
......
...@@ -418,6 +418,9 @@ _("Use GIMP in a single-window mode.") ...@@ -418,6 +418,9 @@ _("Use GIMP in a single-window mode.")
#define HIDE_DOCKS_BLURB \ #define HIDE_DOCKS_BLURB \
_("Hide docks and other windows, leaving only image windows.") _("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 \ #define PLAYGROUND_NPD_TOOL_BLURB \
_("Enable the N-Point Deformation tool.") _("Enable the N-Point Deformation tool.")
......
...@@ -477,6 +477,9 @@ gimp_image_window_constructed (GObject *object) ...@@ -477,6 +477,9 @@ gimp_image_window_constructed (GObject *object)
g_signal_connect_object (config, "notify::single-window-mode", g_signal_connect_object (config, "notify::single-window-mode",
G_CALLBACK (gimp_image_window_config_notify), G_CALLBACK (gimp_image_window_config_notify),
window, G_CONNECT_SWAPPED); 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_signal_connect_object (config, "notify::hide-docks",
G_CALLBACK (gimp_image_window_config_notify), G_CALLBACK (gimp_image_window_config_notify),
window, G_CONNECT_SWAPPED); window, G_CONNECT_SWAPPED);
...@@ -1722,6 +1725,7 @@ gimp_image_window_update_tabs (GimpImageWindow *window) ...@@ -1722,6 +1725,7 @@ gimp_image_window_update_tabs (GimpImageWindow *window)
/* Tab visibility. */ /* Tab visibility. */
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (private->notebook), gtk_notebook_set_show_tabs (GTK_NOTEBOOK (private->notebook),
config->single_window_mode && config->single_window_mode &&
config->show_tabs &&
! config->hide_docks && ! config->hide_docks &&
((private->active_shell && ((private->active_shell &&
private->active_shell->display && private->active_shell->display &&
...@@ -1782,6 +1786,7 @@ gimp_image_window_config_notify (GimpImageWindow *window, ...@@ -1782,6 +1786,7 @@ gimp_image_window_config_notify (GimpImageWindow *window,
/* Dock column visibility */ /* Dock column visibility */
if (strcmp (pspec->name, "single-window-mode") == 0 || if (strcmp (pspec->name, "single-window-mode") == 0 ||
strcmp (pspec->name, "hide-docks") == 0 || strcmp (pspec->name, "hide-docks") == 0 ||
strcmp (pspec->name, "show-tabs") == 0 ||
strcmp (pspec->name, "tabs-position") == 0) strcmp (pspec->name, "tabs-position") == 0)
{ {
if (strcmp (pspec->name, "single-window-mode") == 0 || if (strcmp (pspec->name, "single-window-mode") == 0 ||
......
...@@ -51,6 +51,7 @@ enum ...@@ -51,6 +51,7 @@ enum
SESSION_INFO = 1, SESSION_INFO = 1,
HIDE_DOCKS, HIDE_DOCKS,
SINGLE_WINDOW_MODE, SINGLE_WINDOW_MODE,
SHOW_TABS,
TABS_POSITION, TABS_POSITION,
LAST_TIP_SHOWN LAST_TIP_SHOWN
}; };
...@@ -106,6 +107,8 @@ session_init (Gimp *gimp) ...@@ -106,6 +107,8 @@ session_init (Gimp *gimp)
GINT_TO_POINTER (HIDE_DOCKS)); GINT_TO_POINTER (HIDE_DOCKS));
g_scanner_scope_add_symbol (scanner, 0, "single-window-mode", g_scanner_scope_add_symbol (scanner, 0, "single-window-mode",
GINT_TO_POINTER (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", g_scanner_scope_add_symbol (scanner, 0, "tabs-position",
GINT_TO_POINTER (TABS_POSITION)); GINT_TO_POINTER (TABS_POSITION));
g_scanner_scope_add_symbol (scanner, 0, "last-tip-shown", g_scanner_scope_add_symbol (scanner, 0, "last-tip-shown",
...@@ -246,6 +249,19 @@ session_init (Gimp *gimp) ...@@ -246,6 +249,19 @@ session_init (Gimp *gimp)
"single-window-mode", single_window_mode, "single-window-mode", single_window_mode,
NULL); 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)) else if (scanner->value.v_symbol == GINT_TO_POINTER (TABS_POSITION))
{ {
gint tabs_position; gint tabs_position;
...@@ -384,6 +400,12 @@ session_save (Gimp *gimp, ...@@ -384,6 +400,12 @@ session_save (Gimp *gimp,
"yes" : "no"); "yes" : "no");
gimp_config_writer_close (writer); 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_open (writer, "tabs-position");
gimp_config_writer_printf (writer, "%d", gimp_config_writer_printf (writer, "%d",
GIMP_GUI_CONFIG (gimp->config)->tabs_position); GIMP_GUI_CONFIG (gimp->config)->tabs_position);
......
...@@ -718,6 +718,7 @@ ...@@ -718,6 +718,7 @@
#define GIMP_HELP_WINDOWS_SHOW_DOCK "gimp-windows-show-dock" #define GIMP_HELP_WINDOWS_SHOW_DOCK "gimp-windows-show-dock"
#define GIMP_HELP_WINDOWS_HIDE_DOCKS "gimp-windows-hide-docks" #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_TABS_POSITION "gimp-windows-tabs-position"
#define GIMP_HELP_WINDOWS_USE_SINGLE_WINDOW_MODE "gimp-windows-use-single-window-mode" #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" #define GIMP_HELP_WINDOWS_OPEN_RECENT_DOCK "gimp-windows-open-recent-dock"
......
...@@ -843,6 +843,7 @@ ...@@ -843,6 +843,7 @@
</placeholder> </placeholder>
<separator /> <separator />
<menuitem action="windows-hide-docks" /> <menuitem action="windows-hide-docks" />
<menuitem action="windows-show-tabs" />
<menu action="windows-tab-position" name="Position"> <menu action="windows-tab-position" name="Position">
<menuitem action="windows-tabs-position-top" /> <menuitem action="windows-tabs-position-top" />
<menuitem action="windows-tabs-position-bottom" /> <menuitem action="windows-tabs-position-bottom" />
......
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