Git Repositories

2005-09-11 Benedikt Meurer <benny@xfce.org>
authorBenedikt Meurer <benny@xfce.org>
Sun, 11 Sep 2005 22:48:19 +0000 (22:48 +0000)
committerBenedikt Meurer <benny@xfce.org>
Sun, 11 Sep 2005 22:48:19 +0000 (22:48 +0000)
* thunar/thunar-standard-view.c: Sort the extension actions by their
  names instead of their labels.
* thunar/thunar-extension-manager.c(thunar_extension_class_init):
  Properly initialize the parent class reference.
* examples/open-terminal-here/Makefile.am: Don't specify CLEANFILES
  explicitly.
* thunar/thunar-file.c(thunar_file_get_mime_info): Documentation fix.
* thunar-vfs/thunar-vfs-mime-database.c
  (thunar_vfs_mime_database_get_info_for_file): When generating an
  application/x-extension-<EXT> mime type and no valid extension is
  found for the file name, fallback to the whole filename as suggested
  by jrb. This way we can make sure that we will never return
  application/octet-stream from this method and thereby allow the
  program chooser to set default applications for every mime type
  used in the file manager.
* thunar/Makefile.am: Add $(top_builddir) to INCLUDES.

(Old svn revision: 17560)

ChangeLog
examples/open-terminal-here/Makefile.am
thunar-vfs/thunar-vfs-mime-database.c
thunar/Makefile.am
thunar/thunar-extension-manager.c
thunar/thunar-file.c
thunar/thunar-standard-view.c

index 3b0098e..b25f060 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,25 @@
 2005-09-11     Benedikt Meurer <benny@xfce.org>
 
        * thunar/thunar-standard-view.c: Sort the extension actions by their
+         names instead of their labels.
+       * thunar/thunar-extension-manager.c(thunar_extension_class_init):
+         Properly initialize the parent class reference.
+       * examples/open-terminal-here/Makefile.am: Don't specify CLEANFILES
+         explicitly.
+       * thunar/thunar-file.c(thunar_file_get_mime_info): Documentation fix.
+       * thunar-vfs/thunar-vfs-mime-database.c
+         (thunar_vfs_mime_database_get_info_for_file): When generating an
+         application/x-extension-<EXT> mime type and no valid extension is
+         found for the file name, fallback to the whole filename as suggested
+         by jrb. This way we can make sure that we will never return
+         application/octet-stream from this method and thereby allow the
+         program chooser to set default applications for every mime type
+         used in the file manager.
+       * thunar/Makefile.am: Add $(top_builddir) to INCLUDES.
+
+2005-09-11     Benedikt Meurer <benny@xfce.org>
+
+       * thunar/thunar-standard-view.c: Sort the extension actions by their
          labels prior to adding them to the UI manager.
 
 2005-09-11     Benedikt Meurer <benny@xfce.org>
index 75d0253..c486a13 100644 (file)
@@ -27,9 +27,6 @@ open_terminal_here_la_LDFLAGS =                                               \
        -export-dynamic                                                 \
        -module
 
-CLEANFILES =                                                           \
-       open-terminal-here.la
-
 EXTRA_DIST =                                                           \
        README
 
index 9a2de16..5f17cd4 100644 (file)
@@ -1052,24 +1052,31 @@ thunar_vfs_mime_database_get_info_for_file (ThunarVfsMimeDatabase *database,
         }
 
       /* if we have exactly a dot and a non-empty extension, we
-       * can generate a 'application/x-extension-<EXT>' on the fly.
+       * can generate a 'application/x-extension-<EXT>' on the fly
+       * or if no extension is found, we'll use the whole filename
+       * for '<EXT>'.
        */
       if (G_UNLIKELY (info == NULL))
         {
+          /* check if the filename has an extension */
           p = strrchr (name, '.');
           if (G_UNLIKELY (p != NULL && *++p != '\0'))
             {
+              /* use the file extension for the type */
               buffer = g_utf8_strdown (p, -1);
-              type = g_strconcat ("application/x-extension-", buffer, NULL);
-              info = thunar_vfs_mime_database_get_info (database, type);
-              g_free (buffer);
-              g_free (type);
             }
-        }
+          else
+            {
+              /* use the whole filename for the type as suggested by jrb */
+              buffer = g_utf8_strdown (name, -1);
+            }
 
-      /* fallback to 'application/octet-stream' */
-      if (G_UNLIKELY (info == NULL))
-        info = exo_object_ref (database->application_octet_stream);
+          /* generate a new mime type */
+          type = g_strconcat ("application/x-extension-", buffer, NULL);
+          info = thunar_vfs_mime_database_get_info (database, type);
+          g_free (buffer);
+          g_free (type);
+        }
     }
 
   /* cleanup */
index d7f833b..d23c9e4 100644 (file)
@@ -1,6 +1,7 @@
 # $Id$
 
 INCLUDES =                                                             \
+       -I$(top_builddir)                                               \
        -I$(top_srcdir)                                                 \
        -DDATADIR=\"$(datadir)\"                                        \
        -DEXO_API_SUBJECT_TO_CHANGE                                     \
index 35f1d31..573bb19 100644 (file)
@@ -134,6 +134,9 @@ thunar_extension_class_init (ThunarExtensionClass *klass)
   GTypeModuleClass *gtype_module_class;
   GObjectClass     *gobject_class;
 
+  /* determine the parent class */
+  thunar_extension_parent_class = g_type_class_peek_parent (klass);
+
   gobject_class = G_OBJECT_CLASS (klass);
   gobject_class->finalize = thunar_extension_finalize;
   gobject_class->get_property = thunar_extension_get_property;
index 0eaf4f2..c32a851 100644 (file)
@@ -987,7 +987,7 @@ thunar_file_get_uri (ThunarFile *file)
  * object for the caller, so you'll need to call thunar_vfs_mime_info()
  * when you are done with it.
  *
- * Return value: the MIME type or %NULL.
+ * Return value: the MIME type.
  **/
 ThunarVfsMimeInfo*
 thunar_file_get_mime_info (ThunarFile *file)
index a72b7a3..2b52356 100644 (file)
@@ -1066,26 +1066,7 @@ static gint
 compare_actions (gconstpointer a,
                  gconstpointer b)
 {
-  gchar *label_a;
-  gchar *label_b;
-  gint   result;
-
-  g_object_get (G_OBJECT (a), "label", &label_a, NULL);
-  g_object_get (G_OBJECT (b), "label", &label_b, NULL);
-
-  if (G_UNLIKELY (label_a == NULL && label_b == NULL))
-    result = 0;
-  else if (G_UNLIKELY (label_a == NULL))
-    result = -1;
-  else if (G_UNLIKELY (label_b == NULL))
-    result = 1;
-  else
-    result = g_utf8_collate (label_a, label_b);
-
-  g_free (label_b);
-  g_free (label_a);
-
-  return result;
+  return strcmp (gtk_action_get_name (GTK_ACTION (a)), gtk_action_get_name (GTK_ACTION (b)));
 }
 
 
@@ -1172,7 +1153,7 @@ thunar_standard_view_merge_menu_extensions (ThunarStandardView *standard_view,
       standard_view->priv->extension_merge_id = gtk_ui_manager_new_merge_id (standard_view->ui_manager);
       gtk_ui_manager_insert_action_group (standard_view->ui_manager, standard_view->priv->extension_actions, -1);
 
-      /* sort the actions by their labels */
+      /* sort the actions by their names */
       actions = g_list_sort (actions, compare_actions);
 
       /* add the actions to the UI manager */