]> spindle.queued.net Git - midori/commitdiff
Add Compact sidepanel Preference
authorChristian Dywan <christian@twotoasts.de>
Tue, 21 Oct 2008 22:01:01 +0000 (00:01 +0200)
committerChristian Dywan <christian@twotoasts.de>
Tue, 21 Oct 2008 22:01:01 +0000 (00:01 +0200)
midori/midori-browser.c
midori/midori-panel.c
midori/midori-panel.h
midori/midori-preferences.c
midori/midori-websettings.c

index 3fba755aa6870ca2e34446f99182220708c97226..8bab0f91c3d024693663ee63554b6718e63c0639 100644 (file)
@@ -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),
index 14cc5a2a6f17e885f27eec4fba72e7fb2f3508c5..e2413e8709c4cca93a6e40917ff60187861bcb35 100644 (file)
@@ -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)
index 806620a77902497ec8976cde080b09e071ca136f..bdea460e369e871d45cd62ab22d9471c77364077 100644 (file)
@@ -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,
index 97e815b039134737991ef1281b8a75788b2f1fa1..0fd7263ee2d1a935d9f8c3a559d2e1040b51c750 100644 (file)
@@ -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"
         "</span>");
     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"));
index ff3bb185f2e12fe4071455c268b05d1b19730e6d..19ea94c3ad57784cb9a25cd5507b58a89566f5b7 100644 (file)
@@ -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;