Fixed bug 3040, Action column has wrong contents
2000-10-16 Gene Z. Ragan <gzr@eazel.com> Fixed bug 3040, Action column has wrong contents Corrected an instance where text was not getting freed and reset. Also fixed a few leaks in the list population code. * mime-type-capplet/nautilus-mime-type-capplet.c: (populate_application_menu), (populate_viewer_menu), (add_mime_clicked), (populate_mime_list):
This commit is contained in:
parent
63dbc343bd
commit
6ff265240c
1 changed files with 28 additions and 15 deletions
|
@ -699,6 +699,7 @@ populate_application_menu (GtkWidget *application_menu, const char *mime_type)
|
|||
/* Set it as active */
|
||||
gtk_menu_set_active (GTK_MENU (new_menu), index);
|
||||
}
|
||||
gnome_vfs_mime_application_free (default_app);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -844,6 +845,7 @@ populate_viewer_menu (GtkWidget *component_menu, const char *mime_type)
|
|||
/* Set it as active */
|
||||
gtk_menu_set_active (GTK_MENU (new_menu), index);
|
||||
}
|
||||
CORBA_free (default_component);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -899,7 +901,7 @@ add_mime_clicked (GtkWidget *widget, gpointer data)
|
|||
if (description != NULL && strlen (description) > 0) {
|
||||
text[0] = g_strdup (description);
|
||||
} else {
|
||||
text[0] = g_strdup ("");
|
||||
text[0] = "";
|
||||
}
|
||||
|
||||
/* Add mime type to second column */
|
||||
|
@ -914,7 +916,7 @@ add_mime_clicked (GtkWidget *widget, gpointer data)
|
|||
}
|
||||
|
||||
/* Add default action to fourth column */
|
||||
text[3] = _("None");
|
||||
text[3] = g_strdup(_("None"));
|
||||
|
||||
/* Insert item into list */
|
||||
row = gtk_clist_insert (GTK_CLIST (mime_list), 1, text);
|
||||
|
@ -949,8 +951,8 @@ add_mime_clicked (GtkWidget *widget, gpointer data)
|
|||
case GNOME_VFS_MIME_ACTION_TYPE_APPLICATION:
|
||||
/* Get the default application */
|
||||
default_app = gnome_vfs_mime_get_default_application (mime_string);
|
||||
text[3] = default_app->name;
|
||||
|
||||
g_free (text[3]);
|
||||
text[3] = g_strdup (default_app->name);
|
||||
action_icon_name = gnome_vfs_mime_get_icon (mime_string);
|
||||
if (action_icon_name != NULL) {
|
||||
/* Get custom icon */
|
||||
|
@ -963,13 +965,16 @@ add_mime_clicked (GtkWidget *widget, gpointer data)
|
|||
/* Use default icon */
|
||||
pixbuf = gdk_pixbuf_new_from_file ("/gnome/share/pixmaps/nautilus/i-executable.png");
|
||||
}
|
||||
gnome_vfs_mime_application_free (default_app);
|
||||
break;
|
||||
|
||||
case GNOME_VFS_MIME_ACTION_TYPE_COMPONENT:
|
||||
/* Get the default component */
|
||||
default_component = gnome_vfs_mime_get_default_component (mime_string);
|
||||
g_free (text[3]);
|
||||
text[3] = name_from_oaf_server_info (default_component);
|
||||
pixbuf = gdk_pixbuf_new_from_file ("/gnome/share/pixmaps/nautilus/gnome-library.png");
|
||||
CORBA_free (default_component);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -987,6 +992,7 @@ add_mime_clicked (GtkWidget *widget, gpointer data)
|
|||
}
|
||||
|
||||
g_free (text[0]);
|
||||
g_free (text[3]);
|
||||
g_free (extensions);
|
||||
}
|
||||
}
|
||||
|
@ -1056,9 +1062,11 @@ nautilus_mime_type_capplet_update_viewer_info (const char *mime_type)
|
|||
static void
|
||||
populate_mime_list (GList *type_list, GtkCList *clist)
|
||||
{
|
||||
static gchar *text[3];
|
||||
const char *description, *action_icon_name, *description_icon_name;
|
||||
char *extensions, *mime_string, *action_icon_path, *description_icon_path;
|
||||
static gchar *text[4];
|
||||
const char *description, *description_icon_name;
|
||||
const char *action_icon_name;
|
||||
char *extensions, *mime_string, *description_icon_path;
|
||||
char *action_icon_path;
|
||||
gint row;
|
||||
GList *element;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
@ -1097,7 +1105,7 @@ populate_mime_list (GList *type_list, GtkCList *clist)
|
|||
}
|
||||
|
||||
/* Add default action to fourth column */
|
||||
text[3] = _("None");
|
||||
text[3] = g_strdup(_("None"));
|
||||
|
||||
/* Insert item into list */
|
||||
row = gtk_clist_insert (GTK_CLIST (clist), 1, text);
|
||||
|
@ -1132,7 +1140,8 @@ populate_mime_list (GList *type_list, GtkCList *clist)
|
|||
case GNOME_VFS_MIME_ACTION_TYPE_APPLICATION:
|
||||
/* Get the default application */
|
||||
default_app = gnome_vfs_mime_get_default_application (mime_string);
|
||||
text[3] = default_app->name;
|
||||
g_free (text[3]);
|
||||
text[3] = g_strdup (default_app->name);
|
||||
|
||||
action_icon_name = gnome_vfs_mime_get_icon (mime_string);
|
||||
if (action_icon_name != NULL) {
|
||||
|
@ -1146,13 +1155,16 @@ populate_mime_list (GList *type_list, GtkCList *clist)
|
|||
/* Use default icon */
|
||||
pixbuf = gdk_pixbuf_new_from_file ("/gnome/share/pixmaps/nautilus/i-executable.png");
|
||||
}
|
||||
gnome_vfs_mime_application_free (default_app);
|
||||
break;
|
||||
|
||||
case GNOME_VFS_MIME_ACTION_TYPE_COMPONENT:
|
||||
/* Get the default component */
|
||||
default_component = gnome_vfs_mime_get_default_component (mime_string);
|
||||
g_free (text[3]);
|
||||
text[3] = name_from_oaf_server_info (default_component);
|
||||
pixbuf = gdk_pixbuf_new_from_file ("/gnome/share/pixmaps/nautilus/gnome-library.png");
|
||||
CORBA_free (default_component);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1170,6 +1182,7 @@ populate_mime_list (GList *type_list, GtkCList *clist)
|
|||
}
|
||||
|
||||
g_free (text[0]);
|
||||
g_free (text[3]);
|
||||
g_free (extensions);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue