@@ -1054,6 +1054,10 @@ nemo_window_set_active_pane (NemoWindow *window,
10541054 }
10551055}
10561056
1057+ /* Forward declarations for preview pane callbacks */
1058+ static void preview_pane_selection_changed_callback (NemoView * view , NemoWindow * window );
1059+ static void slot_location_changed_callback (NemoWindowSlot * slot , const char * from_uri , const char * to_uri , NemoWindow * window );
1060+
10571061/* Make both, the given slot the active slot and its corresponding
10581062 * pane the active pane of the associated window.
10591063 * new_slot may be NULL. */
@@ -1083,6 +1087,10 @@ nemo_window_set_active_slot (NemoWindow *window, NemoWindowSlot *new_slot)
10831087 if (old_slot -> content_view != NULL ) {
10841088 nemo_window_disconnect_content_view (window , old_slot -> content_view );
10851089 }
1090+ /* Disconnect from slot's location-changed signal */
1091+ g_signal_handlers_disconnect_by_func (old_slot ,
1092+ G_CALLBACK (slot_location_changed_callback ),
1093+ window );
10861094 gtk_widget_hide (GTK_WIDGET (old_slot -> pane -> tool_bar ));
10871095 /* inform slot & view */
10881096 g_signal_emit_by_name (old_slot , "inactive" );
@@ -1107,6 +1115,11 @@ nemo_window_set_active_slot (NemoWindow *window, NemoWindowSlot *new_slot)
11071115 nemo_window_connect_content_view (window , new_slot -> content_view );
11081116 }
11091117
1118+ /* Connect to slot's location-changed signal for preview pane updates */
1119+ g_signal_connect (new_slot , "location-changed" ,
1120+ G_CALLBACK (slot_location_changed_callback ),
1121+ window );
1122+
11101123 // Show active toolbar
11111124 gboolean show_toolbar ;
11121125 show_toolbar = g_settings_get_boolean (nemo_window_state , NEMO_WINDOW_STATE_START_WITH_TOOLBAR );
@@ -1546,9 +1559,6 @@ nemo_window_sync_create_folder_button (NemoWindow *window)
15461559 toolbar_set_create_folder_button (allow , slot -> pane );
15471560}
15481561
1549- /* Forward declaration for preview pane callback */
1550- static void preview_pane_selection_changed_callback (NemoView * view , NemoWindow * window );
1551-
15521562static void
15531563zoom_level_changed_callback (NemoView * view ,
15541564 NemoWindow * window )
@@ -2220,6 +2230,32 @@ nemo_window_new (GtkApplication *application,
22202230 NULL );
22212231}
22222232
2233+ static void
2234+ slot_location_changed_callback (NemoWindowSlot * slot ,
2235+ const char * from_uri ,
2236+ const char * to_uri ,
2237+ NemoWindow * window )
2238+ {
2239+ GList * selection ;
2240+ NemoFile * file = NULL ;
2241+
2242+ /* Update preview pane when location changes */
2243+ if (window -> details -> preview_pane != NULL ) {
2244+ /* Clear selection first since we're in a new location */
2245+ nemo_preview_pane_set_file (NEMO_PREVIEW_PANE (window -> details -> preview_pane ), NULL );
2246+
2247+ /* If the new location has a selection, show it */
2248+ if (slot -> content_view != NULL ) {
2249+ selection = nemo_view_get_selection (slot -> content_view );
2250+ if (selection != NULL && selection -> data != NULL ) {
2251+ file = NEMO_FILE (selection -> data );
2252+ nemo_preview_pane_set_file (NEMO_PREVIEW_PANE (window -> details -> preview_pane ), file );
2253+ }
2254+ nemo_file_list_free (selection );
2255+ }
2256+ }
2257+ }
2258+
22232259static void
22242260preview_pane_selection_changed_callback (NemoView * view , NemoWindow * window )
22252261{
0 commit comments