diff --git a/thunar/thunar-window-ui.xml b/thunar/thunar-window-ui.xml
index f88332e..da0427b 100644
--- a/thunar/thunar-window-ui.xml
+++ b/thunar/thunar-window-ui.xml
@@ -47,10 +47,12 @@
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 0b83674..125f2aa 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -129,13 +129,11 @@ static void thunar_window_action_preferences (GtkAction
ThunarWindow *window);
static void thunar_window_action_reload (GtkAction *action,
ThunarWindow *window);
-static void thunar_window_action_pathbar_changed (GtkToggleAction *action,
- ThunarWindow *window);
-static void thunar_window_action_toolbar_changed (GtkToggleAction *action,
- ThunarWindow *window);
-static void thunar_window_action_shortcuts_changed (GtkToggleAction *action,
+static void thunar_window_action_location_bar_changed (GtkRadioAction *action,
+ GtkRadioAction *current,
ThunarWindow *window);
-static void thunar_window_action_tree_changed (GtkToggleAction *action,
+static void thunar_window_action_side_pane_changed (GtkRadioAction *action,
+ GtkRadioAction *current,
ThunarWindow *window);
static void thunar_window_action_statusbar_changed (GtkToggleAction *action,
ThunarWindow *window);
@@ -326,13 +324,36 @@ static GtkActionEntry action_entries[] =
static const GtkToggleActionEntry toggle_action_entries[] =
{
{ "show-hidden", NULL, N_ ("Show _Hidden Files"), "H", N_ ("Toggles the display of hidden files in the current window"), G_CALLBACK (thunar_window_action_show_hidden), FALSE, },
- { "view-location-selector-pathbar", NULL, N_ ("_Pathbar Style"), NULL, N_ ("Modern approach with buttons that correspond to folders"), G_CALLBACK (thunar_window_action_pathbar_changed), FALSE, },
- { "view-location-selector-toolbar", NULL, N_ ("_Toolbar Style"), NULL, N_ ("Traditional approach with location bar and navigation buttons"), G_CALLBACK (thunar_window_action_toolbar_changed), FALSE, },
- { "view-side-pane-shortcuts", NULL, N_ ("_Shortcuts"), "B", N_ ("Toggles the visibility of the shortcuts pane"), G_CALLBACK (thunar_window_action_shortcuts_changed), FALSE, },
- { "view-side-pane-tree", NULL, N_ ("_Tree"), "T", N_ ("Toggles the visibility of the tree pane"), G_CALLBACK (thunar_window_action_tree_changed), FALSE, },
{ "view-statusbar", NULL, N_ ("St_atusbar"), NULL, N_ ("Change the visibility of this window's statusbar"), G_CALLBACK (thunar_window_action_statusbar_changed), FALSE, },
};
+enum
+{
+ THUNAR_LOCATION_BAR_NONE,
+ THUNAR_LOCATION_BAR_PATHBAR,
+ THUNAR_LOCATION_BAR_TOOLBAR
+};
+
+static const GtkRadioActionEntry radio_location_bar_entries[] =
+{
+ { "view-location-selector-pathbar", NULL, N_ ("_Pathbar Style"), NULL, N_ ("Modern approach with buttons that correspond to folders"), THUNAR_LOCATION_BAR_PATHBAR, },
+ { "view-location-selector-toolbar", NULL, N_ ("_Toolbar Style"), NULL, N_ ("Traditional approach with location bar and navigation buttons"), THUNAR_LOCATION_BAR_TOOLBAR, },
+ { "view-location-selector-none", NULL, N_ ("_None"), NULL, N_ ("Hide the side pane"), THUNAR_LOCATION_BAR_NONE, },
+};
+
+enum
+{
+ THUNAR_SIDE_PANE_NONE,
+ THUNAR_SIDE_PANE_SHORTCUTS,
+ THUNAR_SIDE_PANE_TREE
+};
+
+static const GtkRadioActionEntry radio_side_pane_entries[] =
+{
+ { "view-side-pane-shortcuts", NULL, N_ ("_Shortcuts"), "B", N_ ("Show the shortcuts pane"), THUNAR_SIDE_PANE_SHORTCUTS, },
+ { "view-side-pane-tree", NULL, N_ ("_Tree"), "T", N_ ("Show the tree pane"), THUNAR_SIDE_PANE_TREE, },
+ { "view-side-pane-none", NULL, N_ ("_None"), NULL, N_ ("Hide the side pane"), THUNAR_SIDE_PANE_NONE, },
+};
static guint window_signals[LAST_SIGNAL];
@@ -711,6 +732,8 @@ thunar_window_init (ThunarWindow *window)
gtk_action_group_set_translation_domain (window->action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions (window->action_group, action_entries, G_N_ELEMENTS (action_entries), GTK_WIDGET (window));
gtk_action_group_add_toggle_actions (window->action_group, toggle_action_entries, G_N_ELEMENTS (toggle_action_entries), GTK_WIDGET (window));
+ gtk_action_group_add_radio_actions (window->action_group, radio_location_bar_entries, G_N_ELEMENTS (radio_location_bar_entries), THUNAR_LOCATION_BAR_NONE, G_CALLBACK (thunar_window_action_location_bar_changed), GTK_WIDGET (window));
+ gtk_action_group_add_radio_actions (window->action_group, radio_side_pane_entries, G_N_ELEMENTS (radio_side_pane_entries), THUNAR_SIDE_PANE_NONE, G_CALLBACK (thunar_window_action_side_pane_changed), GTK_WIDGET (window));
/* initialize the "show-hidden" action using the last value from the preferences */
action = gtk_action_group_get_action (window->action_group, "show-hidden");
@@ -1675,111 +1698,51 @@ thunar_window_action_reload (GtkAction *action,
static void
-thunar_window_action_pathbar_changed (GtkToggleAction *action,
- ThunarWindow *window)
+thunar_window_action_location_bar_changed (GtkRadioAction *action,
+ GtkRadioAction *current,
+ ThunarWindow *window)
{
- GtkAction *other_action;
- GType type;
+ GType type;
+ gint value;
- _thunar_return_if_fail (GTK_IS_TOGGLE_ACTION (action));
+ _thunar_return_if_fail (GTK_IS_RADIO_ACTION (action));
_thunar_return_if_fail (THUNAR_IS_WINDOW (window));
- /* determine the new type of location bar */
- type = gtk_toggle_action_get_active (action) ? THUNAR_TYPE_LOCATION_BUTTONS : G_TYPE_NONE;
+ value = gtk_radio_action_get_current_value (action);
+ if (value == THUNAR_LOCATION_BAR_PATHBAR)
+ type = THUNAR_TYPE_LOCATION_BUTTONS;
+ else if (value == THUNAR_LOCATION_BAR_TOOLBAR)
+ type = THUNAR_TYPE_LOCATION_ENTRY;
+ else
+ type = G_TYPE_NONE;
- /* install the new location bar */
+ /* install the new bar */
thunar_window_install_location_bar (window, type);
-
- /* check if we actually installed anything */
- if (G_LIKELY (type != G_TYPE_NONE))
- {
- /* reset the state of the toolbar action (without firing the handler) */
- other_action = gtk_action_group_get_action (window->action_group, "view-location-selector-toolbar");
- g_signal_handlers_block_by_func (G_OBJECT (other_action), thunar_window_action_toolbar_changed, window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (other_action), FALSE);
- g_signal_handlers_unblock_by_func (G_OBJECT (other_action), thunar_window_action_toolbar_changed, window);
- }
}
static void
-thunar_window_action_toolbar_changed (GtkToggleAction *action,
- ThunarWindow *window)
+thunar_window_action_side_pane_changed (GtkRadioAction *action,
+ GtkRadioAction *current,
+ ThunarWindow *window)
{
- GtkAction *other_action;
- GType type;
+ GType type;
+ gint value;
- _thunar_return_if_fail (GTK_IS_TOGGLE_ACTION (action));
+ _thunar_return_if_fail (GTK_IS_RADIO_ACTION (action));
_thunar_return_if_fail (THUNAR_IS_WINDOW (window));
- /* determine the new type of location bar */
- type = gtk_toggle_action_get_active (action) ? THUNAR_TYPE_LOCATION_ENTRY : G_TYPE_NONE;
-
- /* install the new location bar */
- thunar_window_install_location_bar (window, type);
-
- /* check if we actually installed anything */
- if (G_LIKELY (type != G_TYPE_NONE))
- {
- /* reset the state of the pathbar action (without firing the handler) */
- other_action = gtk_action_group_get_action (window->action_group, "view-location-selector-pathbar");
- g_signal_handlers_block_by_func (G_OBJECT (other_action), thunar_window_action_pathbar_changed, window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (other_action), FALSE);
- g_signal_handlers_unblock_by_func (G_OBJECT (other_action), thunar_window_action_pathbar_changed, window);
- }
-}
-
-
-
-static void
-thunar_window_action_shortcuts_changed (GtkToggleAction *action,
- ThunarWindow *window)
-{
- GtkAction *other_action;
- GType type;
-
- /* determine the new type of side pane */
- type = gtk_toggle_action_get_active (action) ? THUNAR_TYPE_SHORTCUTS_PANE : G_TYPE_NONE;
-
- /* install the new sidepane */
- thunar_window_install_sidepane (window, type);
-
- /* check if we actually installed anything */
- if (G_LIKELY (type != G_TYPE_NONE))
- {
- /* reset the state of the tree pane action (without firing the handler) */
- other_action = gtk_action_group_get_action (window->action_group, "view-side-pane-tree");
- g_signal_handlers_block_by_func (G_OBJECT (other_action), thunar_window_action_tree_changed, window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (other_action), FALSE);
- g_signal_handlers_unblock_by_func (G_OBJECT (other_action), thunar_window_action_tree_changed, window);
- }
-}
-
-
-
-static void
-thunar_window_action_tree_changed (GtkToggleAction *action,
- ThunarWindow *window)
-{
- GtkAction *other_action;
- GType type;
-
- /* determine the new type of side pane */
- type = gtk_toggle_action_get_active (action) ? THUNAR_TYPE_TREE_PANE : G_TYPE_NONE;
+ value = gtk_radio_action_get_current_value (action);
+ if (value == THUNAR_SIDE_PANE_SHORTCUTS)
+ type = THUNAR_TYPE_SHORTCUTS_PANE;
+ else if (value == THUNAR_SIDE_PANE_TREE)
+ type = THUNAR_TYPE_TREE_PANE;
+ else
+ type = G_TYPE_NONE;
/* install the new sidepane */
thunar_window_install_sidepane (window, type);
-
- /* check if we actually installed anything */
- if (G_LIKELY (type != G_TYPE_NONE))
- {
- /* reset the state of the shortcuts pane action (without firing the handler) */
- other_action = gtk_action_group_get_action (window->action_group, "view-side-pane-shortcuts");
- g_signal_handlers_block_by_func (G_OBJECT (other_action), thunar_window_action_shortcuts_changed, window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (other_action), FALSE);
- g_signal_handlers_unblock_by_func (G_OBJECT (other_action), thunar_window_action_shortcuts_changed, window);
- }
}