Skip to content

Commit a3f0a31

Browse files
committed
toolbar: Add 'toggle-extra-pane' button.
User can now add this to their toolbar. It mimics 'Extra Pane' in the View menu. ref: #1682.
1 parent 7edb9e1 commit a3f0a31

9 files changed

Lines changed: 97 additions & 25 deletions

gresources/nemo-file-management-properties.glade

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ along with . If not, see <http://www.gnu.org/licenses/>.
6060
<property name="can-focus">False</property>
6161
<property name="icon-name">xapp-prefs-preview-symbolic</property>
6262
</object>
63+
<object class="GtkImage" id="image15">
64+
<property name="visible">True</property>
65+
<property name="can-focus">False</property>
66+
<property name="icon-name">view-dual-symbolic</property>
67+
</object>
6368
<object class="GtkImage" id="image2">
6469
<property name="visible">True</property>
6570
<property name="can-focus">False</property>
@@ -2927,7 +2932,7 @@ along with . If not, see <http://www.gnu.org/licenses/>.
29272932
</packing>
29282933
</child>
29292934
<child>
2930-
<!-- n-columns=3 n-rows=7 -->
2935+
<!-- n-columns=2 n-rows=8 -->
29312936
<object class="GtkGrid">
29322937
<property name="visible">True</property>
29332938
<property name="can-focus">False</property>
@@ -3456,22 +3461,41 @@ along with . If not, see <http://www.gnu.org/licenses/>.
34563461
</packing>
34573462
</child>
34583463
<child>
3459-
<placeholder/>
3460-
</child>
3461-
<child>
3462-
<placeholder/>
3463-
</child>
3464-
<child>
3465-
<placeholder/>
3466-
</child>
3467-
<child>
3468-
<placeholder/>
3469-
</child>
3470-
<child>
3471-
<placeholder/>
3472-
</child>
3473-
<child>
3474-
<placeholder/>
3464+
<object class="GtkBox">
3465+
<property name="visible">True</property>
3466+
<property name="can-focus">False</property>
3467+
<property name="spacing">6</property>
3468+
<child>
3469+
<object class="GtkToggleButton" id="show_toggle_extra_pane_icon_toolbar_togglebutton">
3470+
<property name="name">show_previous_icon_toolbar_togglebutton</property>
3471+
<property name="visible">True</property>
3472+
<property name="can-focus">True</property>
3473+
<property name="receives-default">True</property>
3474+
<property name="image">image15</property>
3475+
</object>
3476+
<packing>
3477+
<property name="expand">False</property>
3478+
<property name="fill">True</property>
3479+
<property name="position">0</property>
3480+
</packing>
3481+
</child>
3482+
<child>
3483+
<object class="GtkLabel">
3484+
<property name="visible">True</property>
3485+
<property name="can-focus">False</property>
3486+
<property name="label" translatable="yes">Extra Pane</property>
3487+
</object>
3488+
<packing>
3489+
<property name="expand">False</property>
3490+
<property name="fill">True</property>
3491+
<property name="position">1</property>
3492+
</packing>
3493+
</child>
3494+
</object>
3495+
<packing>
3496+
<property name="left-attach">0</property>
3497+
<property name="top-attach">7</property>
3498+
</packing>
34753499
</child>
34763500
<child>
34773501
<placeholder/>

libnemo-private/nemo-global-preferences.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ typedef enum
106106
#define NEMO_PREFERENCES_SHOW_COMPACT_VIEW_ICON_TOOLBAR "show-compact-view-icon-toolbar"
107107
#define NEMO_PREFERENCES_SHOW_ROOT_WARNING "show-root-warning"
108108
#define NEMO_PREFERENCES_SHOW_SHOW_THUMBNAILS_TOOLBAR "show-show-thumbnails-toolbar"
109+
#define NEMO_PREFERENCES_SHOW_TOGGLE_EXTRA_PANE_TOOLBAR "show-toggle-extra-pane-toolbar"
109110

110111
/* Which views should be displayed for new windows */
111112
#define NEMO_WINDOW_STATE_START_WITH_STATUS_BAR "start-with-status-bar"

libnemo-private/org.nemo.gschema.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@
176176
<summary>Show Thumbnails button in nemo toolbar</summary>
177177
<description>If set to true, then Nemo browser windows will show the button.</description>
178178
</key>
179+
<key type="b" name="show-toggle-extra-pane-toolbar">
180+
<default>false</default>
181+
<summary>Show Extra Pane button in nemo toolbar</summary>
182+
<description>If set to true, then Nemo browser windows will show the button.</description>
183+
</key>
179184
<key type="b" name="show-root-warning">
180185
<default>true</default>
181186
<summary>Show warning when opening as root</summary>

src/nemo-file-management-properties.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
#define NEMO_FILE_MANAGEMENT_PROPERTIES_SHOW_LIST_VIEW_ICON_TOOLBAR_WIDGET "show_list_view_icon_toolbar_togglebutton"
8989
#define NEMO_FILE_MANAGEMENT_PROPERTIES_SHOW_COMPACT_VIEW_ICON_TOOLBAR_WIDGET "show_compact_view_icon_toolbar_togglebutton"
9090
#define NEMO_FILE_MANAGEMENT_PROPERTIES_SHOW_SHOW_THUMBNAILS_ICON_TOOLBAR_WIDGET "show_show_thumbnails_icon_toolbar_togglebutton"
91+
#define NEMO_FILE_MANAGEMENT_PROPERTIES_SHOW_TOGGLE_EXTRA_PANE_ICON_TOOLBAR_WIDGET "show_toggle_extra_pane_icon_toolbar_togglebutton"
9192

9293
#define NEMO_FILE_MANAGEMENT_PROPERTIES_SHOW_FULL_PATH_IN_TITLE_BARS_WIDGET "show_full_path_in_title_bars_checkbutton"
9394
#define NEMO_FILE_MANAGEMENT_PROPERTIES_CLOSE_DEVICE_VIEW_ON_EJECT_WIDGET "close_device_view_on_eject_checkbutton"
@@ -901,6 +902,9 @@ nemo_file_management_properties_dialog_setup (GtkBuilder *builder,
901902
bind_builder_bool (builder, nemo_preferences,
902903
NEMO_FILE_MANAGEMENT_PROPERTIES_SHOW_OPEN_IN_TERMINAL_ICON_TOOLBAR_WIDGET,
903904
NEMO_PREFERENCES_SHOW_OPEN_IN_TERMINAL_TOOLBAR);
905+
bind_builder_bool (builder, nemo_preferences,
906+
NEMO_FILE_MANAGEMENT_PROPERTIES_SHOW_TOGGLE_EXTRA_PANE_ICON_TOOLBAR_WIDGET,
907+
NEMO_PREFERENCES_SHOW_TOGGLE_EXTRA_PANE_TOOLBAR);
904908
bind_builder_bool (builder, nemo_preferences,
905909
NEMO_FILE_MANAGEMENT_PROPERTIES_SHOW_ICON_VIEW_ICON_TOOLBAR_WIDGET,
906910
NEMO_PREFERENCES_SHOW_ICON_VIEW_ICON_TOOLBAR);

src/nemo-toolbar.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ struct _NemoToolbarPriv {
5656
GtkWidget *list_view_button;
5757
GtkWidget *compact_view_button;
5858
GtkWidget *show_thumbnails_button;
59+
GtkWidget *show_extra_pane_button;
5960

6061
GtkWidget *path_bar;
6162
GtkWidget *location_bar;
@@ -197,6 +198,11 @@ toolbar_update_appearance (NemoToolbar *self)
197198
icon_toolbar = g_settings_get_boolean (nemo_preferences, NEMO_PREFERENCES_SHOW_SHOW_THUMBNAILS_TOOLBAR);
198199
if ( icon_toolbar == FALSE ) { gtk_widget_hide (widgetitem); }
199200
else {gtk_widget_show (GTK_WIDGET(widgetitem));}
201+
202+
widgetitem = self->priv->show_extra_pane_button;
203+
icon_toolbar = g_settings_get_boolean (nemo_preferences, NEMO_PREFERENCES_SHOW_TOGGLE_EXTRA_PANE_TOOLBAR);
204+
if ( icon_toolbar == FALSE ) { gtk_widget_hide (widgetitem); }
205+
else {gtk_widget_show (GTK_WIDGET(widgetitem));}
200206
}
201207

202208
static void
@@ -343,6 +349,9 @@ nemo_toolbar_constructed (GObject *obj)
343349

344350
setup_root_info_bar (self);
345351

352+
self->priv->show_extra_pane_button = toolbar_create_toolbutton (self, TRUE, NEMO_ACTION_SHOW_HIDE_EXTRA_PANE);
353+
gtk_container_add (GTK_CONTAINER (box), self->priv->show_extra_pane_button);
354+
346355
self->priv->icon_view_button = toolbar_create_toolbutton (self, TRUE, NEMO_ACTION_ICON_VIEW);
347356
gtk_container_add (GTK_CONTAINER (box), self->priv->icon_view_button);
348357

src/nemo-window-menus.c

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ action_split_view_callback (GtkAction *action,
658658
}
659659
}
660660

661-
nemo_window_update_split_view_actions_sensitivity (window);
661+
nemo_window_update_show_hide_ui_elements (window);
662662
}
663663

664664
static void
@@ -778,20 +778,36 @@ update_side_bar_radio_buttons (NemoWindow *window)
778778
}
779779

780780
void
781-
nemo_window_update_show_hide_menu_items (NemoWindow *window)
781+
nemo_window_update_show_hide_ui_elements (NemoWindow *window)
782782
{
783+
NemoWindowPane *pane;
783784
GtkActionGroup *action_group;
784785
GtkAction *action;
785786

786787
action_group = nemo_window_get_main_action_group (window);
787788

788789
action = gtk_action_group_get_action (action_group,
789790
NEMO_ACTION_SHOW_HIDE_EXTRA_PANE);
791+
gtk_action_block_activate (action);
790792
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
791793
nemo_window_split_view_showing (window));
794+
gtk_action_unblock_activate (action);
795+
792796
nemo_window_update_split_view_actions_sensitivity (window);
793797

794798
update_side_bar_radio_buttons (window);
799+
800+
pane = nemo_window_get_active_pane (window);
801+
if (pane != NULL) {
802+
action_group = nemo_window_pane_get_toolbar_action_group (pane);
803+
804+
action = gtk_action_group_get_action (action_group,
805+
NEMO_ACTION_SHOW_HIDE_EXTRA_PANE);
806+
gtk_action_block_activate (action);
807+
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
808+
nemo_window_split_view_showing (window));
809+
gtk_action_unblock_activate (action);
810+
}
795811
}
796812

797813
static void
@@ -1788,6 +1804,19 @@ nemo_window_create_toolbar_action_group (NemoWindow *window)
17881804

17891805
g_object_unref (action);
17901806

1807+
action = GTK_ACTION (gtk_toggle_action_new (NEMO_ACTION_SHOW_HIDE_EXTRA_PANE,
1808+
NULL,
1809+
_("Open an extra folder view side-by-side"),
1810+
NULL));
1811+
g_signal_connect (action, "activate",
1812+
G_CALLBACK (action_split_view_callback),
1813+
window);
1814+
1815+
gtk_action_group_add_action (action_group, action);
1816+
gtk_action_set_icon_name (GTK_ACTION (action), "view-dual-symbolic");
1817+
1818+
g_object_unref (action);
1819+
17911820
navigation_state = nemo_window_get_navigation_state (window);
17921821
nemo_navigation_state_add_group (navigation_state, action_group);
17931822

@@ -1853,7 +1882,7 @@ nemo_window_initialize_actions (NemoWindow *window)
18531882
nav_state_actions);
18541883

18551884
window_menus_set_bindings (window);
1856-
nemo_window_update_show_hide_menu_items (window);
1885+
nemo_window_update_show_hide_ui_elements (window);
18571886

18581887
g_signal_connect (window, "loading_uri",
18591888
G_CALLBACK (nemo_window_update_split_view_actions_sensitivity),

src/nemo-window-pane.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ nemo_window_pane_close_slot (NemoWindowPane *pane,
12821282

12831283
DEBUG ("Calling set_active_pane, new slot %p", new_pane->active_slot);
12841284
nemo_window_set_active_pane (window, new_pane);
1285-
nemo_window_update_show_hide_menu_items (window);
1285+
nemo_window_update_show_hide_ui_elements (window);
12861286
} else {
12871287
DEBUG ("Last slot removed from the last pane, close the window");
12881288
nemo_window_close (window);

src/nemo-window-private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ void nemo_window_initialize_actions (NemoWindow
173173
void nemo_window_initialize_menus (NemoWindow *window);
174174
void nemo_window_finalize_menus (NemoWindow *window);
175175

176-
void nemo_window_update_show_hide_menu_items (NemoWindow *window);
176+
void nemo_window_update_show_hide_ui_elements (NemoWindow *window);
177177

178178
/* window toolbar */
179179
void nemo_window_close_pane (NemoWindow *window,

src/nemo-window.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ nemo_window_hide_sidebar (NemoWindow *window)
478478
}
479479

480480
nemo_window_tear_down_sidebar (window);
481-
nemo_window_update_show_hide_menu_items (window);
481+
nemo_window_update_show_hide_ui_elements (window);
482482

483483
nemo_window_set_show_sidebar (window, FALSE);
484484
}
@@ -497,7 +497,7 @@ nemo_window_show_sidebar (NemoWindow *window)
497497
}
498498

499499
nemo_window_set_up_sidebar (window);
500-
nemo_window_update_show_hide_menu_items (window);
500+
nemo_window_update_show_hide_ui_elements (window);
501501

502502
nemo_window_set_show_sidebar (window, TRUE);
503503
}
@@ -2247,7 +2247,7 @@ nemo_window_split_view_off (NemoWindow *window)
22472247
nemo_navigation_state_set_master (window->details->nav_state,
22482248
active_pane->action_group);
22492249

2250-
nemo_window_update_show_hide_menu_items (window);
2250+
nemo_window_update_show_hide_ui_elements (window);
22512251
}
22522252

22532253
gboolean

0 commit comments

Comments
 (0)