~ubuntu-branches/ubuntu/hardy/eog/hardy-updates

« back to all changes in this revision

Viewing changes to src/eog-list-store.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-12-04 11:57:27 UTC
  • mfrom: (1.1.36 upstream)
  • Revision ID: james.westby@ubuntu.com-20071204115727-lka8thyx592x3owl
Tags: 2.21.2-0ubuntu1
* New upstream version:
  New features:
  - Support for resetting the toolbar to its default layout (LP: #145327)
  Misc improvements/fixes:
  - Fixes for memory leaks and code optimizations
  - Improvements in plugin API
  - Improvements in the plugin system Python bindinds
  Bug fixes:
  - #458661, Up/Down keys in image collection
  - #491528, Use trash icon i.s.o. delete icon for move to trash menu item
  - #491826, Defaults are wrong
  - #494881, Support for exempi 1.99.5
  - #496184, Eog does not support color management
  - #499154, Specify correct type for eog_image_load and _has_data
  - #499156, Wrap eog_image_load in Python
  - #480975, Feature request : EOG lack an option to reset toolbars

Show diffs side-by-side

added added

removed removed

Lines of Context:
251
251
        return found;
252
252
}
253
253
 
 
254
static gboolean
 
255
is_file_in_list_store_uri (EogListStore *store,
 
256
                           const GnomeVFSURI *uri,
 
257
                           GtkTreeIter *iter_found)
 
258
{
 
259
        gchar *uri_str;
 
260
        gboolean result;
 
261
        
 
262
        uri_str = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
 
263
 
 
264
        result = is_file_in_list_store (store, uri_str, iter_found);
 
265
 
 
266
        g_free (uri_str);
 
267
 
 
268
        return result;
 
269
}
 
270
 
254
271
static void
255
272
eog_job_thumbnail_cb (EogJobThumbnail *job, gpointer data)
256
273
{
257
274
        EogListStore *store;
258
275
        GtkTreeIter iter;
259
 
        gchar *filename;
260
276
        EogImage *image;
261
277
        GdkPixbuf *thumbnail;
262
278
        
264
280
 
265
281
        store = EOG_LIST_STORE (data);
266
282
 
267
 
        filename = gnome_vfs_uri_to_string (job->uri_entry, GNOME_VFS_URI_HIDE_NONE);
268
 
 
269
 
        if (is_file_in_list_store (store, filename, &iter)) {
 
283
        if (is_file_in_list_store_uri (store, job->uri_entry, &iter)) {
270
284
                gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, 
271
285
                                    EOG_LIST_STORE_EOG_IMAGE, &image,
272
286
                                    -1);
289
303
 
290
304
                g_object_unref (thumbnail);
291
305
        }
292
 
 
293
 
        g_free (filename);
294
306
}
295
307
 
296
308
static void
558
570
                                continue;
559
571
 
560
572
                        if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) {
561
 
                                gchar *uri_str;
562
 
 
563
573
                                eog_list_store_append_directory (store, uri, info);
564
574
 
565
 
                                uri_str = gnome_vfs_uri_to_string (initial_uri, 
566
 
                                                       GNOME_VFS_URI_HIDE_NONE);
567
 
                                if (!is_file_in_list_store (store, uri_str, 
568
 
                                                            &iter)) {
 
575
                                if (!is_file_in_list_store_uri (store,
 
576
                                                                initial_uri, 
 
577
                                                                &iter)) {
569
578
                                        eog_list_store_append_image_from_uri (store, initial_uri, TRUE);
570
579
                                }
571
 
                                g_free (uri_str);
572
580
                        } else {
573
581
                                eog_list_store_append_image_from_uri (store, initial_uri, FALSE);
574
582
                        }
585
593
                                              GTK_SORT_ASCENDING);
586
594
        
587
595
        if (initial_uri && 
588
 
            is_file_in_list_store (store, 
589
 
                                   gnome_vfs_uri_to_string (initial_uri, GNOME_VFS_URI_HIDE_NONE), 
590
 
                                   &iter)) {
 
596
            is_file_in_list_store_uri (store, initial_uri, &iter)) {
591
597
                store->priv->initial_image = eog_list_store_get_pos_by_iter (store, &iter);
592
598
                gnome_vfs_uri_unref (initial_uri);
593
599
        } else {
599
605
eog_list_store_remove_image (EogListStore *store, EogImage *image)
600
606
{
601
607
        GtkTreeIter iter;
602
 
        gchar *file;
603
608
        GnomeVFSURI *uri;
604
609
 
605
610
        g_return_if_fail (EOG_IS_LIST_STORE (store));
606
611
        g_return_if_fail (EOG_IS_IMAGE (image));
607
612
 
608
613
        uri = eog_image_get_uri (image);
609
 
        file = gnome_vfs_uri_to_string (uri, 
610
 
                                        GNOME_VFS_URI_HIDE_NONE);
611
 
        gnome_vfs_uri_unref (uri);
612
 
        
613
 
        if (is_file_in_list_store (store, file, &iter)) {
 
614
 
 
615
        if (is_file_in_list_store_uri (store, uri, &iter)) {
614
616
                eog_list_store_remove (store, &iter);
615
617
        }
616
 
        g_free (file);
 
618
        gnome_vfs_uri_unref (uri);
617
619
}
618
620
 
619
621
GtkListStore *
634
636
gint
635
637
eog_list_store_get_pos_by_image (EogListStore *store, EogImage *image)
636
638
{
637
 
        gchar *file;
638
639
        GtkTreeIter iter;
639
640
        gint pos = -1;
640
641
        GnomeVFSURI *uri;
643
644
        g_return_val_if_fail (EOG_IS_IMAGE (image), -1);
644
645
        
645
646
        uri = eog_image_get_uri (image);
646
 
        file = gnome_vfs_uri_to_string (uri, 
647
 
                                        GNOME_VFS_URI_HIDE_NONE);
648
 
        gnome_vfs_uri_unref (uri);
649
647
 
650
 
        if (is_file_in_list_store (store, file, &iter)) {
 
648
        if (is_file_in_list_store_uri (store, uri, &iter)) {
651
649
                pos = eog_list_store_get_pos_by_iter (store, &iter);
652
650
        }
653
651
 
654
 
        g_free (file);
 
652
        gnome_vfs_uri_unref (uri);
655
653
        return pos;
656
654
}
657
655
 
735
733
        
736
734
        gtk_tree_model_get (GTK_TREE_MODEL (store), iter, 
737
735
                            EOG_LIST_STORE_EOG_IMAGE, &image,
 
736
                            EOG_LIST_STORE_EOG_JOB, &job,
738
737
                            -1);
739
 
        
 
738
 
 
739
        if (job != NULL) {
 
740
                g_object_unref (image);
 
741
                return;
 
742
        }
 
743
 
740
744
        uri = eog_image_get_uri (image);
741
745
        job = eog_job_thumbnail_new (uri);
742
746
        gnome_vfs_uri_unref (uri);