gnome-commander r1557 - in trunk: . src
- From: epiotr svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-commander r1557 - in trunk: . src
- Date: Wed, 6 Feb 2008 22:47:17 +0000 (GMT)
Author: epiotr
Date: Wed Feb 6 22:47:17 2008
New Revision: 1557
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1557&view=rev
Log:
Fix for crash when handling mime for some exotic permissions
Modified:
trunk/ChangeLog
trunk/src/gnome-cmd-file-popmenu.cc
trunk/src/gnome-cmd-file-props-dialog.cc
trunk/src/gnome-cmd-file.cc
Modified: trunk/src/gnome-cmd-file-popmenu.cc
==============================================================================
--- trunk/src/gnome-cmd-file-popmenu.cc (original)
+++ trunk/src/gnome-cmd-file-popmenu.cc Wed Feb 6 22:47:17 2008
@@ -92,24 +92,33 @@
for (; files; files = files->next)
{
GnomeCmdFile *finfo = (GnomeCmdFile *) files->data;
- GnomeVFSMimeApplication *vfs_app = gnome_vfs_mime_get_default_application (finfo->info->mime_type);
- if (vfs_app)
+
+ if (!finfo->info->mime_type)
+ gnome_cmd_show_message (NULL, finfo->info->name, "Couldn't retrieve mime type of the file.");
+ else
{
- OpenWithData *data = (OpenWithData *) g_hash_table_lookup (hash, vfs_app->id);
- if (!data)
+ GnomeVFSMimeApplication *vfs_app = gnome_vfs_mime_get_default_application (finfo->info->mime_type);
+
+ if (vfs_app)
{
- data = g_new0 (OpenWithData, 1);
- data->app = gnome_cmd_app_new_from_vfs_app (vfs_app);
- data->files = NULL;
- g_hash_table_insert (hash, vfs_app->id, data);
- }
+ OpenWithData *data = (OpenWithData *) g_hash_table_lookup (hash, vfs_app->id);
- gnome_vfs_mime_application_free (vfs_app);
- data->files = g_list_append (data->files, finfo);
+ if (!data)
+ {
+ data = g_new0 (OpenWithData, 1);
+ data->app = gnome_cmd_app_new_from_vfs_app (vfs_app);
+ data->files = NULL;
+ g_hash_table_insert (hash, vfs_app->id, data);
+ }
+
+ gnome_vfs_mime_application_free (vfs_app);
+ data->files = g_list_append (data->files, finfo);
+ }
}
}
g_hash_table_foreach (hash, (GHFunc) htcb_exec_with_app, NULL);
+
g_hash_table_destroy (hash);
}
Modified: trunk/src/gnome-cmd-file-props-dialog.cc
==============================================================================
--- trunk/src/gnome-cmd-file-props-dialog.cc (original)
+++ trunk/src/gnome-cmd-file-props-dialog.cc Wed Feb 6 22:47:17 2008
@@ -408,12 +408,17 @@
label = create_bold_label (dialog, _("Opens with:"));
table_add (table, label, 0, y, GTK_FILL);
- GnomeVFSMimeApplication *vfs_app = gnome_vfs_mime_get_default_application (data->finfo->info->mime_type);
-
- if (vfs_app)
+ if (data->finfo->info->mime_type)
{
- data->app_label = label = create_label (dialog, vfs_app->name);
- gnome_vfs_mime_application_free (vfs_app);
+ GnomeVFSMimeApplication *vfs_app = gnome_vfs_mime_get_default_application (data->finfo->info->mime_type);
+
+ if (vfs_app)
+ {
+ data->app_label = label = create_label (dialog, vfs_app->name);
+ gnome_vfs_mime_application_free (vfs_app);
+ }
+ else
+ label = create_label (dialog, _("No default application registered"));
}
else
label = create_label (dialog, _("No default application registered"));
Modified: trunk/src/gnome-cmd-file.cc
==============================================================================
--- trunk/src/gnome-cmd-file.cc (original)
+++ trunk/src/gnome-cmd-file.cc Wed Feb 6 22:47:17 2008
@@ -634,7 +634,7 @@
g_return_val_if_fail (finfo != NULL, NULL);
g_return_val_if_fail (finfo->info != NULL, NULL);
- return gnome_vfs_mime_get_description (finfo->info->mime_type);
+ return finfo->info->mime_type ? gnome_vfs_mime_get_description (finfo->info->mime_type) : NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]