@@ -310,6 +310,7 @@ caja_spatial_window_show (GtkWidget *widget)
310310{
311311 CajaWindow * window ;
312312 CajaWindowSlot * slot ;
313+ GFile * location ;
313314
314315 window = CAJA_WINDOW (widget );
315316 slot = caja_window_get_active_slot (window );
@@ -320,6 +321,28 @@ caja_spatial_window_show (GtkWidget *widget)
320321 {
321322 caja_query_editor_grab_focus (CAJA_QUERY_EDITOR (slot -> query_editor ));
322323 }
324+
325+ location = caja_window_slot_get_location (slot );
326+ g_return_if_fail (location != NULL );
327+
328+ while (location != NULL ) {
329+ CajaFile * file ;
330+
331+ file = caja_file_get (location );
332+
333+ if (!caja_file_check_if_ready (file , CAJA_FILE_ATTRIBUTE_INFO )) {
334+ caja_file_call_when_ready (file ,
335+ CAJA_FILE_ATTRIBUTE_INFO ,
336+ NULL ,
337+ NULL );
338+ }
339+
340+ location = g_file_get_parent (location );
341+ }
342+
343+ if (location ) {
344+ g_object_unref (location );
345+ }
323346}
324347
325348static void
@@ -560,49 +583,6 @@ location_menu_item_activated_callback (GtkWidget *menu_item,
560583 g_object_unref (current );
561584}
562585
563- static void
564- got_file_info_for_location_menu_callback (CajaFile * file ,
565- gpointer callback_data )
566- {
567- GtkWidget * menu_item = callback_data ;
568- GtkWidget * label ;
569- GtkWidget * icon ;
570- GdkPixbuf * pixbuf ;
571- char * name ;
572-
573- g_return_if_fail (CAJA_IS_FILE (file ));
574-
575- pixbuf = NULL ;
576-
577- name = caja_file_get_display_name (file );
578- label = gtk_bin_get_child (GTK_BIN (menu_item ));
579- gtk_label_set_label (GTK_LABEL (label ), name );
580- g_free (name );
581-
582- pixbuf = caja_file_get_icon_pixbuf (file ,
583- caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU ),
584- TRUE,
585- gtk_widget_get_scale_factor (GTK_WIDGET (menu_item )),
586- CAJA_FILE_ICON_FLAGS_IGNORE_VISITING );
587-
588- if (pixbuf != NULL )
589- {
590- icon = gtk_image_new_from_pixbuf (pixbuf );
591- g_object_unref (pixbuf );
592- }
593- else
594- {
595- icon = gtk_image_new_from_icon_name ("document-open" , GTK_ICON_SIZE_MENU );
596- }
597-
598- if (icon )
599- {
600- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item ), icon );
601- }
602- g_object_unref (file );
603- g_object_unref (menu_item );
604- }
605-
606586static void
607587menu_deactivate_callback (GtkWidget * menu ,
608588 gpointer data )
@@ -663,18 +643,22 @@ location_button_pressed_callback (GtkWidget *widget,
663643}
664644
665645static void
666- location_button_clicked_callback (GtkWidget * widget ,
646+ location_button_clicked_callback (GtkWidget * widget ,
667647 CajaSpatialWindow * window )
668648{
669649 CajaWindowSlot * slot ;
670650 GtkWidget * popup , * menu_item , * first_item = NULL ;
651+ GdkPixbuf * pixbuf ;
671652 GFile * location ;
672653 GFile * child_location ;
673654 GMainLoop * loop ;
674655
675656 slot = caja_window_get_active_slot (CAJA_WINDOW (window ));
676657
677658 popup = gtk_menu_new ();
659+
660+ gtk_menu_set_reserve_toggle_size (GTK_MENU (popup ), FALSE);
661+
678662 first_item = NULL ;
679663
680664 location = caja_window_slot_get_location (slot );
@@ -688,20 +672,29 @@ location_button_clicked_callback (GtkWidget *widget,
688672 file = caja_file_get (location );
689673
690674 name = caja_file_get_display_name (file );
691- menu_item = gtk_image_menu_item_new_with_label (name );
692- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (menu_item ), TRUE);
693- g_free (name );
675+
676+ pixbuf = NULL ;
677+
678+ pixbuf = caja_file_get_icon_pixbuf (file ,
679+ caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU ),
680+ TRUE,
681+ gtk_widget_get_scale_factor (widget ),
682+ CAJA_FILE_ICON_FLAGS_IGNORE_VISITING );
683+
684+ if (pixbuf != NULL )
685+ {
686+ menu_item = eel_image_menu_item_new_from_pixbuf (pixbuf , name );
687+ g_object_unref (pixbuf );
688+ }
689+ else
690+ {
691+ menu_item = eel_image_menu_item_new_from_icon ("document-open" , name );
692+ }
694693
695694 if (first_item == NULL ) {
696695 first_item = menu_item ;
697696 }
698697
699- g_object_ref (menu_item );
700- caja_file_call_when_ready (file ,
701- CAJA_FILE_ATTRIBUTE_INFO ,
702- got_file_info_for_location_menu_callback ,
703- menu_item );
704-
705698 gtk_widget_show (menu_item );
706699 g_signal_connect (menu_item , "activate" ,
707700 G_CALLBACK (location_menu_item_activated_callback ),
@@ -1095,7 +1088,6 @@ caja_spatial_window_init (CajaSpatialWindow *window)
10951088 for (i = 0 ; i < G_N_ELEMENTS (icon_entries ); i ++ )
10961089 {
10971090 menuitem = gtk_ui_manager_get_widget (ui_manager , icon_entries [i ]);
1098- gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (menuitem ), TRUE);
10991091 }
11001092 caja_window_set_active_pane (win , pane );
11011093}
0 commit comments