Add Always Show Tabbar preference
This commit is contained in:
parent
f7436303f6
commit
aa5602ec9e
3 changed files with 51 additions and 7 deletions
|
@ -167,14 +167,31 @@ _midori_browser_open_uri (MidoriBrowser* browser,
|
|||
midori_view_set_uri (MIDORI_VIEW (view), uri);
|
||||
}
|
||||
|
||||
static void
|
||||
_toggle_tabbar_smartly (MidoriBrowser* browser)
|
||||
{
|
||||
guint n;
|
||||
gboolean always_show_tabbar;
|
||||
|
||||
n = gtk_notebook_get_n_pages (GTK_NOTEBOOK (browser->notebook));
|
||||
if (n < 2)
|
||||
{
|
||||
g_object_get (browser->settings, "always-show-tabbar",
|
||||
&always_show_tabbar, NULL);
|
||||
if (always_show_tabbar)
|
||||
n++;
|
||||
}
|
||||
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (browser->notebook), n > 1);
|
||||
}
|
||||
|
||||
static void
|
||||
_midori_browser_update_actions (MidoriBrowser* browser)
|
||||
{
|
||||
guint n;
|
||||
gboolean trash_empty;
|
||||
|
||||
_toggle_tabbar_smartly (browser);
|
||||
n = gtk_notebook_get_n_pages (GTK_NOTEBOOK (browser->notebook));
|
||||
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (browser->notebook), n > 1);
|
||||
_action_set_sensitive (browser, "TabClose", n > 1);
|
||||
_action_set_sensitive (browser, "TabPrevious", n > 1);
|
||||
_action_set_sensitive (browser, "TabNext", n > 1);
|
||||
|
@ -695,6 +712,11 @@ midori_browser_tab_destroy_cb (GtkWidget* widget,
|
|||
midori_browser_tab_destroy_cb, browser);
|
||||
|
||||
g_signal_emit (browser, signals[REMOVE_TAB], 0, widget);
|
||||
|
||||
/* We don't ever want to be in a situation with no tabs,
|
||||
so just create an empty one if the last one is closed. */
|
||||
if (!midori_browser_get_current_tab (browser))
|
||||
midori_browser_add_uri (browser, "");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -3369,6 +3391,7 @@ _midori_browser_update_settings (MidoriBrowser* browser)
|
|||
}
|
||||
|
||||
_midori_browser_set_toolbar_style (browser, toolbar_style);
|
||||
_toggle_tabbar_smartly (browser);
|
||||
|
||||
if (browser->search_engines)
|
||||
{
|
||||
|
@ -3412,6 +3435,8 @@ midori_browser_settings_notify (MidoriWebSettings* web_settings,
|
|||
|
||||
if (name == g_intern_string ("toolbar-style"))
|
||||
_midori_browser_set_toolbar_style (browser, g_value_get_enum (&value));
|
||||
else if (name == g_intern_string ("always-show-tabbar"))
|
||||
_toggle_tabbar_smartly (browser);
|
||||
else if (name == g_intern_string ("show-new-tab"))
|
||||
sokoke_widget_set_visible (browser->button_tab_new,
|
||||
g_value_get_boolean (&value));
|
||||
|
|
|
@ -339,18 +339,20 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
|||
/* Page "Interface" */
|
||||
PAGE_NEW (_("Interface"));
|
||||
FRAME_NEW (_("Navigationbar"));
|
||||
TABLE_NEW (3, 2);
|
||||
TABLE_NEW (4, 2);
|
||||
INDENTED_ADD (katze_property_label (settings, "toolbar-style"), 0, 1, 0, 1);
|
||||
button = katze_property_proxy (settings, "toolbar-style", NULL);
|
||||
FILLED_ADD (button, 1, 2, 0, 1);
|
||||
button = katze_property_proxy (settings, "show-new-tab", NULL);
|
||||
button = katze_property_proxy (settings, "always-show-tabbar", NULL);
|
||||
INDENTED_ADD (button, 0, 1, 1, 2);
|
||||
button = katze_property_proxy (settings, "show-web-search", NULL);
|
||||
SPANNED_ADD (button, 1, 2, 1, 2);
|
||||
button = katze_property_proxy (settings, "show-homepage", NULL);
|
||||
button = katze_property_proxy (settings, "show-new-tab", NULL);
|
||||
INDENTED_ADD (button, 0, 1, 2, 3);
|
||||
button = katze_property_proxy (settings, "show-trash", NULL);
|
||||
button = katze_property_proxy (settings, "show-web-search", NULL);
|
||||
SPANNED_ADD (button, 1, 2, 2, 3);
|
||||
button = katze_property_proxy (settings, "show-homepage", NULL);
|
||||
INDENTED_ADD (button, 0, 1, 3, 4);
|
||||
button = katze_property_proxy (settings, "show-trash", NULL);
|
||||
SPANNED_ADD (button, 1, 2, 3, 4);
|
||||
FRAME_NEW (_("Browsing"));
|
||||
TABLE_NEW (3, 2);
|
||||
/* label = katze_property_label (settings, "open-new-pages-in");
|
||||
|
|
|
@ -34,6 +34,7 @@ struct _MidoriWebSettings
|
|||
gboolean show_statusbar;
|
||||
|
||||
MidoriToolbarStyle toolbar_style;
|
||||
gboolean always_show_tabbar;
|
||||
gboolean show_new_tab;
|
||||
gboolean show_homepage;
|
||||
gboolean show_web_search;
|
||||
|
@ -86,6 +87,7 @@ enum
|
|||
PROP_SHOW_STATUSBAR,
|
||||
|
||||
PROP_TOOLBAR_STYLE,
|
||||
PROP_ALWAYS_SHOW_TABBAR,
|
||||
PROP_SHOW_NEW_TAB,
|
||||
PROP_SHOW_HOMEPAGE,
|
||||
PROP_SHOW_WEB_SEARCH,
|
||||
|
@ -345,6 +347,15 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
|
|||
MIDORI_TOOLBAR_DEFAULT,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ALWAYS_SHOW_TABBAR,
|
||||
g_param_spec_boolean (
|
||||
"always-show-tabbar",
|
||||
_("Always Show Tabbar"),
|
||||
_("Always show the tabbar"),
|
||||
FALSE,
|
||||
flags));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHOW_NEW_TAB,
|
||||
g_param_spec_boolean (
|
||||
|
@ -669,6 +680,9 @@ midori_web_settings_set_property (GObject* object,
|
|||
case PROP_TOOLBAR_STYLE:
|
||||
web_settings->toolbar_style = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_ALWAYS_SHOW_TABBAR:
|
||||
web_settings->always_show_tabbar = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SHOW_NEW_TAB:
|
||||
web_settings->show_new_tab = g_value_get_boolean (value);
|
||||
break;
|
||||
|
@ -824,6 +838,9 @@ midori_web_settings_get_property (GObject* object,
|
|||
case PROP_TOOLBAR_STYLE:
|
||||
g_value_set_enum (value, web_settings->toolbar_style);
|
||||
break;
|
||||
case PROP_ALWAYS_SHOW_TABBAR:
|
||||
g_value_set_boolean (value, web_settings->always_show_tabbar);
|
||||
break;
|
||||
case PROP_SHOW_NEW_TAB:
|
||||
g_value_set_boolean (value, web_settings->show_new_tab);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue