Add Compact sidepanel Preference

This commit is contained in:
Christian Dywan 2008-10-22 00:01:01 +02:00
parent ce66f54620
commit 62d7a7d0b4
5 changed files with 64 additions and 93 deletions

View file

@ -1739,7 +1739,7 @@ _action_source_view_activate (GtkAction* action,
source_view = midori_view_new (); source_view = midori_view_new ();
midori_view_set_settings (MIDORI_VIEW (source_view), browser->settings); midori_view_set_settings (MIDORI_VIEW (source_view), browser->settings);
midori_view_set_uri (MIDORI_VIEW (source_view), uri); midori_view_set_uri (MIDORI_VIEW (source_view), uri);
midori_view_notify_icon_cb (source_view, NULL, browser); midori_view_notify_icon_cb (MIDORI_VIEW (source_view), NULL, browser);
g_free (uri); g_free (uri);
gtk_widget_show (source_view); gtk_widget_show (source_view);
n = midori_browser_add_tab (browser, source_view); n = midori_browser_add_tab (browser, source_view);
@ -3809,11 +3809,6 @@ midori_browser_init (MidoriBrowser* browser)
FALSE, FALSE, 3); FALSE, FALSE, 3);
g_object_unref (ui_manager); g_object_unref (ui_manager);
#ifndef WEBKIT_CHECK_VERSION
_action_set_sensitive (browser, "ZoomIn", FALSE);
_action_set_sensitive (browser, "ZoomOut", FALSE);
#endif
} }
static void static void
@ -3942,6 +3937,7 @@ _midori_browser_update_settings (MidoriBrowser* browser)
{ {
gboolean remember_last_window_size; gboolean remember_last_window_size;
gint last_window_width, last_window_height; gint last_window_width, last_window_height;
gboolean compact_sidepanel;
gint last_panel_position, last_panel_page; gint last_panel_position, last_panel_page;
gboolean show_menubar, show_navigationbar, show_bookmarkbar; gboolean show_menubar, show_navigationbar, show_bookmarkbar;
gboolean show_panel, show_statusbar; gboolean show_panel, show_statusbar;
@ -3958,6 +3954,7 @@ _midori_browser_update_settings (MidoriBrowser* browser)
"remember-last-window-size", &remember_last_window_size, "remember-last-window-size", &remember_last_window_size,
"last-window-width", &last_window_width, "last-window-width", &last_window_width,
"last-window-height", &last_window_height, "last-window-height", &last_window_height,
"compact-sidepanel", &compact_sidepanel,
"last-panel-position", &last_panel_position, "last-panel-position", &last_panel_position,
"last-panel-page", &last_panel_page, "last-panel-page", &last_panel_page,
"show-menubar", &show_menubar, "show-menubar", &show_menubar,
@ -3999,6 +3996,7 @@ _midori_browser_update_settings (MidoriBrowser* browser)
_action_by_name (browser, "Search")), item); _action_by_name (browser, "Search")), item);
} }
midori_panel_set_compact (MIDORI_PANEL (browser->panel), compact_sidepanel);
gtk_paned_set_position (GTK_PANED (gtk_widget_get_parent (browser->panel)), gtk_paned_set_position (GTK_PANED (gtk_widget_get_parent (browser->panel)),
last_panel_position); last_panel_position);
midori_panel_set_current_page (MIDORI_PANEL (browser->panel), last_panel_page); midori_panel_set_current_page (MIDORI_PANEL (browser->panel), last_panel_page);
@ -4031,6 +4029,9 @@ midori_browser_settings_notify (MidoriWebSettings* web_settings,
_midori_browser_set_toolbar_style (browser, g_value_get_enum (&value)); _midori_browser_set_toolbar_style (browser, g_value_get_enum (&value));
else if (name == g_intern_string ("toolbar-items")) else if (name == g_intern_string ("toolbar-items"))
_midori_browser_set_toolbar_items (browser, g_value_get_string (&value)); _midori_browser_set_toolbar_items (browser, g_value_get_string (&value));
else if (name == g_intern_string ("compact-sidepanel"))
midori_panel_set_compact (MIDORI_PANEL (browser->panel),
g_value_get_boolean (&value));
else if (name == g_intern_string ("always-show-tabbar")) else if (name == g_intern_string ("always-show-tabbar"))
_toggle_tabbar_smartly (browser); _toggle_tabbar_smartly (browser);
else if (!g_object_class_find_property (G_OBJECT_GET_CLASS (web_settings), else if (!g_object_class_find_property (G_OBJECT_GET_CLASS (web_settings),

View file

@ -311,6 +311,22 @@ midori_panel_new (void)
return GTK_WIDGET (panel); return GTK_WIDGET (panel);
} }
/**
* midori_panel_set_compact:
* @compact: %TRUE if the panel should be compact
*
* Determines if the panel should be compact.
**/
void
midori_panel_set_compact (MidoriPanel* panel,
gboolean compact)
{
g_return_if_fail (MIDORI_IS_PANEL (panel));
gtk_toolbar_set_style (GTK_TOOLBAR (panel->toolbar),
compact ? GTK_TOOLBAR_ICONS : GTK_TOOLBAR_BOTH);
}
static void static void
midori_panel_menu_item_activate_cb (GtkWidget* widget, midori_panel_menu_item_activate_cb (GtkWidget* widget,
MidoriPanel* panel) MidoriPanel* panel)

View file

@ -53,6 +53,10 @@ midori_panel_get_type (void);
GtkWidget* GtkWidget*
midori_panel_new (void); midori_panel_new (void);
void
midori_panel_set_compact (MidoriPanel* panel,
gboolean compact);
gint gint
midori_panel_append_page (MidoriPanel* panel, midori_panel_append_page (MidoriPanel* panel,
GtkWidget* child, GtkWidget* child,

View file

@ -415,7 +415,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
/* Page "Interface" */ /* Page "Interface" */
PAGE_NEW (GTK_STOCK_CONVERT, _("Interface")); PAGE_NEW (GTK_STOCK_CONVERT, _("Interface"));
FRAME_NEW (_("Navigationbar")); FRAME_NEW (_("Navigationbar"));
TABLE_NEW (4, 2); TABLE_NEW (3, 2);
INDENTED_ADD (katze_property_label (settings, "toolbar-style"), 0, 1, 0, 1); INDENTED_ADD (katze_property_label (settings, "toolbar-style"), 0, 1, 0, 1);
button = katze_property_proxy (settings, "toolbar-style", NULL); button = katze_property_proxy (settings, "toolbar-style", NULL);
FILLED_ADD (button, 1, 2, 0, 1); FILLED_ADD (button, 1, 2, 0, 1);
@ -429,10 +429,8 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
"ReloadStop, ZoomIn, ZoomOut, Back, Forward, Homepage, Search, Trash" "ReloadStop, ZoomIn, ZoomOut, Back, Forward, Homepage, Search, Trash"
"</span>"); "</span>");
FILLED_ADD (button, 0, 2, 2, 3); FILLED_ADD (button, 0, 2, 2, 3);
button = katze_property_proxy (settings, "always-show-tabbar", NULL);
INDENTED_ADD (button, 0, 1, 3, 4);
FRAME_NEW (_("Browsing")); FRAME_NEW (_("Browsing"));
TABLE_NEW (3, 2); TABLE_NEW (4, 2);
label = katze_property_label (settings, "open-external-pages-in"); label = katze_property_label (settings, "open-external-pages-in");
INDENTED_ADD (label, 0, 1, 0, 1); INDENTED_ADD (label, 0, 1, 0, 1);
button = katze_property_proxy (settings, "open-external-pages-in", NULL); button = katze_property_proxy (settings, "open-external-pages-in", NULL);
@ -441,16 +439,20 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
INDENTED_ADD (label, 0, 1, 0, 1); INDENTED_ADD (label, 0, 1, 0, 1);
button = katze_property_proxy (settings, "open-new-pages-in", NULL); button = katze_property_proxy (settings, "open-new-pages-in", NULL);
FILLED_ADD (button, 1, 2, 0, 1); */ FILLED_ADD (button, 1, 2, 0, 1); */
button = katze_property_proxy (settings, "middle-click-opens-selection", NULL); button = katze_property_proxy (settings, "always-show-tabbar", NULL);
INDENTED_ADD (button, 0, 1, 1, 2); INDENTED_ADD (button, 0, 1, 1, 2);
button = katze_property_proxy (settings, "compact-sidepanel", NULL);
INDENTED_ADD (button, 1, 2, 1, 2);
button = katze_property_proxy (settings, "middle-click-opens-selection", NULL);
INDENTED_ADD (button, 0, 1, 2, 3);
button = katze_property_proxy (settings, "open-tabs-in-the-background", NULL); button = katze_property_proxy (settings, "open-tabs-in-the-background", NULL);
WIDGET_ADD (button, 1, 2, 1, 2); WIDGET_ADD (button, 1, 2, 2, 3);
/* button = katze_property_proxy (settings, "open-popups-in-tabs", NULL); /* button = katze_property_proxy (settings, "open-popups-in-tabs", NULL);
SPANNED_ADD (button, 0, 1, 2, 3);*/ SPANNED_ADD (button, 0, 1, 2, 3);*/
button = katze_property_proxy (settings, "open-tabs-next-to-current", NULL); button = katze_property_proxy (settings, "open-tabs-next-to-current", NULL);
WIDGET_ADD (button, 0, 1, 2, 3); WIDGET_ADD (button, 0, 1, 3, 4);
button = katze_property_proxy (settings, "close-buttons-on-tabs", NULL); button = katze_property_proxy (settings, "close-buttons-on-tabs", NULL);
WIDGET_ADD (button, 1, 2, 2, 3); WIDGET_ADD (button, 1, 2, 3, 4);
/* Page "Network" */ /* Page "Network" */
/*PAGE_NEW (GTK_STOCK_NETWORK, _("Network")); /*PAGE_NEW (GTK_STOCK_NETWORK, _("Network"));

View file

@ -36,11 +36,7 @@ struct _MidoriWebSettings
MidoriToolbarStyle toolbar_style; MidoriToolbarStyle toolbar_style;
gchar* toolbar_items; gchar* toolbar_items;
gboolean always_show_tabbar; gboolean compact_sidepanel;
gboolean show_new_tab;
gboolean show_homepage;
gboolean show_web_search;
gboolean show_trash;
MidoriStartup load_on_startup; MidoriStartup load_on_startup;
gchar* homepage; gchar* homepage;
@ -50,6 +46,7 @@ struct _MidoriWebSettings
gchar* location_entry_search; gchar* location_entry_search;
MidoriPreferredEncoding preferred_encoding; MidoriPreferredEncoding preferred_encoding;
gboolean always_show_tabbar;
gboolean close_buttons_on_tabs; gboolean close_buttons_on_tabs;
MidoriNewPage open_new_pages_in; MidoriNewPage open_new_pages_in;
MidoriNewPage open_external_pages_in; MidoriNewPage open_external_pages_in;
@ -93,11 +90,7 @@ enum
PROP_TOOLBAR_STYLE, PROP_TOOLBAR_STYLE,
PROP_TOOLBAR_ITEMS, PROP_TOOLBAR_ITEMS,
PROP_ALWAYS_SHOW_TABBAR, PROP_COMPACT_SIDEPANEL,
PROP_SHOW_NEW_TAB,
PROP_SHOW_HOMEPAGE,
PROP_SHOW_WEB_SEARCH,
PROP_SHOW_TRASH,
PROP_LOAD_ON_STARTUP, PROP_LOAD_ON_STARTUP,
PROP_HOMEPAGE, PROP_HOMEPAGE,
@ -107,6 +100,7 @@ enum
PROP_LOCATION_ENTRY_SEARCH, PROP_LOCATION_ENTRY_SEARCH,
PROP_PREFERRED_ENCODING, PROP_PREFERRED_ENCODING,
PROP_ALWAYS_SHOW_TABBAR,
PROP_CLOSE_BUTTONS_ON_TABS, PROP_CLOSE_BUTTONS_ON_TABS,
PROP_OPEN_NEW_PAGES_IN, PROP_OPEN_NEW_PAGES_IN,
PROP_OPEN_EXTERNAL_PAGES_IN, PROP_OPEN_EXTERNAL_PAGES_IN,
@ -373,51 +367,14 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
flags)); flags));
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_ALWAYS_SHOW_TABBAR, PROP_COMPACT_SIDEPANEL,
g_param_spec_boolean ( g_param_spec_boolean (
"always-show-tabbar", "compact-sidepanel",
_("Always Show Tabbar"), _("Compact Sidepanel"),
_("Always show the tabbar"), _("Whether to make the sidepanel compact"),
FALSE, FALSE,
flags)); flags));
g_object_class_install_property (gobject_class,
PROP_SHOW_NEW_TAB,
g_param_spec_boolean (
"show-new-tab",
_("Show New Tab"),
_("Show the New Tab button in the toolbar"),
TRUE,
flags));
g_object_class_install_property (gobject_class,
PROP_SHOW_HOMEPAGE,
g_param_spec_boolean (
"show-homepage",
_("Show Homepage"),
_("Show the Homepage button in the toolbar"),
TRUE,
flags));
g_object_class_install_property (gobject_class,
PROP_SHOW_WEB_SEARCH,
g_param_spec_boolean (
"show-web-search",
_("Show Web search"),
_("Show the Web search entry in the toolbar"),
TRUE,
flags));
g_object_class_install_property (gobject_class,
PROP_SHOW_TRASH,
g_param_spec_boolean (
"show-trash",
_("Show Trash"),
_("Show the Trash button in the toolbar"),
TRUE,
flags));
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_LOAD_ON_STARTUP, PROP_LOAD_ON_STARTUP,
@ -485,6 +442,15 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
flags)); 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, g_object_class_install_property (gobject_class,
PROP_CLOSE_BUTTONS_ON_TABS, PROP_CLOSE_BUTTONS_ON_TABS,
g_param_spec_boolean ( g_param_spec_boolean (
@ -732,20 +698,8 @@ midori_web_settings_set_property (GObject* object,
case PROP_TOOLBAR_ITEMS: case PROP_TOOLBAR_ITEMS:
katze_assign (web_settings->toolbar_items, g_value_dup_string (value)); katze_assign (web_settings->toolbar_items, g_value_dup_string (value));
break; break;
case PROP_ALWAYS_SHOW_TABBAR: case PROP_COMPACT_SIDEPANEL:
web_settings->always_show_tabbar = g_value_get_boolean (value); web_settings->compact_sidepanel = g_value_get_boolean (value);
break;
case PROP_SHOW_NEW_TAB:
web_settings->show_new_tab = g_value_get_boolean (value);
break;
case PROP_SHOW_HOMEPAGE:
web_settings->show_homepage = g_value_get_boolean (value);
break;
case PROP_SHOW_WEB_SEARCH:
web_settings->show_web_search = g_value_get_boolean (value);
break;
case PROP_SHOW_TRASH:
web_settings->show_trash = g_value_get_boolean (value);
break; break;
case PROP_LOAD_ON_STARTUP: case PROP_LOAD_ON_STARTUP:
@ -790,6 +744,9 @@ midori_web_settings_set_property (GObject* object,
} }
break; break;
case PROP_ALWAYS_SHOW_TABBAR:
web_settings->always_show_tabbar = g_value_get_boolean (value);
break;
case PROP_CLOSE_BUTTONS_ON_TABS: case PROP_CLOSE_BUTTONS_ON_TABS:
web_settings->close_buttons_on_tabs = g_value_get_boolean (value); web_settings->close_buttons_on_tabs = g_value_get_boolean (value);
break; break;
@ -901,20 +858,8 @@ midori_web_settings_get_property (GObject* object,
case PROP_TOOLBAR_ITEMS: case PROP_TOOLBAR_ITEMS:
g_value_set_string (value, web_settings->toolbar_items); g_value_set_string (value, web_settings->toolbar_items);
break; break;
case PROP_ALWAYS_SHOW_TABBAR: case PROP_COMPACT_SIDEPANEL:
g_value_set_boolean (value, web_settings->always_show_tabbar); g_value_set_boolean (value, web_settings->compact_sidepanel);
break;
case PROP_SHOW_NEW_TAB:
g_value_set_boolean (value, web_settings->show_new_tab);
break;
case PROP_SHOW_HOMEPAGE:
g_value_set_boolean (value, web_settings->show_homepage);
break;
case PROP_SHOW_WEB_SEARCH:
g_value_set_boolean (value, web_settings->show_web_search);
break;
case PROP_SHOW_TRASH:
g_value_set_boolean (value, web_settings->show_trash);
break; break;
case PROP_LOAD_ON_STARTUP: case PROP_LOAD_ON_STARTUP:
@ -939,6 +884,9 @@ midori_web_settings_get_property (GObject* object,
g_value_set_enum (value, web_settings->preferred_encoding); g_value_set_enum (value, web_settings->preferred_encoding);
break; break;
case PROP_ALWAYS_SHOW_TABBAR:
g_value_set_boolean (value, web_settings->always_show_tabbar);
break;
case PROP_CLOSE_BUTTONS_ON_TABS: case PROP_CLOSE_BUTTONS_ON_TABS:
g_value_set_boolean (value, web_settings->close_buttons_on_tabs); g_value_set_boolean (value, web_settings->close_buttons_on_tabs);
break; break;