Author: benny
Date: 2006-08-06 19:24:04 +0000 (Sun, 06 Aug 2006)
New Revision: 22676

Modified:
   thunar/trunk/ChangeLog
   thunar/trunk/thunar-vfs/thunar-vfs-io-local.c
   thunar/trunk/thunar-vfs/thunar-vfs-mime-application.c
   thunar/trunk/thunar-vfs/thunar-vfs-mime-cleaner.c
   thunar/trunk/thunar-vfs/thunar-vfs-mime-handler.c
   thunar/trunk/thunar-vfs/thunar-vfs-thumb.c
   thunar/trunk/thunar/thunar-dialogs.c
   thunar/trunk/thunar/thunar-icon-factory.c
   thunar/trunk/thunar/thunar-launcher.c
   thunar/trunk/thunar/thunar-path-entry.c
   thunar/trunk/thunar/thunar-standard-view.c
Log:
2006-08-06      Benedikt Meurer <[EMAIL PROTECTED]>

        * thunar-vfs/thunar-vfs-thumb.c
          (thunar_vfs_thumb_factory_lookup_thumbnail): Fix an invalid return
          value.
        * thunar-vfs/thunar-vfs-thumb.c
          (thunar_vfs_thumb_factory_generate_thumbnail),
          thunar/thunar-icon-factory.c(thunar_icon_factory_load_file_icon):
          Add support for generating and loading thumbnails for files in the
          trash.
        * thunar-vfs/thunar-vfs-info.c(_thunar_vfs_io_local_rename),
          thunar-vfs/thunar-vfs-mime-application.c
          (thunar_vfs_mime_application_new_from_file),
          thunar-vfs/thunar-vfs-mime-cleaner.c(main),
          thunar-vfs/thunar-vfs-mime-handler.c
          (thunar_vfs_mime_handler_set_icon),
          thunar/thunar-dialogs.c(thunar_dialogs_show_job_error),
          thunar/thunar-launcher.c,
          thunar/thunar-path-entry.c(thunar_path_entry_check_completion_idle):
          Use strncmp() instead of g_str_has_prefix() where it makes sense. Try
          to avoid g_str_has_suffix() if checking only for a single character.
        * thunar/thunar-standard-view.c(thunar_standard_view_drag_motion):
          Deny XdndDirectSave0 and _NETSCAPE_URL drops to locations in the
          trash.




Modified: thunar/trunk/ChangeLog
===================================================================
--- thunar/trunk/ChangeLog      2006-08-06 18:57:32 UTC (rev 22675)
+++ thunar/trunk/ChangeLog      2006-08-06 19:24:04 UTC (rev 22676)
@@ -1,3 +1,28 @@
+2006-08-06     Benedikt Meurer <[EMAIL PROTECTED]>
+
+       * thunar-vfs/thunar-vfs-thumb.c
+         (thunar_vfs_thumb_factory_lookup_thumbnail): Fix an invalid return
+         value.
+       * thunar-vfs/thunar-vfs-thumb.c
+         (thunar_vfs_thumb_factory_generate_thumbnail),
+         thunar/thunar-icon-factory.c(thunar_icon_factory_load_file_icon):
+         Add support for generating and loading thumbnails for files in the
+         trash.
+       * thunar-vfs/thunar-vfs-info.c(_thunar_vfs_io_local_rename),
+         thunar-vfs/thunar-vfs-mime-application.c
+         (thunar_vfs_mime_application_new_from_file),
+         thunar-vfs/thunar-vfs-mime-cleaner.c(main),
+         thunar-vfs/thunar-vfs-mime-handler.c
+         (thunar_vfs_mime_handler_set_icon),
+         thunar/thunar-dialogs.c(thunar_dialogs_show_job_error),
+         thunar/thunar-launcher.c,
+         thunar/thunar-path-entry.c(thunar_path_entry_check_completion_idle):
+         Use strncmp() instead of g_str_has_prefix() where it makes sense. Try
+         to avoid g_str_has_suffix() if checking only for a single character.
+       * thunar/thunar-standard-view.c(thunar_standard_view_drag_motion):
+         Deny XdndDirectSave0 and _NETSCAPE_URL drops to locations in the
+         trash.
+
 2006-08-05     Benedikt Meurer <[EMAIL PROTECTED]>
 
        * thunar/thunar-application.c(thunar_application_unlink_files): Unlink

Modified: thunar/trunk/thunar/thunar-dialogs.c
===================================================================
--- thunar/trunk/thunar/thunar-dialogs.c        2006-08-06 18:57:32 UTC (rev 
22675)
+++ thunar/trunk/thunar/thunar-dialogs.c        2006-08-06 19:24:04 UTC (rev 
22676)
@@ -394,7 +394,7 @@
 
   /* try to separate the message into primary and secondary parts */
   separator = strstr (error->message, ": ");
-  if (G_LIKELY (separator != NULL))
+  if (G_LIKELY (separator > error->message))
     {
       /* primary is everything before the colon, plus a dot */
       g_string_append_len (primary, error->message, separator - 
error->message);
@@ -405,7 +405,7 @@
         ++separator;
       while (g_ascii_isspace (*separator));
       g_string_append (secondary, separator);
-      if (!g_str_has_suffix (separator, "."))
+      if (separator[strlen (separator - 1)] != '.')
         g_string_append_c (secondary, '.');
     }
   else

Modified: thunar/trunk/thunar/thunar-icon-factory.c
===================================================================
--- thunar/trunk/thunar/thunar-icon-factory.c   2006-08-06 18:57:32 UTC (rev 
22675)
+++ thunar/trunk/thunar/thunar-icon-factory.c   2006-08-06 19:24:04 UTC (rev 
22676)
@@ -867,7 +867,7 @@
     }
 
   /* check if thumbnails are enabled and we can display a thumbnail for the 
item */
-  if (G_LIKELY (factory->show_thumbnails && thunar_file_is_regular (file) && 
!thunar_file_is_trashed (file)))
+  if (G_LIKELY (factory->show_thumbnails && thunar_file_is_regular (file)))
     {
       /* determine the thumbnail state */
       thumb_state = thunar_file_get_thumb_state (file);

Modified: thunar/trunk/thunar/thunar-launcher.c
===================================================================
--- thunar/trunk/thunar/thunar-launcher.c       2006-08-06 18:57:32 UTC (rev 
22675)
+++ thunar/trunk/thunar/thunar-launcher.c       2006-08-06 19:24:04 UTC (rev 
22676)
@@ -21,6 +21,13 @@
 #include <config.h>
 #endif
 
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
 #include <thunar/thunar-application.h>
 #include <thunar/thunar-chooser-dialog.h>
 #include <thunar/thunar-dialogs.h>
@@ -799,7 +806,7 @@
       /* drop all previous addon actions from the action group */
       actions = gtk_action_group_list_actions (launcher->action_group);
       for (lp = actions; lp != NULL; lp = lp->next)
-        if (g_str_has_prefix (gtk_action_get_name (lp->data), 
"thunar-launcher-addon-"))
+        if (strncmp (gtk_action_get_name (lp->data), "thunar-launcher-addon-", 
22) == 0)
           gtk_action_group_remove_action (launcher->action_group, lp->data);
       g_list_free (actions);
 
@@ -1214,7 +1221,7 @@
       /* drop all previous sendto actions from the action group */
       handlers = gtk_action_group_list_actions (launcher->action_group);
       for (lp = handlers; lp != NULL; lp = lp->next)
-        if (g_str_has_prefix (gtk_action_get_name (lp->data), 
"thunar-launcher-sendto"))
+        if (strncmp (gtk_action_get_name (lp->data), "thunar-launcher-sendto", 
22) == 0)
           gtk_action_group_remove_action (launcher->action_group, lp->data);
       g_list_free (handlers);
 

Modified: thunar/trunk/thunar/thunar-path-entry.c
===================================================================
--- thunar/trunk/thunar/thunar-path-entry.c     2006-08-06 18:57:32 UTC (rev 
22675)
+++ thunar/trunk/thunar/thunar-path-entry.c     2006-08-06 19:24:04 UTC (rev 
22676)
@@ -1313,7 +1313,7 @@
 
   /* check if the user entered atleast part of a filename */
   text = gtk_entry_get_text (GTK_ENTRY (path_entry));
-  if (*text != '\0' && !g_str_has_suffix (text, "/"))
+  if (*text != '\0' && text[strlen (text) - 1] != '/')
     {
       /* automatically insert the common prefix */
       thunar_path_entry_common_prefix_append (path_entry, TRUE);

Modified: thunar/trunk/thunar/thunar-standard-view.c
===================================================================
--- thunar/trunk/thunar/thunar-standard-view.c  2006-08-06 18:57:32 UTC (rev 
22675)
+++ thunar/trunk/thunar/thunar-standard-view.c  2006-08-06 19:24:04 UTC (rev 
22676)
@@ -2817,7 +2817,7 @@
           file = thunar_standard_view_get_drop_file (standard_view, x, y, 
&path);
 
           /* check if we can save here */
-          if (G_LIKELY (file != NULL && thunar_file_is_directory (file) && 
thunar_file_is_writable (file)))
+          if (G_LIKELY (file != NULL && thunar_file_is_local (file) && 
thunar_file_is_directory (file) && thunar_file_is_writable (file)))
             action = context->suggested_action;
 
           /* reset path if we cannot drop */

Modified: thunar/trunk/thunar-vfs/thunar-vfs-io-local.c
===================================================================
--- thunar/trunk/thunar-vfs/thunar-vfs-io-local.c       2006-08-06 18:57:32 UTC 
(rev 22675)
+++ thunar/trunk/thunar-vfs/thunar-vfs-io-local.c       2006-08-06 19:24:04 UTC 
(rev 22676)
@@ -959,7 +959,7 @@
       info->display_name = g_strdup (name);
 
       /* check if this is a hidden file now */
-      if (strlen (name) > 1 && (g_str_has_prefix (name, ".") || 
g_str_has_prefix (name, "~")))
+      if (strlen (name) > 1 && (name[0] == '.' || name[strlen (name) - 1] == 
'~'))
         info->flags |= THUNAR_VFS_FILE_FLAGS_HIDDEN;
       else
         info->flags &= ~THUNAR_VFS_FILE_FLAGS_HIDDEN;

Modified: thunar/trunk/thunar-vfs/thunar-vfs-mime-application.c
===================================================================
--- thunar/trunk/thunar-vfs/thunar-vfs-mime-application.c       2006-08-06 
18:57:32 UTC (rev 22675)
+++ thunar/trunk/thunar-vfs/thunar-vfs-mime-application.c       2006-08-06 
19:24:04 UTC (rev 22676)
@@ -281,7 +281,7 @@
           for (ms = mt = application->mime_types; *ms != NULL; ++ms)
             {
               /* ignore empty entries, GNOME pseudo mime types and KDE junk */
-              if (**ms == '\0' || g_str_equal (*ms, 
"x-directory/gnome-default-handler") || g_str_has_prefix (*ms, "print/"))
+              if (**ms == '\0' || g_str_equal (*ms, 
"x-directory/gnome-default-handler") || strncmp (*ms, "print/", 6) == 0)
                 g_free (*ms);
               else
                 *mt++ = *ms;

Modified: thunar/trunk/thunar-vfs/thunar-vfs-mime-cleaner.c
===================================================================
--- thunar/trunk/thunar-vfs/thunar-vfs-mime-cleaner.c   2006-08-06 18:57:32 UTC 
(rev 22675)
+++ thunar/trunk/thunar-vfs/thunar-vfs-mime-cleaner.c   2006-08-06 19:24:04 UTC 
(rev 22676)
@@ -410,7 +410,7 @@
               mt2 = xfce_rc_read_entry_untranslated (rc, "MimeType", NULL);
 
               /* combine the MimeTypes to a single list */
-              if (G_LIKELY (mt1 != NULL && g_str_has_suffix (mt1, ";")))
+              if (G_LIKELY (mt1 != NULL && mt1[strlen (mt1) - 1] == ';'))
                 mt = g_strconcat (mt1, mt2, NULL);
               else if (G_LIKELY (mt1 != NULL))
                 mt = g_strconcat (mt1, ";", mt2, NULL);

Modified: thunar/trunk/thunar-vfs/thunar-vfs-mime-handler.c
===================================================================
--- thunar/trunk/thunar-vfs/thunar-vfs-mime-handler.c   2006-08-06 18:57:32 UTC 
(rev 22675)
+++ thunar/trunk/thunar-vfs/thunar-vfs-mime-handler.c   2006-08-06 19:24:04 UTC 
(rev 22676)
@@ -362,6 +362,8 @@
 thunar_vfs_mime_handler_set_icon (ThunarVfsMimeHandler *mime_handler,
                                   const gchar          *icon)
 {
+  gint icon_len;
+
   /* release the previous icon */
   g_free (mime_handler->icon);
 
@@ -369,8 +371,13 @@
   mime_handler->icon = g_strdup (icon);
 
   /* strip off known suffixes for image files if a themed icon is specified */
-  if (mime_handler->icon != NULL && !g_path_is_absolute (mime_handler->icon) 
&& g_str_has_suffix (mime_handler->icon, ".png"))
-    mime_handler->icon[strlen (mime_handler->icon) - 4] = '\0';
+  if (mime_handler->icon != NULL && !g_path_is_absolute (mime_handler->icon))
+    {
+      /* check if the icon name ends in .png */
+      icon_len = strlen (mime_handler->icon);
+      if (G_LIKELY (icon_len > 4) && strcmp (mime_handler->icon + (icon_len - 
4), ".png") == 0)
+        mime_handler->icon[icon_len - 4] = '\0';
+    }
 }
 
 

Modified: thunar/trunk/thunar-vfs/thunar-vfs-thumb.c
===================================================================
--- thunar/trunk/thunar-vfs/thunar-vfs-thumb.c  2006-08-06 18:57:32 UTC (rev 
22675)
+++ thunar/trunk/thunar-vfs/thunar-vfs-thumb.c  2006-08-06 19:24:04 UTC (rev 
22676)
@@ -53,6 +53,7 @@
 
 #include <thunar-vfs/thunar-vfs-enum-types.h>
 #include <thunar-vfs/thunar-vfs-mime-database.h>
+#include <thunar-vfs/thunar-vfs-path-private.h>
 #include <thunar-vfs/thunar-vfs-private.h>
 #include <thunar-vfs/thunar-vfs-thumb-jpeg.h>
 #include <thunar-vfs/thunar-vfs-thumb-pixbuf.h>
@@ -412,21 +413,21 @@
   g_return_val_if_fail (info != NULL, NULL);
 
   /* determine the URI for the path */
-  if (thunar_vfs_path_to_uri (info->path, uri, sizeof (uri), NULL) < 0)
-    return FALSE;
+  if (thunar_vfs_path_to_uri (info->path, uri, sizeof (uri), NULL) >= 0)
+    {
+      /* determine the path to the thumbnail for the factory */
+      md5 = exo_str_get_md5_str (uri);
+      path = g_strconcat (factory->base_path, md5, ".png", NULL);
+      g_free (md5);
 
-  /* determine the path to the thumbnail for the factory */
-  md5 = exo_str_get_md5_str (uri);
-  path = g_strconcat (factory->base_path, md5, ".png", NULL);
-  g_free (md5);
+      /* check if the path contains a valid thumbnail */
+      if (thunar_vfs_thumbnail_is_valid (path, uri, info->mtime))
+        return path;
 
-  /* check if the path contains a valid thumbnail */
-  if (thunar_vfs_thumbnail_is_valid (path, uri, info->mtime))
-    return path;
+      /* no valid thumbnail in the global repository */
+      g_free (path);
+    }
 
-  /* no valid thumbnail in the global repository */
-  g_free (path);
-
   return NULL;
 }
 
@@ -659,8 +660,10 @@
   /* determine the pixel size of the thumbnail */
   size = G_LIKELY (factory->size == THUNAR_VFS_THUMB_SIZE_NORMAL) ? 128 : 256;
 
-  /* determine the absolute path to the file */
-  path = thunar_vfs_path_dup_string (info->path);
+  /* determine the absolute local path to the file */
+  path = _thunar_vfs_path_translate_dup_string (info->path, 
THUNAR_VFS_PATH_SCHEME_FILE, NULL);
+  if (G_UNLIKELY (path == NULL))
+    return NULL;
 
 #ifdef HAVE_GCONF
   /* check if we have a GNOME thumbnailer for the given mime info */

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to