[Xfce4-commits] <tumbler:jannis/specialized> Squashme: More changes.

Jannis Pohlmann noreply at xfce.org
Mon Oct 26 01:34:05 CET 2009


Updating branch refs/heads/jannis/specialized
         to 17eccbf92dac484e8d13ee6ea3d9c5cbbfbb5cca (commit)
       from f1bdcd456e81d1a2e6e95b652fd502ebd9b4a38c (commit)

commit 17eccbf92dac484e8d13ee6ea3d9c5cbbfbb5cca
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Sun Oct 25 19:26:40 2009 +0100

    Squashme: More changes.

 tumblerd/tumbler-manager.c |   60 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/tumblerd/tumbler-manager.c b/tumblerd/tumbler-manager.c
index a43d1ea..24759fa 100644
--- a/tumblerd/tumbler-manager.c
+++ b/tumblerd/tumbler-manager.c
@@ -108,6 +108,7 @@ struct _OverrideInfo
 
 struct _ThumbnailerInfo
 {
+  gchar *filename;
   gchar *name;
   gchar **uri_schemes;
   gchar **mime_types;
@@ -476,6 +477,7 @@ thumbnailer_info_free (ThumbnailerInfo *info)
   if (info == NULL)
     return;
 
+  g_free (info->filename);
   g_free (info->name);
   g_strfreev (info->uri_schemes);
   g_strfreev (info->mime_types);
@@ -625,6 +627,7 @@ tumbler_manager_load_thumbnailer_infos (TumblerManager *manager,
         }
 
       info = thumbnailer_info_new ();
+      info->filename = filename;
       info->name = name;
       info->mtime = stat.st_mtime;
       info->uri_schemes = uri_schemes;
@@ -776,7 +779,40 @@ tumbler_manager_directory_changed (TumblerManager   *manager,
         }
       else if (g_str_has_suffix (basename, ".service"))
         {
-          g_debug ("service file %s changed", g_file_get_path (file));
+          if (event_type == G_FILE_MONITOR_EVENT_DELETED)
+            {
+              g_debug ("service file %s deleted", g_file_get_path (file));
+
+              /* TODO
+               * 1. lookup the ThumbnailerInfo for this file
+               * 2. if the ThumbnailerInfo is active
+               *    i)  remove its thumbnailer from the registry
+               *    ii) destroy the ThumbnailerInfo
+               */
+
+              /* ALL THIS IS WRONG */
+            }
+          else if (event_type == G_FILE_MONITOR_EVENT_CREATED)
+            {
+              g_debug ("service file %s created", g_file_get_path (file));
+
+              /* TODO
+               * 1. parse the file into a ThumbnailerInfo 
+               * 2. add the ThumbnailerInfo to the correct GPtrArray
+               * 3. sort the GPtrArray
+               * 4. if the new ThumbnailerInfo is first in this array and
+               *    is not overridden:
+               *    i)   remove the previous active thumbnailer with this name
+               *         from the registry
+               *    ii)  unref the previous active thumbnailer and set the
+               *         object member of the corresponding ThumbnailerInfo to NULL
+               *    iii) create the thumbnailer for the new ThumbnailerInfo
+               *    iv)  add the new thumbnailer to the registry
+               *    v)   update the registry's supported cache
+               */
+
+              /* ALL THIS IS WRONG */
+            }
         }
     }
   else if (type == G_FILE_TYPE_DIRECTORY)
@@ -786,9 +822,27 @@ tumbler_manager_directory_changed (TumblerManager   *manager,
       if (iter != NULL)
         {
           dir_index = g_list_position (manager->directories, iter);
-          g_debug ("dir at index %i changed", dir_index);
 
-          /* TODO remove overrides and thumbnailers for this dir_index */
+          if (event_type == G_FILE_MONITOR_EVENT_DELETED)
+            {
+              g_debug ("dir %s at index %i deleted", g_file_get_path (file), dir_index);
+
+              /* TODO remove overrides and thumbnailers for this dir_index */
+            }
+          else if (event_type == G_FILE_MONITOR_EVENT_CREATED)
+            {
+              g_debug ("dir %s at index %i deleted", g_file_get_path (file), dir_index);
+
+              tumbler_manager_update_overrides (manager);
+
+              /* TODO load thumbnailers from iter->data */
+            }
+          else if (event_type == G_FILE_MONITOR_CHANGED)
+            {
+              g_debug ("dir %s at index %i changed", g_file_get_path (file), dir_index);
+
+              /* TODO What to do? */
+            }
         }
     }
 }



More information about the Xfce4-commits mailing list