summaryrefslogtreecommitdiff
path: root/thunar
diff options
context:
space:
mode:
authorPratyaksh Gautam <pratyakshgautam11@gmail.com>2022-03-14 15:03:11 +0000
committerAlexander Schwinn <alexxcons@xfce.org>2022-03-14 15:03:11 +0000
commitfbd5e3d65e24ba2b91359490af3384bb91a8a47f (patch)
tree6313fda97057c496cbc1189dfc4eb6e4b9985416 /thunar
parente80ac31947fc3efe811260eb37ced52e2b0e05ff (diff)
downloadthunar-fbd5e3d65e24ba2b91359490af3384bb91a8a47f.tar.gz
Add option for vertical split panes (#722)
Diffstat (limited to 'thunar')
-rw-r--r--thunar/thunar-preferences-dialog.c13
-rw-r--r--thunar/thunar-preferences.c16
-rw-r--r--thunar/thunar-window.c20
3 files changed, 49 insertions, 0 deletions
diff --git a/thunar/thunar-preferences-dialog.c b/thunar/thunar-preferences-dialog.c
index 7266ff59..6ac2ac0e 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 3d97d22d..fbc00d2f 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 52cd62cd..812b5c43 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