[Xfce4-commits] <ristretto:master> Introduce a new folder-concept for opening files.

Stephan Arts noreply at xfce.org
Thu Oct 13 22:42:01 CEST 2011


Updating branch refs/heads/master
         to 07c66b0fb67c0d5e97e4083409c116814ac5eedb (commit)
       from 672b643eb57d8274b0b44836a85503305f0a0748 (commit)

commit 07c66b0fb67c0d5e97e4083409c116814ac5eedb
Author: Stephan Arts <stephan at xfce.org>
Date:   Thu Oct 13 22:39:10 2011 +0200

    Introduce a new folder-concept for opening files.
    
    - Remove the open-folder buttons
    - Open all images in a folder when selecting a single image from it
    - Close all existing opened images when opening a new image
    - Do not allow opening of folders
    
    - Fix a bug with the visibility of the file-toolbar when switching
      between fullscreen states and switching between images while
      fullscreen

 src/file.c                   |   74 +++++++++++-
 src/file.h                   |    7 +
 src/image_list.c             |   25 ++---
 src/main.c                   |   46 +-------
 src/main_window.c            |  266 ++++++++++++-----------------------------
 src/main_window_ui.xml       |    5 -
 src/preferences_dialog.c     |   30 -----
 src/properties_dialog.c      |    3 +
 src/settings.c               |   18 ---
 src/thumbnailer.c            |    2 +
 src/wallpaper_manager.c      |    2 +
 src/xfce_wallpaper_manager.c |    2 +
 12 files changed, 178 insertions(+), 302 deletions(-)

diff --git a/src/file.c b/src/file.c
index fc59f22..98f7dc1 100644
--- a/src/file.c
+++ b/src/file.c
@@ -21,6 +21,8 @@
 #include <glib.h>
 #include <gio/gio.h>
 
+#include <libexif/exif-data.h>
+
 #include <libxfce4util/libxfce4util.h>
 
 #include "file.h"
@@ -93,6 +95,11 @@ struct _RsttoFilePriv
 
     gchar *display_name;
     gchar *content_type;
+
+    gchar *uri;
+    gchar *path;
+
+    ExifData *exif_data;
 };
 
 
@@ -146,6 +153,16 @@ rstto_file_dispose (GObject *object)
             g_free (file->priv->content_type);
             file->priv->content_type = NULL;
         }
+        if (file->priv->path)
+        {
+            g_free (file->priv->path);
+            file->priv->path = NULL;
+        }
+        if (file->priv->uri)
+        {
+            g_free (file->priv->uri);
+            file->priv->uri = NULL;
+        }
 
         g_free (file->priv);
         file->priv = NULL;
@@ -265,13 +282,21 @@ rstto_file_get_display_name ( RsttoFile *file )
 const gchar *
 rstto_file_get_path ( RsttoFile *file )
 {
-    return g_file_get_path (file->priv->file);
+    if ( NULL == file->priv->path )
+    {
+        file->priv->path = g_file_get_path (file->priv->file);
+    }
+    return (const gchar *)file->priv->path;
 }
 
 const gchar *
 rstto_file_get_uri ( RsttoFile *file )
 {
-    return g_file_get_uri (file->priv->file);
+    if ( NULL == file->priv->uri )
+    {
+        file->priv->uri = g_file_get_uri (file->priv->file);
+    }
+    return (const gchar *)file->priv->uri;
 }
 
 const gchar *
@@ -301,3 +326,48 @@ rstto_file_get_content_type ( RsttoFile *file )
 
     return (const gchar *)file->priv->content_type;
 }
+
+guint64
+rstto_file_get_modified_time ( RsttoFile *file )
+{
+    guint64 time = 0;
+    GFileInfo *file_info = g_file_query_info (file->priv->file, "time::modified", 0, NULL, NULL);
+
+    time = g_file_info_get_attribute_uint64 ( file_info, "time::modified" );
+
+    g_object_unref (file_info);
+
+    return time;
+}
+
+gchar *
+rstto_file_get_exif ( RsttoFile *file, ExifTag id )
+{
+    gchar *val = NULL;
+    ExifEntry *exif_entry = NULL;
+
+    /* If there is no exif-data object, try to create it */
+    if ( NULL == file->priv->exif_data )
+    {
+        file->priv->exif_data = exif_data_new_from_file ( rstto_file_get_path (file) );
+    }
+    if ( NULL != file->priv->exif_data )
+    {
+        exif_entry = exif_data_get_entry (
+                file->priv->exif_data,
+                id );
+        if ( NULL != exif_entry )
+        {
+            switch ( id )
+            {
+                default:
+                    val = g_new0 (gchar, 20);
+                    exif_entry_get_value (exif_entry, val, 20);
+                    break;
+            }
+        }
+
+    }
+
+    return val;
+}
diff --git a/src/file.h b/src/file.h
index e7dae41..9ace0de 100644
--- a/src/file.h
+++ b/src/file.h
@@ -83,6 +83,13 @@ rstto_file_get_uri ( RsttoFile * );
 const gchar *
 rstto_file_get_content_type ( RsttoFile * );
 
+guint64
+rstto_file_get_modified_time ( RsttoFile *);
+
+gchar *
+rstto_file_get_exif ( RsttoFile *, ExifTag );
+
+
 G_END_DECLS
 
 #endif /* __RISTRETTO_FILE_H__ */
diff --git a/src/image_list.c b/src/image_list.c
index 870dbf3..5043338 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -678,21 +678,12 @@ cb_rstto_image_list_image_name_compare_func (RsttoFile *a, RsttoFile *b)
 static gint
 cb_rstto_image_list_exif_date_compare_func (RsttoFile *a, RsttoFile *b)
 {
-    gint result = 0;
-    GFile *file_a = rstto_file_get_file (a);
-    GFile *file_b = rstto_file_get_file (b);
-    
-    GFileInfo *file_info_a = g_file_query_info (file_a, "time::modified", 0, NULL, NULL);
-    GFileInfo *file_info_b = g_file_query_info (file_b, "time::modified", 0, NULL, NULL);
-
-    guint64 a_i = g_file_info_get_attribute_uint64(file_info_a, "time::modified");
-    guint64 b_i = g_file_info_get_attribute_uint64(file_info_b, "time::modified");
-    if (a_i > b_i)
-        result = 1;
-    if (a_i < b_i)
-        result = -1;
-
-    g_object_unref (file_info_a);
-    g_object_unref (file_info_b);
-    return result;
+    guint64 a_t = rstto_file_get_modified_time (a);
+    guint64 b_t = rstto_file_get_modified_time (b);
+
+    if (a_t < b_t)
+    {
+        return -1;
+    }
+    return 1;
 }
diff --git a/src/main.c b/src/main.c
index af3b7c5..99cb512 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) Stephan Arts 2006-2010 <stephan at xfce.org>
+ *  Copyright (c) Stephan Arts 2006-2011 <stephan at xfce.org>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -46,7 +46,6 @@ typedef struct {
     gchar **argv;
     gint iter;
     GtkWidget *window;
-    gboolean open_entire_folder;
 } RsttoOpenFiles;
 
 static gboolean
@@ -118,7 +117,6 @@ main(int argc, char **argv)
         rof.argc = argc;
         rof.argv = argv;
     	rof.iter = 1;
-        rof.open_entire_folder = rstto_settings_get_boolean_property (settings, "open-entire-folder");
         rof.window = window;
 
         g_idle_add ((GSourceFunc )cb_rstto_open_files, &rof);
@@ -155,21 +153,14 @@ cb_rstto_open_files (RsttoOpenFiles *rof)
 
     GFileEnumerator *file_enumarator = NULL;
 
-    if ((rof->argc > 2) || (rof->open_entire_folder == FALSE))
+    if (rof->argc > 2)
     {
         if (rof->iter < rof->argc)
         {
             file = g_file_new_for_commandline_arg (rof->argv[rof->iter]);
             if (file)
             {
-                if (rof->open_entire_folder) 
-                {
-                    file_info = g_file_query_info (file, "standard::content-type,standard::type", 0, NULL, NULL);
-                }
-                else
-                {
-                    file_info = g_file_query_info (file, "standard::content-type", 0, NULL, NULL);
-                }
+                file_info = g_file_query_info (file, "standard::content-type", 0, NULL, NULL);
 
                 if (file_info)
                 {
@@ -183,30 +174,6 @@ cb_rstto_open_files (RsttoOpenFiles *rof)
                         }
                     }
 
-                    if (rof->open_entire_folder) 
-                    {
-                        file_type = g_file_info_get_file_type(file_info);
-                        if (file_type == G_FILE_TYPE_DIRECTORY)
-                        {
-                            rstto_main_window_add_file_to_recent_files (file);
-
-                            file_enumarator = g_file_enumerate_children (file, "standard::*", 0, NULL, NULL);
-                            for(file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); file_info != NULL; file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
-                            {
-                                filename = g_file_info_get_name (file_info);
-                                content_type  = g_file_info_get_content_type (file_info);
-                                child_file = g_file_get_child (file, filename);
-
-                                if (strncmp (content_type, "image/", 6) == 0)
-                                {
-                                    rstto_image_list_add_file (rof->image_list, rstto_file_new(child_file), NULL);
-                                }
-
-                                g_object_unref (child_file);
-                                g_object_unref (file_info);
-                            }
-                        }
-                    }
                 }
                 g_object_unref (file);
             }
@@ -236,12 +203,6 @@ cb_rstto_open_files (RsttoOpenFiles *rof)
         }
         if (file_type != G_FILE_TYPE_DIRECTORY) {
             p_file = g_file_get_parent (file);
-        }
-        else
-        {
-            rstto_main_window_add_file_to_recent_files (file);
-            p_file = file;
-        }
         file_enumarator = g_file_enumerate_children (p_file, "standard::*", 0, NULL, NULL);
         for(file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); file_info != NULL; file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
         {
@@ -257,6 +218,7 @@ cb_rstto_open_files (RsttoOpenFiles *rof)
             g_object_unref (child_file);
             g_object_unref (file_info);
         }
+        }
     }
     return FALSE;
 }
diff --git a/src/main_window.c b/src/main_window.c
index 74142db..0936b7f 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -99,7 +99,6 @@ struct _RsttoMainWindowPriv
     GtkWidget *forward;
 
     guint      t_open_merge_id;
-    guint      t_open_folder_merge_id;
     guint      recent_merge_id;
     guint      play_merge_id;
     guint      pause_merge_id;
@@ -188,16 +187,12 @@ cb_rstto_main_window_last_image (GtkWidget *widget, RsttoMainWindow *window);
 static void
 cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window);
 static void
-cb_rstto_main_window_open_folder (GtkWidget *widget, RsttoMainWindow *window);
-static void
 cb_rstto_main_window_open_recent(GtkRecentChooser *chooser, RsttoMainWindow *window);
 static void
 cb_rstto_main_window_properties (GtkWidget *widget, RsttoMainWindow *window);
 static void
 cb_rstto_main_window_close (GtkWidget *widget, RsttoMainWindow *window);
 static void
-cb_rstto_main_window_close_all (GtkWidget *widget, RsttoMainWindow *window);
-static void
 cb_rstto_main_window_save_copy (GtkWidget *widget, RsttoMainWindow *window);
 static void
 cb_rstto_main_window_delete (GtkWidget *widget, RsttoMainWindow *window);
@@ -281,11 +276,9 @@ static GtkActionEntry action_entries[] =
 /* File Menu */
   { "file-menu", NULL, N_ ("_File"), NULL, },
   { "open", "document-open", N_ ("_Open"), "<control>O", N_ ("Open an image"), G_CALLBACK (cb_rstto_main_window_open_image), },
-  { "open-folder", "folder-open", N_ ("Open _Folder"), NULL, N_ ("Open a folder"), G_CALLBACK (cb_rstto_main_window_open_folder), },
   { "save-copy", GTK_STOCK_SAVE_AS, N_ ("_Save copy"), "<control>s", N_ ("Save a copy of the image"), G_CALLBACK (cb_rstto_main_window_save_copy), },
   { "properties", GTK_STOCK_PROPERTIES, N_ ("_Properties"), NULL, N_ ("Show file properties"), G_CALLBACK (cb_rstto_main_window_properties), },
   { "close", GTK_STOCK_CLOSE, N_ ("_Close"), "<control>W", N_ ("Close this image"), G_CALLBACK (cb_rstto_main_window_close), },
-  { "close-all", NULL, N_ ("_Close All"), NULL, N_ ("Close all images"), G_CALLBACK (cb_rstto_main_window_close_all), },
   { "quit", GTK_STOCK_QUIT, N_ ("_Quit"), "<control>Q", N_ ("Quit Ristretto"), G_CALLBACK (cb_rstto_main_window_quit), },
 /* Edit Menu */
   { "edit-menu", NULL, N_ ("_Edit"), NULL, },
@@ -885,12 +878,18 @@ rstto_main_window_image_list_iter_changed (RsttoMainWindow *window)
 
             app_list = g_app_info_get_all_for_type (content_type);
 
-            for (iter = app_list; iter; iter = g_list_next (iter))
+            if (NULL != app_list)
+            {
+		for (iter = app_list; iter; iter = g_list_next (iter))
+		{
+		    GtkWidget *menu_item = rstto_app_menu_item_new (iter->data, rstto_file_get_file (cur_file));
+		    gtk_menu_shell_append (GTK_MENU_SHELL (open_with_menu), menu_item);
+		    menu_item = rstto_app_menu_item_new (iter->data, rstto_file_get_file (cur_file));
+		    gtk_menu_shell_append (GTK_MENU_SHELL (open_with_window_menu), menu_item);
+		}
+            }
+            else
             {
-                GtkWidget *menu_item = rstto_app_menu_item_new (iter->data, rstto_file_get_file (cur_file));
-                gtk_menu_shell_append (GTK_MENU_SHELL (open_with_menu), menu_item);
-                menu_item = rstto_app_menu_item_new (iter->data, rstto_file_get_file (cur_file));
-                gtk_menu_shell_append (GTK_MENU_SHELL (open_with_window_menu), menu_item);
             }
 
             gtk_widget_show_all (open_with_menu);
@@ -968,7 +967,6 @@ rstto_main_window_update_buttons (RsttoMainWindow *window)
             */
             gtk_widget_set_sensitive ( gtk_ui_manager_get_widget ( window->priv->ui_manager, "/main-menu/file-menu/properties"), FALSE);
             gtk_widget_set_sensitive ( gtk_ui_manager_get_widget ( window->priv->ui_manager, "/main-menu/file-menu/close"), FALSE);
-            gtk_widget_set_sensitive ( gtk_ui_manager_get_widget ( window->priv->ui_manager, "/main-menu/file-menu/close-all"), FALSE);
             gtk_widget_set_sensitive ( gtk_ui_manager_get_widget ( window->priv->ui_manager, "/main-menu/edit-menu/delete"), FALSE);
 
             /* Go Menu */
@@ -1033,7 +1031,6 @@ rstto_main_window_update_buttons (RsttoMainWindow *window)
             */
             gtk_widget_set_sensitive ( gtk_ui_manager_get_widget ( window->priv->ui_manager, "/main-menu/file-menu/properties"), TRUE);
             gtk_widget_set_sensitive ( gtk_ui_manager_get_widget ( window->priv->ui_manager, "/main-menu/file-menu/close"), TRUE);
-            gtk_widget_set_sensitive ( gtk_ui_manager_get_widget ( window->priv->ui_manager, "/main-menu/file-menu/close-all"), FALSE);
             gtk_widget_set_sensitive ( gtk_ui_manager_get_widget ( window->priv->ui_manager, "/main-menu/edit-menu/delete"), TRUE);
 
             /* Go Menu */
@@ -1100,7 +1097,6 @@ rstto_main_window_update_buttons (RsttoMainWindow *window)
             */
             gtk_widget_set_sensitive ( gtk_ui_manager_get_widget ( window->priv->ui_manager, "/main-menu/file-menu/properties"), TRUE);
             gtk_widget_set_sensitive ( gtk_ui_manager_get_widget ( window->priv->ui_manager, "/main-menu/file-menu/close"), TRUE);
-            gtk_widget_set_sensitive ( gtk_ui_manager_get_widget ( window->priv->ui_manager, "/main-menu/file-menu/close-all"), TRUE);
             gtk_widget_set_sensitive ( gtk_ui_manager_get_widget ( window->priv->ui_manager, "/main-menu/edit-menu/delete"), TRUE);
 
             /* Go Menu */
@@ -1161,10 +1157,6 @@ rstto_main_window_update_buttons (RsttoMainWindow *window)
         gtk_widget_show (
             gtk_ui_manager_get_widget (
                     window->priv->ui_manager,
-                    "/navigation-toolbar/open-folder"));
-        gtk_widget_show (
-            gtk_ui_manager_get_widget (
-                    window->priv->ui_manager,
                     "/navigation-toolbar/save-copy"));
         gtk_widget_show (
             gtk_ui_manager_get_widget (
@@ -1186,10 +1178,20 @@ rstto_main_window_update_buttons (RsttoMainWindow *window)
                 window->priv->settings_manager,
                 "show-file-toolbar") )
         {
+            if ( GTK_WIDGET_VISIBLE (window) )
+            {
+                /* Do not make the widget visible when in
+                 * fullscreen mode.
+                 */
+                if ( 0 == gdk_window_get_state (GTK_WIDGET
+(window)->window) & GDK_WINDOW_STATE_FULLSCREEN )
+                {
             gtk_widget_show (
                 gtk_ui_manager_get_widget (
                         window->priv->ui_manager,
                         "/file-toolbar"));
+                }
+            }
         }
         if (FALSE == rstto_settings_get_boolean_property (
                 window->priv->settings_manager,
@@ -1209,10 +1211,6 @@ rstto_main_window_update_buttons (RsttoMainWindow *window)
         gtk_widget_hide (
             gtk_ui_manager_get_widget (
                     window->priv->ui_manager,
-                    "/navigation-toolbar/open-folder"));
-        gtk_widget_hide (
-            gtk_ui_manager_get_widget (
-                    window->priv->ui_manager,
                     "/navigation-toolbar/save-copy"));
         gtk_widget_hide (
             gtk_ui_manager_get_widget (
@@ -1562,7 +1560,13 @@ cb_rstto_main_window_state_event(GtkWidget *widget, GdkEventWindowState *event,
             gtk_widget_show (window->priv->statusbar);
 
             if (rstto_settings_get_boolean_property (RSTTO_SETTINGS (window->priv->settings_manager), "show-file-toolbar"))
-                gtk_widget_show (window->priv->toolbar);
+            {
+                if (FALSE == rstto_settings_get_boolean_property (RSTTO_SETTINGS
+(window->priv->settings_manager), "merge-toolbars"))
+                {
+                    gtk_widget_show (window->priv->toolbar);
+                }
+            }
 
             if (rstto_settings_get_boolean_property (RSTTO_SETTINGS (window->priv->settings_manager), "show-nav-toolbar"))
                 gtk_widget_show (window->priv->image_list_toolbar);
@@ -2140,10 +2144,17 @@ cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window)
     GtkWidget *dialog, *err_dialog;
     gint response;
     GFile *file;
+    GFile *p_file;
+    GFileEnumerator *file_enumarator = NULL;
     GSList *files = NULL, *_files_iter;
     GValue current_uri_val = {0, };
     gint pos = 0;
     GtkFileFilter *filter;
+    GFileInfo *file_info;
+    const gchar *filename;
+    const gchar *content_type;
+    GFile *child_file;
+    RsttoFile *rfile;
 
     g_value_init (&current_uri_val, G_TYPE_STRING);
     g_object_get_property (G_OBJECT(window->priv->settings_manager), "current-uri", &current_uri_val);
@@ -2210,29 +2221,30 @@ cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window)
         }
         else
         {
-
-            if (rstto_image_list_add_file (window->priv->props.image_list, files->data, NULL) == FALSE)
+            rfile = rstto_file_new (files->data);
+            g_object_ref (rfile);
+            if (rstto_image_list_add_file (window->priv->props.image_list, rfile, NULL) == TRUE )
             {
-                err_dialog = gtk_message_dialog_new(GTK_WINDOW(window),
-                                                GTK_DIALOG_MODAL,
-                                                GTK_MESSAGE_ERROR,
-                                                GTK_BUTTONS_OK,
-                                                _("Could not open file"));
-                gtk_dialog_run(GTK_DIALOG(dialog));
-                gtk_widget_destroy(dialog);
+                rstto_image_list_remove_all (window->priv->props.image_list);
+                rstto_image_list_add_file (window->priv->props.image_list, rfile, NULL);
             }
-            else
+            p_file = g_file_get_parent (files->data);
+            file_enumarator = g_file_enumerate_children (p_file, "standard::*", 0, NULL, NULL);
+            for(file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); file_info != NULL; file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
             {
-                /* Add a reference to the file, it is owned by the
-                 * sourcefunc and will be unref-ed by it.
-                 */
-                g_object_ref (files->data);
-                g_idle_add_full(G_PRIORITY_LOW, (GSourceFunc) rstto_main_window_add_file_to_recent_files, files->data, NULL);
+                filename = g_file_info_get_name (file_info);
+                content_type  = g_file_info_get_content_type (file_info);
+                child_file = g_file_get_child (p_file, filename);
+                if (strncmp (content_type, "image/", 6) == 0)
+                {
+                    rstto_image_list_add_file (window->priv->props.image_list, rstto_file_new (child_file), NULL);
+                }
             }
         }
-
-        if (pos == -1)
-            rstto_image_list_iter_set_position (window->priv->iter, 0);
+        rstto_image_list_iter_find_file (
+                window->priv->iter,
+                rfile );
+ 
         g_value_set_string (&current_uri_val, gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dialog)));
         g_object_set_property (G_OBJECT(window->priv->settings_manager), "current-uri", &current_uri_val);
 
@@ -2250,91 +2262,6 @@ cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window)
 }
 
 /**
- * cb_rstto_main_window_open_folder:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_open_folder (GtkWidget *widget, RsttoMainWindow *window)
-{
-    gint response;
-    GFile *file = NULL, *child_file = NULL;
-    GFileEnumerator *file_enumarator = NULL;
-    GFileInfo *file_info = NULL;
-    const gchar *filename = NULL;
-    const gchar *content_type = NULL;
-    gint pos = 0;
-    GtkWidget *dialog;
-    gchar *current_uri = rstto_settings_get_string_property (RSTTO_SETTINGS (window->priv->settings_manager), "current-uri");
-
-    dialog = gtk_file_chooser_dialog_new(_("Open folder"),
-                                                    GTK_WINDOW(window),
-                                                    GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
-                                                    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                                    GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
-                                                    NULL);
-
-    if (current_uri)
-    {
-        gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog), current_uri);
-        g_free (current_uri);
-        current_uri = NULL;
-    }
-
-    response = gtk_dialog_run(GTK_DIALOG(dialog));
-    if(response == GTK_RESPONSE_ACCEPT)
-    {
-        gtk_widget_hide(dialog);
-        file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
-
-        file_enumarator = g_file_enumerate_children (file, "standard::*", 0, NULL, NULL);
-        pos = rstto_image_list_iter_get_position (window->priv->iter);
-        for(file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); file_info != NULL; file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
-        {
-            filename = g_file_info_get_name (file_info);
-            content_type  = g_file_info_get_content_type (file_info);
-            child_file = g_file_get_child (file, filename);
-
-            if (strncmp (content_type, "image/", 6) == 0)
-            {
-                rstto_image_list_add_file (window->priv->props.image_list,rstto_file_new(child_file), NULL);
-            }
-
-            g_object_unref (child_file);
-            g_object_unref (file_info);
-        }
-
-        if (-1 == pos)
-        {
-            rstto_image_list_iter_set_position (window->priv->iter, 0);
-        }
-
-        /* Add a reference to the file, it is owned by the
-         * sourcefunc and will be unref-ed by it.
-         */
-        g_object_ref (file);
-        g_idle_add_full(G_PRIORITY_LOW, (GSourceFunc) rstto_main_window_add_file_to_recent_files,
-        file, NULL);
-
-        rstto_settings_set_string_property (RSTTO_SETTINGS (window->priv->settings_manager),
-                                            "current-uri",
-                                            gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dialog)));
-    }
-
-    gtk_widget_destroy(dialog);
-
-    rstto_main_window_update_buttons (window);
-    rstto_main_window_image_list_iter_changed (window);
-
-    if (file)
-    {
-        g_object_unref (file);
-    }
-}
-
-/**
  * cb_rstto_main_window_open_recent:
  * @chooser:
  * @window:
@@ -2349,56 +2276,37 @@ cb_rstto_main_window_open_recent(GtkRecentChooser *chooser, RsttoMainWindow *win
     const gchar *content_type = NULL;
     GError *error = NULL;
     GFile *file = g_file_new_for_uri (uri);
-    GFile *child_file;
+    GFile *child_file, *p_file;
     GFileEnumerator *file_enumarator = NULL;
     GFileInfo *child_file_info = NULL;
     GFileInfo *file_info = g_file_query_info (file, "standard::type", 0, NULL, &error);
     gint pos = 0;
+    RsttoFile *rfile;
 
     if (error == NULL)
     {
-        if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
-        {
-            pos = rstto_image_list_iter_get_position(window->priv->iter);
-            file_enumarator = g_file_enumerate_children (file, "standard::*", 0, NULL, NULL);
-            for(child_file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); child_file_info != NULL; child_file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
-            {
-                filename = g_file_info_get_name (child_file_info);
-                content_type  = g_file_info_get_content_type (child_file_info);
-                child_file = g_file_get_child (file, filename);
-
-                if (strncmp (content_type, "image/", 6) == 0)
-                {
-                    rstto_image_list_add_file (window->priv->props.image_list, rstto_file_new(child_file), NULL);
-                }
-
-                g_object_unref (child_file);
-                g_object_unref (child_file_info);
-            }
-
-            if (-1 == pos)
-            {
-                rstto_image_list_iter_set_position (window->priv->iter, 0);
-            }
-
-            rstto_main_window_image_list_iter_changed (window);
-        }
-        else
-        {
-            if (rstto_image_list_add_file (window->priv->props.image_list, rstto_file_new(file), NULL) == FALSE)
-            {
-                err_dialog = gtk_message_dialog_new(GTK_WINDOW(window),
-                                                GTK_DIALOG_MODAL,
-                                                GTK_MESSAGE_ERROR,
-                                                GTK_BUTTONS_OK,
-                                                _("Could not open file"));
-                gtk_dialog_run( GTK_DIALOG(err_dialog));
-                gtk_widget_destroy(err_dialog);
-            }
-            else
-            {
-            }
-        }
+	rfile = rstto_file_new (file);
+	g_object_ref (rfile);
+	if (rstto_image_list_add_file (window->priv->props.image_list, rfile, NULL) == TRUE )
+	{
+	    rstto_image_list_remove_all (window->priv->props.image_list);
+	    rstto_image_list_add_file (window->priv->props.image_list, rfile, NULL);
+	}
+	p_file = g_file_get_parent (file);
+	file_enumarator = g_file_enumerate_children (p_file, "standard::*", 0, NULL, NULL);
+	for(file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); file_info != NULL; file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
+	{
+	    filename = g_file_info_get_name (file_info);
+	    content_type  = g_file_info_get_content_type (file_info);
+	    child_file = g_file_get_child (p_file, filename);
+	    if (strncmp (content_type, "image/", 6) == 0)
+	    {
+		rstto_image_list_add_file (window->priv->props.image_list, rstto_file_new (child_file), NULL);
+	    }
+	}
+        rstto_image_list_iter_find_file (
+                window->priv->iter,
+                rfile );
     }
     else
     {
@@ -2521,23 +2429,6 @@ cb_rstto_main_window_properties (GtkWidget *widget, RsttoMainWindow *window)
 static void
 cb_rstto_main_window_close (GtkWidget *widget, RsttoMainWindow *window)
 {
-    RsttoFile *file = rstto_image_list_iter_get_file (window->priv->iter);
-    rstto_image_list_remove_file (window->priv->props.image_list, file);
-
-    rstto_main_window_update_buttons (window);
-    rstto_main_window_image_list_iter_changed (window);
-}
-
-/**
- * cb_rstto_main_window_close_all:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_close_all (GtkWidget *widget, RsttoMainWindow *window)
-{
     rstto_image_list_remove_all (window->priv->props.image_list);
     rstto_main_window_image_list_iter_changed (window);
 
@@ -2545,7 +2436,6 @@ cb_rstto_main_window_close_all (GtkWidget *widget, RsttoMainWindow *window)
     rstto_main_window_image_list_iter_changed (window);
 }
 
-
 /**
  * cb_rstto_main_window_delete:
  * @widget:
diff --git a/src/main_window_ui.xml b/src/main_window_ui.xml
index ae50fa1..7e3af01 100644
--- a/src/main_window_ui.xml
+++ b/src/main_window_ui.xml
@@ -6,7 +6,6 @@
     <menubar name="main-menu">
         <menu action="file-menu">
             <menuitem action="open"/>
-            <menuitem action="open-folder"/>
             <placeholder name="placeholder-open-recent"/>
             <separator/>
             <menuitem action="save-copy"/>
@@ -17,7 +16,6 @@
             <separator/>
             <menuitem action="properties"/>
             <menuitem action="close"/>
-            <menuitem action="close-all"/>
             <menuitem action="quit"/>
         </menu>
         <menu action="edit-menu">
@@ -92,7 +90,6 @@
 
     <popup name="image-viewer-menu">
         <menuitem action="open"/>
-        <menuitem action="open-folder"/>
         <menuitem action="properties"/>
         <menuitem action="close"/>
         <separator/>
@@ -111,7 +108,6 @@
     -->
     <toolbar name="file-toolbar">
         <toolitem action="open"/>
-        <toolitem action="open-folder"/>
         <separator />
         <toolitem action="save-copy"/>
         <toolitem action="close"/>
@@ -124,7 +120,6 @@
     -->
     <toolbar name="navigation-toolbar">
         <toolitem action="open"/>
-        <toolitem action="open-folder"/>
         <separator />
         <toolitem action="save-copy"/>
         <toolitem action="close"/>
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index 9df5ffd..6de4c5e 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -55,11 +55,6 @@ static void
 cb_rstto_preferences_dialog_hide_thumbnails_fullscreen_check_button_toggled (
                                                         GtkToggleButton *button, 
                                                         gpointer user_data);
-
-static void
-cb_open_entire_folder_check_button_toggled (
-        GtkToggleButton *button, 
-        gpointer user_data);
 static void
 cb_wrap_images_check_button_toggled (
         GtkToggleButton *button, 
@@ -155,7 +150,6 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
     guint uint_slideshow_timeout;
     gboolean bool_hide_thumbnailbar_fullscreen;
     gboolean bool_show_preview;
-    gboolean bool_open_entire_folder;
     gboolean bool_wrap_images;
     gboolean bool_maximize_on_startup;
     gboolean bool_merge_toolbars;
@@ -185,7 +179,6 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
                   "bgcolor", &bgcolor,
                   "slideshow-timeout", &uint_slideshow_timeout,
                   "hide-thumbnailbar-fullscreen", &bool_hide_thumbnailbar_fullscreen,
-                  "open-entire-folder", &bool_open_entire_folder,
                   "maximize-on-startup", &bool_maximize_on_startup,
                   "wrap-images", &bool_wrap_images,
                   "merge-toolbars", &bool_merge_toolbars,
@@ -325,23 +318,12 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
             GTK_TOGGLE_BUTTON (dialog->priv->behaviour_tab.maximize_window_on_startup_check_button),
             bool_maximize_on_startup);
 
-    dialog->priv->behaviour_tab.open_entire_folder_check_button = gtk_check_button_new_with_label (_("Open entire folder on startup"));
-    gtk_container_add (GTK_CONTAINER (dialog->priv->behaviour_tab.startup_vbox), dialog->priv->behaviour_tab.open_entire_folder_check_button);
-    gtk_toggle_button_set_active (
-            GTK_TOGGLE_BUTTON (dialog->priv->behaviour_tab.open_entire_folder_check_button),
-            bool_open_entire_folder);
-
     dialog->priv->behaviour_tab.wrap_images_check_button = gtk_check_button_new_with_label (_("Wrap around images"));
     gtk_container_add (GTK_CONTAINER (dialog->priv->behaviour_tab.startup_vbox), dialog->priv->behaviour_tab.wrap_images_check_button);
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->behaviour_tab.wrap_images_check_button),
                                   bool_wrap_images);
 
     g_signal_connect (
-            G_OBJECT (dialog->priv->behaviour_tab.open_entire_folder_check_button), 
-            "toggled",
-            (GCallback)cb_open_entire_folder_check_button_toggled,
-            dialog);
-    g_signal_connect (
             G_OBJECT (dialog->priv->behaviour_tab.wrap_images_check_button), 
             "toggled",
             (GCallback)cb_wrap_images_check_button_toggled,
@@ -479,18 +461,6 @@ cb_rstto_preferences_dialog_hide_thumbnails_fullscreen_check_button_toggled (
 }
 
 static void
-cb_open_entire_folder_check_button_toggled (GtkToggleButton *button, 
-                                                      gpointer user_data)
-{
-    RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG (user_data);
-
-    rstto_settings_set_boolean_property (
-            dialog->priv->settings,
-            "open-entire-folder",
-            gtk_toggle_button_get_active(button));
-}
-
-static void
 cb_wrap_images_check_button_toggled (GtkToggleButton *button, 
                                                       gpointer user_data)
 {
diff --git a/src/properties_dialog.c b/src/properties_dialog.c
index cb03cba..8a7c362 100644
--- a/src/properties_dialog.c
+++ b/src/properties_dialog.c
@@ -18,6 +18,9 @@
 
 #include <config.h>
 #include <gtk/gtk.h>
+
+#include <libexif/exif-data.h>
+
 #include <libxfce4ui/libxfce4ui.h>
 #include <libxfce4util/libxfce4util.h>
 
diff --git a/src/settings.c b/src/settings.c
index 05ae3f4..2574f8c 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -69,7 +69,6 @@ enum
     PROP_SLIDESHOW_TIMEOUT,
     PROP_SCROLLWHEEL_PRIMARY_ACTION,
     PROP_SCROLLWHEEL_SECONDARY_ACTION,
-    PROP_OPEN_ENTIRE_FOLDER,
     PROP_WRAP_IMAGES,
     PROP_THUMBNAILBAR_SIZE,
     PROP_DESKTOP_TYPE,
@@ -171,8 +170,6 @@ rstto_settings_init (GObject *object)
     xfconf_g_property_bind (settings->priv->channel, "/window/height", G_TYPE_UINT, settings, "window-height");
 
     xfconf_g_property_bind (settings->priv->channel, "/file/current-uri", G_TYPE_STRING, settings, "current-uri");
-    xfconf_g_property_bind (settings->priv->channel, "/file/open-entire-folder", G_TYPE_BOOLEAN, settings, "open-entire-folder");
-
     xfconf_g_property_bind (settings->priv->channel, "/window/show-file-toolbar", G_TYPE_BOOLEAN, settings, "show-file-toolbar");
     xfconf_g_property_bind (settings->priv->channel, "/window/show-navigation-toolbar", G_TYPE_BOOLEAN, settings, "show-nav-toolbar");
     xfconf_g_property_bind (settings->priv->channel, "/window/show-thumbnailbar", G_TYPE_BOOLEAN, settings, "show-thumbnailbar");
@@ -281,15 +278,6 @@ rstto_settings_class_init (GObjectClass *object_class)
                                      PROP_HIDE_THUMBNAILBAR_FULLSCREEN,
                                      pspec);
 
-    pspec = g_param_spec_boolean ("open-entire-folder",
-                                  "",
-                                  "",
-                                  TRUE,
-                                  G_PARAM_READWRITE);
-    g_object_class_install_property (object_class,
-                                     PROP_OPEN_ENTIRE_FOLDER,
-                                     pspec);
-
     pspec = g_param_spec_string  ("navigationbar-position",
                                   "",
                                   "",
@@ -533,9 +521,6 @@ rstto_settings_set_property    (GObject      *object,
         case PROP_HIDE_THUMBNAILBAR_FULLSCREEN:
             settings->priv->hide_thumbnailbar_fullscreen = g_value_get_boolean (value);
             break;
-        case PROP_OPEN_ENTIRE_FOLDER:
-            settings->priv->open_entire_folder= g_value_get_boolean (value);
-            break;
         case PROP_NAVBAR_POSITION:
             str_val = g_value_get_string (value);
 
@@ -642,9 +627,6 @@ rstto_settings_get_property    (GObject    *object,
         case PROP_HIDE_THUMBNAILBAR_FULLSCREEN:
             g_value_set_boolean (value, settings->priv->hide_thumbnailbar_fullscreen);
             break;
-        case PROP_OPEN_ENTIRE_FOLDER:
-            g_value_set_boolean (value, settings->priv->open_entire_folder);
-            break;
         case PROP_NAVBAR_POSITION:
             g_value_set_string (value, settings->priv->navigationbar_position);
             break;
diff --git a/src/thumbnailer.c b/src/thumbnailer.c
index 0ff0022..c0f723d 100644
--- a/src/thumbnailer.c
+++ b/src/thumbnailer.c
@@ -25,6 +25,8 @@
 #include <gio/gio.h>
 #include <dbus/dbus-glib.h>
 
+#include <libexif/exif-data.h>
+
 #include "file.h"
 #include "thumbnail.h"
 #include "thumbnailer.h"
diff --git a/src/wallpaper_manager.c b/src/wallpaper_manager.c
index a79ca60..78e48c1 100644
--- a/src/wallpaper_manager.c
+++ b/src/wallpaper_manager.c
@@ -24,6 +24,8 @@
 #include <gtk/gtk.h>
 #include <gio/gio.h>
 
+#include <libexif/exif-data.h>
+
 #include "file.h"
 #include "wallpaper_manager.h"
 
diff --git a/src/xfce_wallpaper_manager.c b/src/xfce_wallpaper_manager.c
index 3722b81..a166046 100644
--- a/src/xfce_wallpaper_manager.c
+++ b/src/xfce_wallpaper_manager.c
@@ -26,6 +26,8 @@
 #include <libxfce4util/libxfce4util.h>
 #include <gio/gio.h>
 
+#include <libexif/exif-data.h>
+
 #include "file.h"
 #include "monitor_chooser.h"
 #include "wallpaper_manager.h"


More information about the Xfce4-commits mailing list