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

(cherry picked from commit 360aee10d8)
This commit is contained in:
Sergio Jiménez Herena 2018-10-18 15:47:30 +02:00 committed by Michael Natterer
parent 1915c17584
commit 1ca2d74411
10 changed files with 79 additions and 0 deletions

View File

@ -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
}

View File

@ -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,

View File

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

View File

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

View File

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

View File

@ -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.")

View File

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

View File

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

View File

@ -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"

View File

@ -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" />