From 62d7a7d0b4c815be264e4c82f0b13df6e0614304 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Wed, 22 Oct 2008 00:01:01 +0200 Subject: [PATCH] Add Compact sidepanel Preference --- midori/midori-browser.c | 13 +++-- midori/midori-panel.c | 16 ++++++ midori/midori-panel.h | 4 ++ midori/midori-preferences.c | 18 +++--- midori/midori-websettings.c | 106 +++++++++--------------------------- 5 files changed, 64 insertions(+), 93 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 3fba755a..8bab0f91 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -1739,7 +1739,7 @@ _action_source_view_activate (GtkAction* action, source_view = midori_view_new (); midori_view_set_settings (MIDORI_VIEW (source_view), browser->settings); 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); gtk_widget_show (source_view); n = midori_browser_add_tab (browser, source_view); @@ -3809,11 +3809,6 @@ midori_browser_init (MidoriBrowser* browser) FALSE, FALSE, 3); g_object_unref (ui_manager); - - #ifndef WEBKIT_CHECK_VERSION - _action_set_sensitive (browser, "ZoomIn", FALSE); - _action_set_sensitive (browser, "ZoomOut", FALSE); - #endif } static void @@ -3942,6 +3937,7 @@ _midori_browser_update_settings (MidoriBrowser* browser) { gboolean remember_last_window_size; gint last_window_width, last_window_height; + gboolean compact_sidepanel; gint last_panel_position, last_panel_page; gboolean show_menubar, show_navigationbar, show_bookmarkbar; gboolean show_panel, show_statusbar; @@ -3958,6 +3954,7 @@ _midori_browser_update_settings (MidoriBrowser* browser) "remember-last-window-size", &remember_last_window_size, "last-window-width", &last_window_width, "last-window-height", &last_window_height, + "compact-sidepanel", &compact_sidepanel, "last-panel-position", &last_panel_position, "last-panel-page", &last_panel_page, "show-menubar", &show_menubar, @@ -3999,6 +3996,7 @@ _midori_browser_update_settings (MidoriBrowser* browser) _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)), last_panel_position); 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)); else if (name == g_intern_string ("toolbar-items")) _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")) _toggle_tabbar_smartly (browser); else if (!g_object_class_find_property (G_OBJECT_GET_CLASS (web_settings), diff --git a/midori/midori-panel.c b/midori/midori-panel.c index 14cc5a2a..e2413e87 100644 --- a/midori/midori-panel.c +++ b/midori/midori-panel.c @@ -311,6 +311,22 @@ midori_panel_new (void) 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 midori_panel_menu_item_activate_cb (GtkWidget* widget, MidoriPanel* panel) diff --git a/midori/midori-panel.h b/midori/midori-panel.h index 806620a7..bdea460e 100644 --- a/midori/midori-panel.h +++ b/midori/midori-panel.h @@ -53,6 +53,10 @@ midori_panel_get_type (void); GtkWidget* midori_panel_new (void); +void +midori_panel_set_compact (MidoriPanel* panel, + gboolean compact); + gint midori_panel_append_page (MidoriPanel* panel, GtkWidget* child, diff --git a/midori/midori-preferences.c b/midori/midori-preferences.c index 97e815b0..0fd7263e 100644 --- a/midori/midori-preferences.c +++ b/midori/midori-preferences.c @@ -415,7 +415,7 @@ midori_preferences_set_settings (MidoriPreferences* preferences, /* Page "Interface" */ PAGE_NEW (GTK_STOCK_CONVERT, _("Interface")); FRAME_NEW (_("Navigationbar")); - TABLE_NEW (4, 2); + TABLE_NEW (3, 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); @@ -429,10 +429,8 @@ midori_preferences_set_settings (MidoriPreferences* preferences, "ReloadStop, ZoomIn, ZoomOut, Back, Forward, Homepage, Search, Trash" ""); 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")); - TABLE_NEW (3, 2); + TABLE_NEW (4, 2); label = katze_property_label (settings, "open-external-pages-in"); INDENTED_ADD (label, 0, 1, 0, 1); 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); button = katze_property_proxy (settings, "open-new-pages-in", NULL); 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); + 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); - WIDGET_ADD (button, 1, 2, 1, 2); + WIDGET_ADD (button, 1, 2, 2, 3); /* button = katze_property_proxy (settings, "open-popups-in-tabs", NULL); SPANNED_ADD (button, 0, 1, 2, 3);*/ 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); - WIDGET_ADD (button, 1, 2, 2, 3); + WIDGET_ADD (button, 1, 2, 3, 4); /* Page "Network" */ /*PAGE_NEW (GTK_STOCK_NETWORK, _("Network")); diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c index ff3bb185..19ea94c3 100644 --- a/midori/midori-websettings.c +++ b/midori/midori-websettings.c @@ -36,11 +36,7 @@ struct _MidoriWebSettings MidoriToolbarStyle toolbar_style; gchar* toolbar_items; - gboolean always_show_tabbar; - gboolean show_new_tab; - gboolean show_homepage; - gboolean show_web_search; - gboolean show_trash; + gboolean compact_sidepanel; MidoriStartup load_on_startup; gchar* homepage; @@ -50,6 +46,7 @@ struct _MidoriWebSettings gchar* location_entry_search; MidoriPreferredEncoding preferred_encoding; + gboolean always_show_tabbar; gboolean close_buttons_on_tabs; MidoriNewPage open_new_pages_in; MidoriNewPage open_external_pages_in; @@ -93,11 +90,7 @@ enum PROP_TOOLBAR_STYLE, PROP_TOOLBAR_ITEMS, - PROP_ALWAYS_SHOW_TABBAR, - PROP_SHOW_NEW_TAB, - PROP_SHOW_HOMEPAGE, - PROP_SHOW_WEB_SEARCH, - PROP_SHOW_TRASH, + PROP_COMPACT_SIDEPANEL, PROP_LOAD_ON_STARTUP, PROP_HOMEPAGE, @@ -107,6 +100,7 @@ enum PROP_LOCATION_ENTRY_SEARCH, PROP_PREFERRED_ENCODING, + PROP_ALWAYS_SHOW_TABBAR, PROP_CLOSE_BUTTONS_ON_TABS, PROP_OPEN_NEW_PAGES_IN, PROP_OPEN_EXTERNAL_PAGES_IN, @@ -373,51 +367,14 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) flags)); g_object_class_install_property (gobject_class, - PROP_ALWAYS_SHOW_TABBAR, + PROP_COMPACT_SIDEPANEL, g_param_spec_boolean ( - "always-show-tabbar", - _("Always Show Tabbar"), - _("Always show the tabbar"), + "compact-sidepanel", + _("Compact Sidepanel"), + _("Whether to make the sidepanel compact"), FALSE, 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, PROP_LOAD_ON_STARTUP, @@ -485,6 +442,15 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) 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_CLOSE_BUTTONS_ON_TABS, g_param_spec_boolean ( @@ -732,20 +698,8 @@ midori_web_settings_set_property (GObject* object, case PROP_TOOLBAR_ITEMS: katze_assign (web_settings->toolbar_items, g_value_dup_string (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; - 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); + case PROP_COMPACT_SIDEPANEL: + web_settings->compact_sidepanel = g_value_get_boolean (value); break; case PROP_LOAD_ON_STARTUP: @@ -790,6 +744,9 @@ midori_web_settings_set_property (GObject* object, } break; + case PROP_ALWAYS_SHOW_TABBAR: + web_settings->always_show_tabbar = g_value_get_boolean (value); + break; case PROP_CLOSE_BUTTONS_ON_TABS: web_settings->close_buttons_on_tabs = g_value_get_boolean (value); break; @@ -901,20 +858,8 @@ midori_web_settings_get_property (GObject* object, case PROP_TOOLBAR_ITEMS: g_value_set_string (value, web_settings->toolbar_items); 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; - 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); + case PROP_COMPACT_SIDEPANEL: + g_value_set_boolean (value, web_settings->compact_sidepanel); break; 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); break; + case PROP_ALWAYS_SHOW_TABBAR: + g_value_set_boolean (value, web_settings->always_show_tabbar); + break; case PROP_CLOSE_BUTTONS_ON_TABS: g_value_set_boolean (value, web_settings->close_buttons_on_tabs); break;