Read custom_line from default_action (mime_type_info_save): Set custom
2002-01-11 Bradford Hovinen <hovinen@ximian.com> * mime-type-info.c (mime_type_info_load): Read custom_line from default_action (mime_type_info_save): Set custom line through GnomeVFS app registry
This commit is contained in:
parent
9ae7188b6c
commit
558c9c00f4
4 changed files with 37 additions and 7 deletions
|
@ -1,5 +1,10 @@
|
|||
2002-01-11 Bradford Hovinen <hovinen@ximian.com>
|
||||
|
||||
* mime-type-info.c (mime_type_info_load): Read custom_line from
|
||||
default_action
|
||||
(mime_type_info_save): Set custom line through GnomeVFS app
|
||||
registry
|
||||
|
||||
* file-types-capplet.c (row_activated_cb): Implement. Callback for
|
||||
row_activated signal
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
- Get icon name (esp. use of stock icons) working correctly
|
||||
- Add categories to many types in MIME database
|
||||
- Validation
|
||||
- Talk to gnome-vfs people about edit and print lines
|
||||
- Do something better about custom-line (i.e. create a dummy app in the app register)
|
||||
- Implement tree cascading
|
||||
- Fix gnome_url_show
|
||||
- Make add work
|
||||
- Need a way to get all apps in the app registry
|
||||
|
||||
CVS Surgery
|
||||
- Move file-types to gnome-control-center, rename ???
|
||||
|
|
|
@ -450,6 +450,8 @@ store_data (MimeEditDialog *dialog)
|
|||
|
||||
GList *ext_list;
|
||||
|
||||
GnomeVFSMimeApplication *app;
|
||||
|
||||
g_free (dialog->p->info->description);
|
||||
dialog->p->info->description = g_strdup (gtk_entry_get_text (GTK_ENTRY (WID ("description_entry"))));
|
||||
|
||||
|
@ -473,7 +475,11 @@ store_data (MimeEditDialog *dialog)
|
|||
menu_item = (g_list_nth (menu_shell->children, idx))->data;
|
||||
|
||||
gnome_vfs_mime_application_free (dialog->p->info->default_action);
|
||||
dialog->p->info->default_action = gnome_vfs_mime_application_copy (g_object_get_data (menu_item, "app"));
|
||||
app = g_object_get_data (menu_item, "app");
|
||||
if (app != NULL)
|
||||
dialog->p->info->default_action = gnome_vfs_mime_application_copy (app);
|
||||
else
|
||||
dialog->p->info->default_action = NULL;
|
||||
|
||||
g_free (dialog->p->info->custom_line);
|
||||
dialog->p->info->custom_line = g_strdup (gnome_file_entry_get_full_path (GNOME_FILE_ENTRY (WID ("program_entry")), FALSE));
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#endif
|
||||
|
||||
#include <bonobo.h>
|
||||
#include <libgnomevfs/gnome-vfs-application-registry.h>
|
||||
|
||||
#include "mime-type-info.h"
|
||||
#include "mime-types-model.h"
|
||||
|
@ -102,7 +103,12 @@ mime_type_info_load (GtkTreeModel *model, GtkTreeIter *iter)
|
|||
info->edit_line = g_strdup (gnome_vfs_mime_get_value (info->mime_type, "edit-line"));
|
||||
info->print_line = g_strdup (gnome_vfs_mime_get_value (info->mime_type, "print-line"));
|
||||
info->default_action = gnome_vfs_mime_get_default_application (info->mime_type);
|
||||
info->custom_line = g_strdup (gnome_vfs_mime_get_value (info->mime_type, "custom-line"));
|
||||
|
||||
if (!strncmp (info->default_action->id, "custom-", strlen ("custom-"))) {
|
||||
info->custom_line = g_strdup (info->default_action->command);
|
||||
gnome_vfs_mime_application_free (info->default_action);
|
||||
info->default_action = NULL;
|
||||
}
|
||||
|
||||
component_info = gnome_vfs_mime_get_default_component (info->mime_type);
|
||||
|
||||
|
@ -119,15 +125,29 @@ mime_type_info_load (GtkTreeModel *model, GtkTreeIter *iter)
|
|||
void
|
||||
mime_type_info_save (const MimeTypeInfo *info)
|
||||
{
|
||||
gchar *tmp;
|
||||
gchar *tmp, *tmp1;
|
||||
gchar *appid;
|
||||
|
||||
gnome_vfs_mime_set_description (info->mime_type, info->description);
|
||||
gnome_vfs_mime_set_icon (info->mime_type, info->icon_name);
|
||||
gnome_vfs_mime_set_default_application (info->mime_type, info->default_action->id);
|
||||
gnome_vfs_mime_set_value (info->mime_type, "custom-line", info->custom_line);
|
||||
gnome_vfs_mime_set_value (info->mime_type, "print-line", info->print_line);
|
||||
gnome_vfs_mime_set_value (info->mime_type, "edit-line", info->edit_line);
|
||||
|
||||
if (info->default_action != NULL) {
|
||||
gnome_vfs_mime_set_default_application (info->mime_type, info->default_action->id);
|
||||
}
|
||||
else if (info->custom_line != NULL && *info->custom_line != '\0') {
|
||||
tmp = g_strdup (info->mime_type);
|
||||
for (tmp1 = tmp; *tmp1 != '\0'; tmp1++)
|
||||
if (*tmp1 == '/') *tmp1 = '-';
|
||||
appid = g_strconcat ("custom-", tmp, NULL);
|
||||
g_free (tmp);
|
||||
|
||||
gnome_vfs_application_registry_set_value (appid, "command", info->custom_line);
|
||||
|
||||
gnome_vfs_mime_set_default_application (info->mime_type, appid);
|
||||
}
|
||||
|
||||
tmp = form_extensions_string (info, " ", NULL);
|
||||
gnome_vfs_mime_set_extensions_list (info->mime_type, tmp);
|
||||
g_free (tmp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue