diff --git a/thunar/thunar-preferences-dialog.c b/thunar/thunar-preferences-dialog.c index 7266ff591d722404af9131939d79fbf06eba519c..6ac2ac0ebabe27a4c67b50258a6daf71355a2e27 100644 --- a/thunar/thunar-preferences-dialog.c +++ b/thunar/thunar-preferences-dialog.c @@ -918,6 +918,19 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog) /* next row */ row++; + button = gtk_check_button_new_with_mnemonic (_("Split panes vertically instead of horizontally")); + g_object_bind_property (G_OBJECT (dialog->preferences), + "misc-vertical-split-pane", + G_OBJECT (button), + "active", + G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); + gtk_widget_set_tooltip_text (button, _("Select this option to split panes vertically instead of horizontally.")); + gtk_grid_attach (GTK_GRID (grid), button, 0, row, 1, 1); + gtk_widget_show (button); + + /* next row */ + row++; + button = gtk_check_button_new_with_mnemonic (_("Open new thunar instances as tabs")); g_object_bind_property (G_OBJECT (dialog->preferences), "misc-open-new-window-as-tab", diff --git a/thunar/thunar-preferences.c b/thunar/thunar-preferences.c index 3d97d22d34c5e58e38ca4394388a132fac2ce470..fbc00d2f311bf1a52789adf0eb6c1e2a5701616f 100644 --- a/thunar/thunar-preferences.c +++ b/thunar/thunar-preferences.c @@ -116,6 +116,7 @@ enum PROP_TREE_ICON_EMBLEMS, PROP_TREE_ICON_SIZE, PROP_MISC_SWITCH_TO_NEW_TAB, + PROP_MISC_VERTICAL_SPLIT_PANE, N_PROPERTIES, }; @@ -1035,6 +1036,21 @@ thunar_preferences_class_init (ThunarPreferencesClass *klass) TRUE, EXO_PARAM_READWRITE); + + + /** + * ThunarPreferences:misc-vertical-split-pane + * + * If true, split the thunar window vertically instead of horizontally + * when splitting the thunar window into two panes. + **/ + preferences_props[PROP_MISC_VERTICAL_SPLIT_PANE] = + g_param_spec_boolean ("misc-vertical-split-pane", + "MiscVerticalSplitPane", + NULL, + FALSE, + EXO_PARAM_READWRITE); + /* install all properties */ g_object_class_install_properties (gobject_class, N_PROPERTIES, preferences_props); } diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c index 52cd62cd4faa0cc4f1087209bfdec57a5692d731..812b5c43237e3160dfe0fcf46cd9322ff3a3151c 100644 --- a/thunar/thunar-window.c +++ b/thunar/thunar-window.c @@ -310,6 +310,7 @@ static void thunar_window_trash_selection_updated (ThunarWindow static void thunar_window_recent_reload (GtkRecentManager *recent_manager, ThunarWindow *window); static void thunar_window_catfish_dialog_configure (GtkWidget *entry); +static gboolean thunar_window_paned_notebooks_update_orientation (ThunarWindow *window); @@ -849,6 +850,9 @@ thunar_window_init (ThunarWindow *window) /* split view: Create panes where the two notebooks */ window->paned_notebooks = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); + g_signal_connect_swapped (window->preferences, "notify::misc-vertical-split-pane", G_CALLBACK (thunar_window_paned_notebooks_update_orientation), window); + thunar_window_paned_notebooks_update_orientation (window); + gtk_paned_add2 (GTK_PANED (window->paned), window->view_box); gtk_widget_add_events (window->paned_notebooks, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK); gtk_grid_attach (GTK_GRID (window->view_box), window->paned_notebooks, 0, 1, 1, 2); @@ -2561,6 +2565,22 @@ thunar_window_split_view_is_active (ThunarWindow *window) return (window->notebook_left && window->notebook_right); } +static gboolean +thunar_window_paned_notebooks_update_orientation (ThunarWindow *window) +{ + gboolean vertical_split_panes; + + _thunar_return_val_if_fail (THUNAR_IS_WINDOW (window), FALSE); + + g_object_get (G_OBJECT (window->preferences), "misc-vertical-split-pane", &vertical_split_panes, NULL); + + if (vertical_split_panes) + gtk_orientable_set_orientation (GTK_ORIENTABLE (window->paned_notebooks), GTK_ORIENTATION_VERTICAL); + else + gtk_orientable_set_orientation (GTK_ORIENTABLE (window->paned_notebooks), GTK_ORIENTATION_HORIZONTAL); + + return TRUE; +} void