]> spindle.queued.net Git - midori/commitdiff
Implement "right-align-sidepanel" to align the panel on the right
authorChristian Dywan <christian@twotoasts.de>
Sun, 22 Feb 2009 02:51:10 +0000 (03:51 +0100)
committerChristian Dywan <christian@twotoasts.de>
Sun, 22 Feb 2009 02:51:10 +0000 (03:51 +0100)
midori/midori-browser.c
midori/midori-websettings.c

index b17a4f377feac9d5d8c384d19102cb9cf60a7154..0e491acf25e47c7b8db87a8281896c1950945aa9 100644 (file)
@@ -3865,7 +3865,8 @@ _midori_browser_update_settings (MidoriBrowser* browser)
     gboolean remember_last_window_size;
     gint last_window_width, last_window_height;
     MidoriWindowState last_window_state;
-    gboolean compact_sidepanel;
+    gboolean compact_sidepanel, right_align_sidepanel;
+    GtkWidget* hpaned, *vpaned;
     gint last_panel_position, last_panel_page;
     gboolean show_menubar, show_navigationbar, show_bookmarkbar;
     gboolean show_panel, show_statusbar;
@@ -3883,6 +3884,7 @@ _midori_browser_update_settings (MidoriBrowser* browser)
                   "last-window-height", &last_window_height,
                   "last-window-state", &last_window_state,
                   "compact-sidepanel", &compact_sidepanel,
+                  "right-align-sidepanel", &right_align_sidepanel,
                   "last-panel-position", &last_panel_position,
                   "last-panel-page", &last_panel_page,
                   "show-menubar", &show_menubar,
@@ -3938,6 +3940,24 @@ _midori_browser_update_settings (MidoriBrowser* browser)
     }
 
     midori_panel_set_compact (MIDORI_PANEL (browser->panel), compact_sidepanel);
+    hpaned = gtk_widget_get_parent (browser->panel);
+    vpaned = gtk_widget_get_parent (browser->notebook);
+    g_object_ref (browser->panel);
+    g_object_ref (vpaned);
+    gtk_container_remove (GTK_CONTAINER (hpaned), browser->panel);
+    gtk_container_remove (GTK_CONTAINER (hpaned), vpaned);
+    if (right_align_sidepanel)
+    {
+        gtk_paned_pack1 (GTK_PANED (hpaned), vpaned, FALSE, FALSE);
+        gtk_paned_pack2 (GTK_PANED (hpaned), browser->panel, FALSE, FALSE);
+    }
+    else
+    {
+        gtk_paned_pack1 (GTK_PANED (hpaned), browser->panel, FALSE, FALSE);
+        gtk_paned_pack2 (GTK_PANED (hpaned), vpaned, FALSE, FALSE);
+    }
+    g_object_unref (browser->panel);
+    g_object_unref (vpaned);
     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);
index df1ceca44f5d7c9276f5e3638f499677a4bf92e3..8966fe61e335b385fd66e6c12538813db01f1bbe 100644 (file)
@@ -42,6 +42,7 @@ struct _MidoriWebSettings
     gboolean progress_in_location;
     gchar* toolbar_items;
     gboolean compact_sidepanel;
+    gboolean right_align_sidepanel;
 
     MidoriStartup load_on_startup;
     gchar* homepage;
@@ -107,6 +108,7 @@ enum
     PROP_PROGRESS_IN_LOCATION,
     PROP_TOOLBAR_ITEMS,
     PROP_COMPACT_SIDEPANEL,
+    PROP_RIGHT_ALIGN_SIDEPANEL,
 
     PROP_LOAD_ON_STARTUP,
     PROP_HOMEPAGE,
@@ -463,6 +465,22 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
                                      FALSE,
                                      flags));
 
+    /**
+    * MidoriWebSettings:right-sidepanel:
+    *
+    * Whether to align the sidepanel on the right.
+    *
+    * Since: 0.1.3
+    */
+    g_object_class_install_property (gobject_class,
+                                     PROP_RIGHT_ALIGN_SIDEPANEL,
+                                     g_param_spec_boolean (
+                                     "right-align-sidepanel",
+                                     _("Align sidepanel on the right"),
+                                     _("Whether to align the sidepanel on the right"),
+                                     FALSE,
+                                     flags));
+
 
     g_object_class_install_property (gobject_class,
                                      PROP_LOAD_ON_STARTUP,
@@ -1005,6 +1023,9 @@ midori_web_settings_set_property (GObject*      object,
     case PROP_COMPACT_SIDEPANEL:
         web_settings->compact_sidepanel = g_value_get_boolean (value);
         break;
+    case PROP_RIGHT_ALIGN_SIDEPANEL:
+        web_settings->right_align_sidepanel = g_value_get_boolean (value);
+        break;
 
     case PROP_LOAD_ON_STARTUP:
         web_settings->load_on_startup = g_value_get_enum (value);
@@ -1189,6 +1210,9 @@ midori_web_settings_get_property (GObject*    object,
     case PROP_COMPACT_SIDEPANEL:
         g_value_set_boolean (value, web_settings->compact_sidepanel);
         break;
+    case PROP_RIGHT_ALIGN_SIDEPANEL:
+        g_value_set_boolean (value, web_settings->right_align_sidepanel);
+        break;
 
     case PROP_LOAD_ON_STARTUP:
         g_value_set_enum (value, web_settings->load_on_startup);