Implement show-tabs property in MidoriBrowser
This commit is contained in:
parent
7860357ed2
commit
610f6a1fa7
1 changed files with 35 additions and 1 deletions
|
@ -82,6 +82,7 @@ struct _MidoriBrowser
|
||||||
KatzeArray* trash;
|
KatzeArray* trash;
|
||||||
KatzeArray* search_engines;
|
KatzeArray* search_engines;
|
||||||
KatzeArray* history;
|
KatzeArray* history;
|
||||||
|
gboolean show_tabs;
|
||||||
|
|
||||||
KatzeNet* net;
|
KatzeNet* net;
|
||||||
|
|
||||||
|
@ -117,7 +118,8 @@ enum
|
||||||
PROP_BOOKMARKS,
|
PROP_BOOKMARKS,
|
||||||
PROP_TRASH,
|
PROP_TRASH,
|
||||||
PROP_SEARCH_ENGINES,
|
PROP_SEARCH_ENGINES,
|
||||||
PROP_HISTORY
|
PROP_HISTORY,
|
||||||
|
PROP_SHOW_TABS,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -198,6 +200,9 @@ _toggle_tabbar_smartly (MidoriBrowser* browser)
|
||||||
guint n;
|
guint n;
|
||||||
gboolean always_show_tabbar;
|
gboolean always_show_tabbar;
|
||||||
|
|
||||||
|
if (!browser->show_tabs)
|
||||||
|
return;
|
||||||
|
|
||||||
n = gtk_notebook_get_n_pages (GTK_NOTEBOOK (browser->notebook));
|
n = gtk_notebook_get_n_pages (GTK_NOTEBOOK (browser->notebook));
|
||||||
if (n < 2 && browser->settings)
|
if (n < 2 && browser->settings)
|
||||||
{
|
{
|
||||||
|
@ -1855,6 +1860,25 @@ midori_browser_class_init (MidoriBrowserClass* class)
|
||||||
KATZE_TYPE_ARRAY,
|
KATZE_TYPE_ARRAY,
|
||||||
flags));
|
flags));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MidoriBrowser:show-tabs:
|
||||||
|
*
|
||||||
|
* Whether or not to show tabs.
|
||||||
|
*
|
||||||
|
* If disabled, no tab labels are shown. This is intended for
|
||||||
|
* extensions that want to provide alternative tab labels.
|
||||||
|
*
|
||||||
|
* Since 0.1.8
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_SHOW_TABS,
|
||||||
|
g_param_spec_boolean (
|
||||||
|
"show-tabs",
|
||||||
|
"Show Tabs",
|
||||||
|
"Whether or not to show tabs",
|
||||||
|
TRUE,
|
||||||
|
flags));
|
||||||
|
|
||||||
/* Add 2px space between tool buttons */
|
/* Add 2px space between tool buttons */
|
||||||
gtk_rc_parse_string (
|
gtk_rc_parse_string (
|
||||||
"style \"tool-button-style\"\n {\n"
|
"style \"tool-button-style\"\n {\n"
|
||||||
|
@ -5535,6 +5559,13 @@ midori_browser_set_property (GObject* object,
|
||||||
case PROP_HISTORY:
|
case PROP_HISTORY:
|
||||||
midori_browser_set_history (browser, g_value_get_object (value));
|
midori_browser_set_history (browser, g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
case PROP_SHOW_TABS:
|
||||||
|
browser->show_tabs = g_value_get_boolean (value);
|
||||||
|
if (browser->show_tabs)
|
||||||
|
_toggle_tabbar_smartly (browser);
|
||||||
|
else
|
||||||
|
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (browser->notebook), FALSE);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -5600,6 +5631,9 @@ midori_browser_get_property (GObject* object,
|
||||||
case PROP_HISTORY:
|
case PROP_HISTORY:
|
||||||
g_value_set_object (value, browser->history);
|
g_value_set_object (value, browser->history);
|
||||||
break;
|
break;
|
||||||
|
case PROP_SHOW_TABS:
|
||||||
|
g_value_set_boolean (value, browser->show_tabs);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue