Patch to improve handling of new mime types
- From: Jody Goldberg <jody gnome org>
- To: nautilus-list gnome org
- Subject: Patch to improve handling of new mime types
- Date: Tue, 25 Jun 2002 16:56:13 -0400
1) Enables the mime sb monitor (needs some patches to gnome-vfs to
make it work)
2) sends the file name along with the mime type to the capplet so
that we can make better guesses for unknown types.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5376
diff -u -w -r1.5376 ChangeLog
--- ChangeLog 21 Jun 2002 03:40:14 -0000 1.5376
+++ ChangeLog 25 Jun 2002 20:31:24 -0000
@@ -1,3 +1,14 @@
+2002-06-25 Jody Goldberg <jody gnome org>
+
+ * libnautilus-private/nautilus-program-chooser.c
+ (launch_mime_capplet) : take a NautilusFile not a mime type.
+ Quote the mime type, and pass the quoted file name too.
+ (launch_mime_capplet_and_close_dialog) : pass the file directly.
+ (nautilus_program_chooser_show_no_choices_message) : ditto.
+
+ * src/file-manager/fm-directory-view.c (cb_mime_db_changed) : new.
+ (fm_directory_view_init) : connect to the mime db changed signal.
+
2002-06-20 Mark McLoughlin <mark skynet ie>
* src/file-manager/fm-desktop-icon-view.c:
Index: libnautilus-private/nautilus-program-chooser.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-program-chooser.c,v
retrieving revision 1.73
diff -u -w -r1.73 nautilus-program-chooser.c
--- libnautilus-private/nautilus-program-chooser.c 12 Jun 2002 14:21:59 -0000 1.73
+++ libnautilus-private/nautilus-program-chooser.c 25 Jun 2002 20:31:26 -0000
@@ -916,13 +916,17 @@
}
static void
-launch_mime_capplet (const char *mime_type)
+launch_mime_capplet (NautilusFile *file)
{
char *command;
+ char *mime_type = nautilus_file_get_mime_type (file);
+ char *file_name = nautilus_file_get_display_name (file);
- command = g_strconcat (FILE_TYPES_CAPPLET_NAME, " ", mime_type, NULL);
+ command = g_strconcat (FILE_TYPES_CAPPLET_NAME, " '", mime_type, "' '", file_name, "'", NULL);
nautilus_launch_application_from_command (FILE_TYPES_CAPPLET_NAME, command, NULL, FALSE);
g_free (command);
+ g_free (file_name);
+ g_free (mime_type);
}
static void
@@ -940,16 +944,11 @@
launch_mime_capplet_and_close_dialog (GtkButton *button, gpointer callback_data)
{
ProgramFilePair *file_pair;
- char *mime_type;
g_assert (GTK_IS_BUTTON (button));
file_pair = get_selected_program_file_pair (NAUTILUS_PROGRAM_CHOOSER (callback_data));
- mime_type = nautilus_file_get_mime_type (file_pair->file);
- launch_mime_capplet (mime_type);
-
- g_free (mime_type);
-
+ launch_mime_capplet (file_pair->file);
gtk_dialog_response (GTK_DIALOG (callback_data),
GTK_RESPONSE_DELETE_EVENT);
}
@@ -1550,7 +1549,7 @@
g_signal_connect (dialog, "response",
G_CALLBACK (launch_mime_capplet_on_ok),
- nautilus_file_get_mime_type (file));
+ file);
g_free (unavailable_message);
g_free (file_name);
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.540
diff -u -w -r1.540 fm-directory-view.c
--- src/file-manager/fm-directory-view.c 31 May 2002 05:41:53 -0000 1.540
+++ src/file-manager/fm-directory-view.c 25 Jun 2002 20:31:30 -0000
@@ -60,6 +60,7 @@
#include <libgnomevfs/gnome-vfs-result.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-utils.h>
+#include <libgnomevfs/gnome-vfs-mime-monitor.h>
#include <libnautilus-private/nautilus-bonobo-extensions.h>
#include <libnautilus-private/nautilus-directory-background.h>
#include <libnautilus-private/nautilus-directory.h>
@@ -1263,6 +1264,29 @@
}
static void
+cb_mime_db_changed (GnomeVFSMIMEMonitor *monitor, FMDirectoryView *view)
+{
+ GList *attributes = NULL;
+
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (view->details != NULL);
+
+ if (view->details->file_monitored_for_open_with == NULL)
+ return;
+
+ attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI);
+ attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_CAPABILITIES);
+ attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON);
+ attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
+ attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_METADATA);
+ attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE);
+ attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES);
+ nautilus_file_invalidate_attributes (
+ view->details->file_monitored_for_open_with,
+ attributes);
+}
+
+static void
fm_directory_view_init (FMDirectoryView *view)
{
static gboolean setup_autos = FALSE;
@@ -1330,6 +1354,8 @@
G_CALLBACK (zoomable_zoom_to_fit_callback), view, 0);
g_signal_connect_object (nautilus_trash_monitor_get (), "trash_state_changed",
G_CALLBACK (fm_directory_view_trash_state_changed_callback), view, 0);
+ g_signal_connect_object (gnome_vfs_mime_monitor_get (), "data_changed",
+ G_CALLBACK (cb_mime_db_changed), view, 0);
/* React to icon theme changes. */
g_signal_connect_object (nautilus_icon_factory_get (), "icons_changed",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]