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>
-export-dynamic \
-module
-CLEANFILES = \
- open-terminal-here.la
-
EXTRA_DIST = \
README
}
/* 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 */
# $Id$
INCLUDES = \
+ -I$(top_builddir) \
-I$(top_srcdir) \
-DDATADIR=\"$(datadir)\" \
-DEXO_API_SUBJECT_TO_CHANGE \
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;
* 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)
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)));
}
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 */