@@ -368,13 +368,14 @@ eom_list_store_append_image (EomListStore *store, EomImage *image)
368368
369369static void
370370eom_list_store_append_image_from_file (EomListStore * store ,
371- GFile * file )
371+ GFile * file ,
372+ const gchar * caption )
372373{
373374 EomImage * image ;
374375
375376 g_return_if_fail (EOM_IS_LIST_STORE (store ));
376377
377- image = eom_image_new_file (file );
378+ image = eom_image_new_file (file , caption );
378379
379380 eom_list_store_append_image (store , image );
380381}
@@ -394,7 +395,8 @@ file_monitor_changed_cb (GFileMonitor *monitor,
394395 switch (event ) {
395396 case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT :
396397 file_info = g_file_query_info (file ,
397- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ,
398+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
399+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ,
398400 0 , NULL , NULL );
399401 if (file_info == NULL ) {
400402 break ;
@@ -414,7 +416,10 @@ file_monitor_changed_cb (GFileMonitor *monitor,
414416 }
415417 } else {
416418 if (eom_image_is_supported_mime_type (mimetype )) {
417- eom_list_store_append_image_from_file (store , file );
419+ const gchar * caption ;
420+
421+ caption = g_file_info_get_display_name (file_info );
422+ eom_list_store_append_image_from_file (store , file , caption );
418423 }
419424 }
420425 g_object_unref (file_info );
@@ -433,15 +438,19 @@ file_monitor_changed_cb (GFileMonitor *monitor,
433438 case G_FILE_MONITOR_EVENT_CREATED :
434439 if (!is_file_in_list_store_file (store , file , NULL )) {
435440 file_info = g_file_query_info (file ,
436- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ,
441+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
442+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ,
437443 0 , NULL , NULL );
438444 if (file_info == NULL ) {
439445 break ;
440446 }
441447 mimetype = g_file_info_get_content_type (file_info );
442448
443449 if (eom_image_is_supported_mime_type (mimetype )) {
444- eom_list_store_append_image_from_file (store , file );
450+ const gchar * caption ;
451+
452+ caption = g_file_info_get_display_name (file_info );
453+ eom_list_store_append_image_from_file (store , file , caption );
445454 }
446455 g_object_unref (file_info );
447456 }
@@ -489,8 +498,11 @@ directory_visit (GFile *directory,
489498 }
490499
491500 if (load_uri ) {
501+ const gchar * caption ;
502+
492503 child = g_file_get_child (directory , name );
493- eom_list_store_append_image_from_file (store , child );
504+ caption = g_file_info_get_display_name (children_info );
505+ eom_list_store_append_image_from_file (store , child , caption );
494506 }
495507}
496508
@@ -519,6 +531,7 @@ eom_list_store_append_directory (EomListStore *store,
519531
520532 file_enumerator = g_file_enumerate_children (file ,
521533 G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
534+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ","
522535 G_FILE_ATTRIBUTE_STANDARD_NAME ,
523536 0 , NULL , NULL );
524537 file_info = g_file_enumerator_next_file (file_enumerator , NULL , NULL );
@@ -565,14 +578,18 @@ eom_list_store_add_files (EomListStore *store, GList *file_list)
565578
566579 for (it = file_list ; it != NULL ; it = it -> next ) {
567580 GFile * file = (GFile * ) it -> data ;
581+ gchar * caption = NULL ;
568582
569583 file_info = g_file_query_info (file ,
570584 G_FILE_ATTRIBUTE_STANDARD_TYPE ","
571- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ,
585+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
586+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ,
572587 0 , NULL , NULL );
573588 if (file_info == NULL ) {
574589 continue ;
575590 }
591+
592+ caption = g_strdup (g_file_info_get_display_name (file_info ));
576593 file_type = g_file_info_get_file_type (file_info );
577594
578595 /* Workaround for gvfs backends that don't set the GFileType. */
@@ -613,16 +630,18 @@ eom_list_store_add_files (EomListStore *store, GList *file_list)
613630 if (!is_file_in_list_store_file (store ,
614631 initial_file ,
615632 & iter )) {
616- eom_list_store_append_image_from_file (store , initial_file );
633+ eom_list_store_append_image_from_file (store , initial_file , caption );
617634 }
618635 } else {
619- eom_list_store_append_image_from_file (store , initial_file );
636+ eom_list_store_append_image_from_file (store , initial_file , caption );
620637 }
621638 g_object_unref (file );
622639 } else if (file_type == G_FILE_TYPE_REGULAR &&
623640 g_list_length (file_list ) > 1 ) {
624- eom_list_store_append_image_from_file (store , file );
641+ eom_list_store_append_image_from_file (store , file , caption );
625642 }
643+
644+ g_free (caption );
626645 }
627646
628647 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store ),
0 commit comments