From: Christian Dywan Date: Sun, 22 Feb 2009 02:51:10 +0000 (+0100) Subject: Implement "right-align-sidepanel" to align the panel on the right X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca8d22b9b4cb8748a3660811f4ceee30ed540a94;p=midori Implement "right-align-sidepanel" to align the panel on the right --- diff --git a/midori/midori-browser.c b/midori/midori-browser.c index b17a4f37..0e491acf 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -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); diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c index df1ceca4..8966fe61 100644 --- a/midori/midori-websettings.c +++ b/midori/midori-websettings.c @@ -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);