Implement (find_possible_supported_apps): Implement
2002-01-26 Bradford Hovinen <hovinen@ximian.com> * mime-type-info.c (intersect_lists, reduce_supported_app_list) (mime_category_info_find_apps): Implement (find_possible_supported_apps): Implement * mime-category-edit-dialog.c (mime_category_edit_dialog_init): Use mime_category_edit_widget for the dialog source * model-entry.c (model_entry_remove_from_dirty_list): Accept a ModelEntry structure * mime-category-edit-dialog.c (store_data): Call model_entry_append_to_dirty_list * service-edit-dialog.c (store_data): Call model_entry_append_to_dirty_list
This commit is contained in:
parent
fbdb86b151
commit
d8c7752324
18 changed files with 1029 additions and 248 deletions
|
@ -1,5 +1,72 @@
|
||||||
|
2002-01-26 Bradford Hovinen <hovinen@ximian.com>
|
||||||
|
|
||||||
|
* mime-type-info.c (intersect_lists, reduce_supported_app_list)
|
||||||
|
(mime_category_info_find_apps): Implement
|
||||||
|
(find_possible_supported_apps): Implement
|
||||||
|
|
||||||
|
* mime-category-edit-dialog.c (mime_category_edit_dialog_init):
|
||||||
|
Use mime_category_edit_widget for the dialog source
|
||||||
|
|
||||||
|
* model-entry.c (model_entry_remove_from_dirty_list): Accept a
|
||||||
|
ModelEntry structure
|
||||||
|
|
||||||
|
* mime-category-edit-dialog.c (store_data): Call
|
||||||
|
model_entry_append_to_dirty_list
|
||||||
|
|
||||||
|
* service-edit-dialog.c (store_data): Call
|
||||||
|
model_entry_append_to_dirty_list
|
||||||
|
|
||||||
|
* service-info.c (service_info_new): Remove changeset
|
||||||
|
(get_string, get_bool): Remove changeset support
|
||||||
|
(set_string, set_bool): Ditto
|
||||||
|
|
||||||
|
* file-types-capplet.c: Remove the changeset since it duplicates
|
||||||
|
functionality already present elsewhere
|
||||||
|
|
||||||
|
* model-entry.c: Move dirty list from mime-type-info.c to here;
|
||||||
|
extend to support arbitrary model entries
|
||||||
|
|
||||||
|
* mime-type-info.c (mime_type_info_new_category): Rename to
|
||||||
|
mime_category_info_new; return MimeCategoryInfo
|
||||||
|
(mime_category_info_new): Set parent to root node if it is NULL
|
||||||
|
(get_category): Return a MimeCategoryInfo
|
||||||
|
(mime_type_info_category_find_supported_apps): Rename to
|
||||||
|
mime_type_info_find_apps
|
||||||
|
|
||||||
|
* mime-type-info.h (struct _MimeCategoryInfo): Create new structure
|
||||||
|
|
||||||
|
* mime-category-edit-dialog.c: Change iter property back to info
|
||||||
|
(fill_dialog): Desensitize description, mime type entries
|
||||||
|
|
||||||
|
* service-edit-dialog.c: Change iter property back to info
|
||||||
|
(validate_data): Don't check duplicate directory unless this is an
|
||||||
|
add dialog
|
||||||
|
|
||||||
|
* mime-edit-dialog.c: Change iter property back to info
|
||||||
|
|
||||||
2002-01-25 Bradford Hovinen <hovinen@ximian.com>
|
2002-01-25 Bradford Hovinen <hovinen@ximian.com>
|
||||||
|
|
||||||
|
* service-edit-dialog.c (store_data): Fetch the protocol name if
|
||||||
|
this is an add dialog
|
||||||
|
(validate_data): Implement
|
||||||
|
(response_cb): Call validate_data
|
||||||
|
|
||||||
|
* service-info.c (service_info_new): Don't strdup the protocol if
|
||||||
|
it is NULL
|
||||||
|
|
||||||
|
* service-edit-dialog.c (store_data): Use
|
||||||
|
gtk_tree_model_row_inserted if this is an add dialog; also
|
||||||
|
construct an iter in that case
|
||||||
|
(service_edit_dialog_dispose): Free the iter
|
||||||
|
(service_edit_dialog_finalize): Don't free the iter here
|
||||||
|
|
||||||
|
* file-types-capplet.c (add_service_cb): Implement
|
||||||
|
(create_dialog): Connect addd_service_button to add_service_cb
|
||||||
|
|
||||||
|
* service-edit-dialog.c: Add property is-add
|
||||||
|
(service_add_dialog_new): Implement
|
||||||
|
(setup_add_dialog): Implement
|
||||||
|
|
||||||
* mime-category-edit-dialog.c (fill_dialog): Desensitize component
|
* mime-category-edit-dialog.c (fill_dialog): Desensitize component
|
||||||
select
|
select
|
||||||
(populate_application_list): Desensitize application select if
|
(populate_application_list): Desensitize application select if
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
- Better sorting on the MIME types tree
|
- Better sorting on the MIME types tree
|
||||||
- Don't consider a mime type when generating category handler list if the mime type overrides the category default
|
- Don't consider a mime type when generating category handler list if the mime type overrides the category default
|
||||||
- Implement override_category_default flag
|
- Implement override_category_default flag
|
||||||
- Implement setting of default action for a whole category
|
- Implement mime_category_info_save, mime_category_info_load_all
|
||||||
- Implement retrieving the current default action for a whole category
|
|
||||||
- Implement remove for Internet services
|
- Implement remove for Internet services
|
||||||
- Implement add service
|
- Better checking for duplicate service names, check for duplicate MIME types
|
||||||
- Refactor: Don't pass iter to add/edit dialogs, just pass structure. Generate iter on the fly
|
- Don't enable Remove button for categories
|
||||||
|
- Make sure cancel on add is handled properly
|
|
@ -34,7 +34,6 @@
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
#include <glade/glade.h>
|
#include <glade/glade.h>
|
||||||
#include <gconf/gconf-client.h>
|
#include <gconf/gconf-client.h>
|
||||||
#include <gconf/gconf-changeset.h>
|
|
||||||
|
|
||||||
#include "mime-types-model.h"
|
#include "mime-types-model.h"
|
||||||
#include "mime-edit-dialog.h"
|
#include "mime-edit-dialog.h"
|
||||||
|
@ -46,7 +45,6 @@
|
||||||
#define WID(x) (glade_xml_get_widget (dialog, x))
|
#define WID(x) (glade_xml_get_widget (dialog, x))
|
||||||
|
|
||||||
static GList *remove_list = NULL;
|
static GList *remove_list = NULL;
|
||||||
static GConfChangeSet *changeset = NULL;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_mime_cb (GtkButton *button, GladeXML *dialog)
|
add_mime_cb (GtkButton *button, GladeXML *dialog)
|
||||||
|
@ -61,6 +59,19 @@ add_mime_cb (GtkButton *button, GladeXML *dialog)
|
||||||
add_dialog = mime_add_dialog_new (model);
|
add_dialog = mime_add_dialog_new (model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
add_service_cb (GtkButton *button, GladeXML *dialog)
|
||||||
|
{
|
||||||
|
GtkTreeView *treeview;
|
||||||
|
GtkTreeModel *model;
|
||||||
|
GObject *add_dialog;
|
||||||
|
|
||||||
|
treeview = GTK_TREE_VIEW (WID ("mime_types_tree"));
|
||||||
|
model = gtk_tree_view_get_model (treeview);
|
||||||
|
|
||||||
|
add_dialog = service_add_dialog_new (model);
|
||||||
|
}
|
||||||
|
|
||||||
static GObject *
|
static GObject *
|
||||||
launch_edit_dialog (GtkTreeModel *model, GtkTreeIter *iter)
|
launch_edit_dialog (GtkTreeModel *model, GtkTreeIter *iter)
|
||||||
{
|
{
|
||||||
|
@ -70,13 +81,13 @@ launch_edit_dialog (GtkTreeModel *model, GtkTreeIter *iter)
|
||||||
|
|
||||||
switch (entry->type) {
|
switch (entry->type) {
|
||||||
case MODEL_ENTRY_MIME_TYPE:
|
case MODEL_ENTRY_MIME_TYPE:
|
||||||
return mime_edit_dialog_new (model, iter);
|
return mime_edit_dialog_new (model, MIME_TYPE_INFO (entry));
|
||||||
|
|
||||||
case MODEL_ENTRY_SERVICE:
|
case MODEL_ENTRY_SERVICE:
|
||||||
return service_edit_dialog_new (model, iter);
|
return service_edit_dialog_new (model, SERVICE_INFO (entry));
|
||||||
|
|
||||||
case MODEL_ENTRY_CATEGORY:
|
case MODEL_ENTRY_CATEGORY:
|
||||||
return mime_category_edit_dialog_new (model, iter);
|
return mime_category_edit_dialog_new (model, MIME_CATEGORY_INFO (entry));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -149,7 +160,7 @@ remove_cb (GtkButton *button, GladeXML *dialog)
|
||||||
path = gtk_tree_model_get_path (model, &iter);
|
path = gtk_tree_model_get_path (model, &iter);
|
||||||
model_entry_remove_child (entry->parent, entry);
|
model_entry_remove_child (entry->parent, entry);
|
||||||
remove_list = g_list_prepend (remove_list, MIME_TYPE_INFO (entry)->mime_type);
|
remove_list = g_list_prepend (remove_list, MIME_TYPE_INFO (entry)->mime_type);
|
||||||
mime_type_remove_from_dirty_list (MIME_TYPE_INFO (entry)->mime_type);
|
model_entry_remove_from_dirty_list (entry);
|
||||||
gtk_tree_model_row_deleted (model, path);
|
gtk_tree_model_row_deleted (model, path);
|
||||||
gtk_tree_path_free (path);
|
gtk_tree_path_free (path);
|
||||||
}
|
}
|
||||||
|
@ -208,6 +219,7 @@ create_dialog (void)
|
||||||
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
|
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (WID ("add_mime_button")), "clicked", (GCallback) add_mime_cb, dialog);
|
g_signal_connect (G_OBJECT (WID ("add_mime_button")), "clicked", (GCallback) add_mime_cb, dialog);
|
||||||
|
g_signal_connect (G_OBJECT (WID ("add_service_button")), "clicked", (GCallback) add_service_cb, dialog);
|
||||||
g_signal_connect (G_OBJECT (WID ("edit_button")), "clicked", (GCallback) edit_cb, dialog);
|
g_signal_connect (G_OBJECT (WID ("edit_button")), "clicked", (GCallback) edit_cb, dialog);
|
||||||
g_signal_connect (G_OBJECT (WID ("remove_button")), "clicked", (GCallback) remove_cb, dialog);
|
g_signal_connect (G_OBJECT (WID ("remove_button")), "clicked", (GCallback) remove_cb, dialog);
|
||||||
g_signal_connect (G_OBJECT (selection), "changed", (GCallback) selection_changed_cb, dialog);
|
g_signal_connect (G_OBJECT (selection), "changed", (GCallback) selection_changed_cb, dialog);
|
||||||
|
@ -220,13 +232,11 @@ create_dialog (void)
|
||||||
static void
|
static void
|
||||||
apply_cb (void)
|
apply_cb (void)
|
||||||
{
|
{
|
||||||
mime_type_commit_dirty_list ();
|
model_entry_commit_dirty_list ();
|
||||||
|
|
||||||
g_list_foreach (remove_list, (GFunc) gnome_vfs_mime_registered_mime_type_delete, NULL);
|
g_list_foreach (remove_list, (GFunc) gnome_vfs_mime_registered_mime_type_delete, NULL);
|
||||||
g_list_foreach (remove_list, (GFunc) g_free, NULL);
|
g_list_foreach (remove_list, (GFunc) g_free, NULL);
|
||||||
g_list_free (remove_list);
|
g_list_free (remove_list);
|
||||||
|
|
||||||
gconf_client_commit_change_set (gconf_client_get_default (), changeset, TRUE, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -240,7 +250,6 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
gnome_program_init ("gnome-file-types-properties", VERSION, LIBGNOMEUI_MODULE, argc, argv, NULL);
|
gnome_program_init ("gnome-file-types-properties", VERSION, LIBGNOMEUI_MODULE, argc, argv, NULL);
|
||||||
|
|
||||||
changeset = gconf_change_set_new ();
|
|
||||||
dialog = create_dialog ();
|
dialog = create_dialog ();
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (WID ("main_apply_button")), "clicked", (GCallback) apply_cb, NULL);
|
g_signal_connect (G_OBJECT (WID ("main_apply_button")), "clicked", (GCallback) apply_cb, NULL);
|
||||||
|
|
|
@ -257,7 +257,7 @@
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox3">
|
<widget class="GtkHBox" id="description_box">
|
||||||
<property name="homogeneous">no</property>
|
<property name="homogeneous">no</property>
|
||||||
<property name="spacing">4</property>
|
<property name="spacing">4</property>
|
||||||
<property name="visible">yes</property>
|
<property name="visible">yes</property>
|
||||||
|
@ -304,7 +304,7 @@
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox4">
|
<widget class="GtkHBox" id="mime_type_box">
|
||||||
<property name="homogeneous">no</property>
|
<property name="homogeneous">no</property>
|
||||||
<property name="spacing">4</property>
|
<property name="spacing">4</property>
|
||||||
<property name="visible">yes</property>
|
<property name="visible">yes</property>
|
||||||
|
@ -351,7 +351,7 @@
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox12">
|
<widget class="GtkHBox" id="category_box">
|
||||||
<property name="homogeneous">no</property>
|
<property name="homogeneous">no</property>
|
||||||
<property name="spacing">4</property>
|
<property name="spacing">4</property>
|
||||||
<property name="visible">yes</property>
|
<property name="visible">yes</property>
|
||||||
|
@ -1094,4 +1094,276 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="GtkDialog" id="mime_category_edit_dialog">
|
||||||
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
|
<property name="modal">no</property>
|
||||||
|
<property name="allow_shrink">no</property>
|
||||||
|
<property name="allow_grow">no</property>
|
||||||
|
<property name="visible">no</property>
|
||||||
|
<property name="window-position">GTK_WIN_POS_NONE</property>
|
||||||
|
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<widget class="GtkVBox" id="dialog-vbox5">
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">8</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<widget class="GtkHButtonBox" id="dialog-action_area5">
|
||||||
|
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||||
|
<property name="spacing">8</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="button13">
|
||||||
|
<property name="can_default">yes</property>
|
||||||
|
<property name="can_focus">yes</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
<property name="label" translatable="yes">gtk-ok</property>
|
||||||
|
<property name="use_stock">yes</property>
|
||||||
|
<property name="use_underline">yes</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="button14">
|
||||||
|
<property name="can_default">yes</property>
|
||||||
|
<property name="can_focus">yes</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
<property name="label" translatable="yes">gtk-apply</property>
|
||||||
|
<property name="use_stock">yes</property>
|
||||||
|
<property name="use_underline">yes</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkButton" id="button15">
|
||||||
|
<property name="can_default">yes</property>
|
||||||
|
<property name="can_focus">yes</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
<property name="label" translatable="yes">gtk-cancel</property>
|
||||||
|
<property name="use_stock">yes</property>
|
||||||
|
<property name="use_underline">yes</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
<property name="pack_type">GTK_PACK_END</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="mime_category_edit_widget">
|
||||||
|
<property name="border_width">4</property>
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">4</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="name_box">
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">4</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="name_label">
|
||||||
|
<property name="label" translatable="yes">Name</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">no</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkEntry" id="name_entry">
|
||||||
|
<property name="can_focus">yes</property>
|
||||||
|
<property name="editable">yes</property>
|
||||||
|
<property name="text" translatable="yes"></property>
|
||||||
|
<property name="max-length">0</property>
|
||||||
|
<property name="visibility">yes</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkFrame" id="frame4">
|
||||||
|
<property name="label" translatable="yes">Actions</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow">GTK_SHADOW_ETCHED_IN</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="vbox7">
|
||||||
|
<property name="border_width">4</property>
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">4</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="default_action_box">
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">4</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="default_action_label">
|
||||||
|
<property name="label" translatable="yes">Default action</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkOptionMenu" id="default_action_select">
|
||||||
|
<property name="can_focus">yes</property>
|
||||||
|
<property name="history">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child internal-child="menu">
|
||||||
|
<widget class="GtkMenu" id="convertwidget8">
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="program_entry_box">
|
||||||
|
<property name="homogeneous">no</property>
|
||||||
|
<property name="spacing">4</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="program_label">
|
||||||
|
<property name="label" translatable="yes">Program to execute</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">no</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GnomeFileEntry" id="program_entry">
|
||||||
|
<property name="modal">no</property>
|
||||||
|
<property name="directory_entry">no</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
|
||||||
|
<child internal-child="entry">
|
||||||
|
<widget class="GtkEntry" id="entry2">
|
||||||
|
<property name="can_focus">yes</property>
|
||||||
|
<property name="editable">yes</property>
|
||||||
|
<property name="text" translatable="yes"></property>
|
||||||
|
<property name="max-length">0</property>
|
||||||
|
<property name="visibility">yes</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkCheckButton" id="needs_terminal_toggle">
|
||||||
|
<property name="can_focus">yes</property>
|
||||||
|
<property name="label" translatable="yes">Needs terminal</property>
|
||||||
|
<property name="active">no</property>
|
||||||
|
<property name="draw_indicator">yes</property>
|
||||||
|
<property name="visible">yes</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">no</property>
|
||||||
|
<property name="fill">no</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">4</property>
|
||||||
|
<property name="expand">yes</property>
|
||||||
|
<property name="fill">yes</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
</glade-interface>
|
</glade-interface>
|
||||||
|
|
|
@ -263,7 +263,7 @@
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkHBox</class>
|
<class>GtkHBox</class>
|
||||||
<name>hbox3</name>
|
<name>description_box</name>
|
||||||
<homogeneous>False</homogeneous>
|
<homogeneous>False</homogeneous>
|
||||||
<spacing>4</spacing>
|
<spacing>4</spacing>
|
||||||
<child>
|
<child>
|
||||||
|
@ -307,7 +307,7 @@
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkHBox</class>
|
<class>GtkHBox</class>
|
||||||
<name>hbox4</name>
|
<name>mime_type_box</name>
|
||||||
<homogeneous>False</homogeneous>
|
<homogeneous>False</homogeneous>
|
||||||
<spacing>4</spacing>
|
<spacing>4</spacing>
|
||||||
<child>
|
<child>
|
||||||
|
@ -351,7 +351,7 @@
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkHBox</class>
|
<class>GtkHBox</class>
|
||||||
<name>hbox12</name>
|
<name>category_box</name>
|
||||||
<homogeneous>False</homogeneous>
|
<homogeneous>False</homogeneous>
|
||||||
<spacing>4</spacing>
|
<spacing>4</spacing>
|
||||||
<child>
|
<child>
|
||||||
|
@ -1036,4 +1036,259 @@
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GnomeDialog</class>
|
||||||
|
<name>mime_category_edit_dialog</name>
|
||||||
|
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||||
|
<position>GTK_WIN_POS_NONE</position>
|
||||||
|
<modal>False</modal>
|
||||||
|
<allow_shrink>False</allow_shrink>
|
||||||
|
<allow_grow>False</allow_grow>
|
||||||
|
<auto_shrink>False</auto_shrink>
|
||||||
|
<auto_close>False</auto_close>
|
||||||
|
<hide_on_close>False</hide_on_close>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkVBox</class>
|
||||||
|
<child_name>GnomeDialog:vbox</child_name>
|
||||||
|
<name>dialog-vbox5</name>
|
||||||
|
<homogeneous>False</homogeneous>
|
||||||
|
<spacing>8</spacing>
|
||||||
|
<child>
|
||||||
|
<padding>4</padding>
|
||||||
|
<expand>True</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkHButtonBox</class>
|
||||||
|
<child_name>GnomeDialog:action_area</child_name>
|
||||||
|
<name>dialog-action_area5</name>
|
||||||
|
<layout_style>GTK_BUTTONBOX_END</layout_style>
|
||||||
|
<spacing>8</spacing>
|
||||||
|
<child_min_width>85</child_min_width>
|
||||||
|
<child_min_height>27</child_min_height>
|
||||||
|
<child_ipad_x>7</child_ipad_x>
|
||||||
|
<child_ipad_y>0</child_ipad_y>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
<pack>GTK_PACK_END</pack>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkButton</class>
|
||||||
|
<name>button13</name>
|
||||||
|
<can_default>True</can_default>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkButton</class>
|
||||||
|
<name>button14</name>
|
||||||
|
<can_default>True</can_default>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkButton</class>
|
||||||
|
<name>button15</name>
|
||||||
|
<can_default>True</can_default>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkVBox</class>
|
||||||
|
<name>mime_category_edit_widget</name>
|
||||||
|
<border_width>4</border_width>
|
||||||
|
<homogeneous>False</homogeneous>
|
||||||
|
<spacing>4</spacing>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>True</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkHBox</class>
|
||||||
|
<name>name_box</name>
|
||||||
|
<homogeneous>False</homogeneous>
|
||||||
|
<spacing>4</spacing>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>True</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkLabel</class>
|
||||||
|
<name>name_label</name>
|
||||||
|
<label>Name</label>
|
||||||
|
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||||
|
<wrap>False</wrap>
|
||||||
|
<xalign>0.5</xalign>
|
||||||
|
<yalign>0.5</yalign>
|
||||||
|
<xpad>0</xpad>
|
||||||
|
<ypad>0</ypad>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>False</fill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkEntry</class>
|
||||||
|
<name>name_entry</name>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<editable>True</editable>
|
||||||
|
<text_visible>True</text_visible>
|
||||||
|
<text_max_length>0</text_max_length>
|
||||||
|
<text></text>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>True</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkFrame</class>
|
||||||
|
<name>frame4</name>
|
||||||
|
<label>Actions</label>
|
||||||
|
<label_xalign>0</label_xalign>
|
||||||
|
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>True</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkVBox</class>
|
||||||
|
<name>vbox7</name>
|
||||||
|
<border_width>4</border_width>
|
||||||
|
<homogeneous>False</homogeneous>
|
||||||
|
<spacing>4</spacing>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkHBox</class>
|
||||||
|
<name>default_action_box</name>
|
||||||
|
<homogeneous>False</homogeneous>
|
||||||
|
<spacing>4</spacing>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkLabel</class>
|
||||||
|
<name>default_action_label</name>
|
||||||
|
<label>Default action</label>
|
||||||
|
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||||
|
<wrap>False</wrap>
|
||||||
|
<xalign>0</xalign>
|
||||||
|
<yalign>0.5</yalign>
|
||||||
|
<xpad>0</xpad>
|
||||||
|
<ypad>0</ypad>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkOptionMenu</class>
|
||||||
|
<name>default_action_select</name>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<items></items>
|
||||||
|
<initial_choice>0</initial_choice>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>True</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkHBox</class>
|
||||||
|
<name>program_entry_box</name>
|
||||||
|
<homogeneous>False</homogeneous>
|
||||||
|
<spacing>4</spacing>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>True</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkLabel</class>
|
||||||
|
<name>program_label</name>
|
||||||
|
<label>Program to execute</label>
|
||||||
|
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||||
|
<wrap>False</wrap>
|
||||||
|
<xalign>0</xalign>
|
||||||
|
<yalign>0.5</yalign>
|
||||||
|
<xpad>0</xpad>
|
||||||
|
<ypad>0</ypad>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GnomeFileEntry</class>
|
||||||
|
<name>program_entry</name>
|
||||||
|
<max_saved>10</max_saved>
|
||||||
|
<directory>False</directory>
|
||||||
|
<modal>False</modal>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>True</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkEntry</class>
|
||||||
|
<child_name>GnomeEntry:entry</child_name>
|
||||||
|
<name>entry2</name>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<editable>True</editable>
|
||||||
|
<text_visible>True</text_visible>
|
||||||
|
<text_max_length>0</text_max_length>
|
||||||
|
<text></text>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkCheckButton</class>
|
||||||
|
<name>needs_terminal_toggle</name>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<label>Needs terminal</label>
|
||||||
|
<active>False</active>
|
||||||
|
<draw_indicator>True</draw_indicator>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>False</fill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
</GTK-Interface>
|
</GTK-Interface>
|
||||||
|
|
|
@ -38,16 +38,16 @@
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_MODEL,
|
PROP_MODEL,
|
||||||
PROP_ITER
|
PROP_INFO
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MimeCategoryEditDialogPrivate
|
struct _MimeCategoryEditDialogPrivate
|
||||||
{
|
{
|
||||||
GladeXML *dialog_xml;
|
GladeXML *dialog_xml;
|
||||||
GtkWidget *dialog_win;
|
GtkWidget *dialog_win;
|
||||||
|
MimeCategoryInfo *info;
|
||||||
|
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GtkTreeIter *iter;
|
|
||||||
MimeTypeInfo *info;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static GObjectClass *parent_class;
|
static GObjectClass *parent_class;
|
||||||
|
@ -113,28 +113,16 @@ mime_category_edit_dialog_init (MimeCategoryEditDialog *dialog, MimeCategoryEdit
|
||||||
|
|
||||||
dialog->p = g_new0 (MimeCategoryEditDialogPrivate, 1);
|
dialog->p = g_new0 (MimeCategoryEditDialogPrivate, 1);
|
||||||
dialog->p->dialog_xml = glade_xml_new
|
dialog->p->dialog_xml = glade_xml_new
|
||||||
(GNOMECC_DATA_DIR "/interfaces/file-types-properties.glade", "edit_widget", NULL);
|
(GNOMECC_DATA_DIR "/interfaces/file-types-properties.glade", "mime_category_edit_widget", NULL);
|
||||||
|
|
||||||
dialog->p->model = NULL;
|
dialog->p->model = NULL;
|
||||||
dialog->p->info = NULL;
|
dialog->p->info = NULL;
|
||||||
|
|
||||||
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||||
gtk_size_group_add_widget (size_group, WID ("description_label"));
|
|
||||||
gtk_size_group_add_widget (size_group, WID ("mime_type_label"));
|
|
||||||
gtk_size_group_add_widget (size_group, WID ("category_label"));
|
|
||||||
|
|
||||||
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
||||||
gtk_size_group_add_widget (size_group, WID ("component_label"));
|
|
||||||
gtk_size_group_add_widget (size_group, WID ("default_action_label"));
|
gtk_size_group_add_widget (size_group, WID ("default_action_label"));
|
||||||
gtk_size_group_add_widget (size_group, WID ("program_label"));
|
gtk_size_group_add_widget (size_group, WID ("program_label"));
|
||||||
|
|
||||||
gtk_widget_set_sensitive (WID ("icon_entry"), FALSE);
|
gtk_widget_set_sensitive (WID ("name_box"), FALSE);
|
||||||
gtk_widget_set_sensitive (WID ("mime_type_entry"), FALSE);
|
|
||||||
gtk_widget_set_sensitive (WID ("mime_type_label"), FALSE);
|
|
||||||
gtk_widget_set_sensitive (WID ("description_entry"), FALSE);
|
|
||||||
gtk_widget_set_sensitive (WID ("file_extensions_frame"), FALSE);
|
|
||||||
gtk_widget_set_sensitive (WID ("component_label"), FALSE);
|
|
||||||
gtk_widget_set_sensitive (WID ("component_select"), FALSE);
|
|
||||||
|
|
||||||
dialog->p->dialog_win = gtk_dialog_new_with_buttons
|
dialog->p->dialog_win = gtk_dialog_new_with_buttons
|
||||||
(_("Edit file category"), NULL, -1,
|
(_("Edit file category"), NULL, -1,
|
||||||
|
@ -142,7 +130,7 @@ mime_category_edit_dialog_init (MimeCategoryEditDialog *dialog, MimeCategoryEdit
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->p->dialog_win)->vbox), WID ("edit_widget"), TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->p->dialog_win)->vbox), WID ("mime_category_edit_widget"), TRUE, TRUE, 0);
|
||||||
|
|
||||||
g_signal_connect_swapped (G_OBJECT (WID ("default_action_select")), "changed", (GCallback) default_action_changed_cb, dialog);
|
g_signal_connect_swapped (G_OBJECT (WID ("default_action_select")), "changed", (GCallback) default_action_changed_cb, dialog);
|
||||||
|
|
||||||
|
@ -173,10 +161,10 @@ mime_category_edit_dialog_class_init (MimeCategoryEditDialogClass *class)
|
||||||
_("GtkTreeModel that contains the category data"),
|
_("GtkTreeModel that contains the category data"),
|
||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class, PROP_ITER,
|
(object_class, PROP_INFO,
|
||||||
g_param_spec_pointer ("iterator",
|
g_param_spec_pointer ("mime-cat-info",
|
||||||
_("Iterator"),
|
_("MIME category info"),
|
||||||
_("Iterator"),
|
_("Structure containing information on the MIME category"),
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
parent_class = G_OBJECT_CLASS
|
parent_class = G_OBJECT_CLASS
|
||||||
|
@ -202,9 +190,8 @@ mime_category_edit_dialog_set_prop (GObject *object, guint prop_id, const GValue
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ITER:
|
case PROP_INFO:
|
||||||
dialog->p->iter = gtk_tree_iter_copy (g_value_get_pointer (value));
|
dialog->p->info = g_value_get_pointer (value);
|
||||||
dialog->p->info = MIME_TYPE_INFO (MODEL_ENTRY_FROM_ITER (dialog->p->iter));
|
|
||||||
|
|
||||||
if (dialog->p->model != NULL)
|
if (dialog->p->model != NULL)
|
||||||
fill_dialog (dialog);
|
fill_dialog (dialog);
|
||||||
|
@ -232,8 +219,8 @@ mime_category_edit_dialog_get_prop (GObject *object, guint prop_id, GValue *valu
|
||||||
g_value_set_pointer (value, dialog->p->model);
|
g_value_set_pointer (value, dialog->p->model);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ITER:
|
case PROP_INFO:
|
||||||
g_value_set_pointer (value, dialog->p->iter);
|
g_value_set_pointer (value, dialog->p->info);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -275,33 +262,29 @@ mime_category_edit_dialog_finalize (GObject *object)
|
||||||
|
|
||||||
mime_category_edit_dialog = MIME_CATEGORY_EDIT_DIALOG (object);
|
mime_category_edit_dialog = MIME_CATEGORY_EDIT_DIALOG (object);
|
||||||
|
|
||||||
gtk_tree_iter_free (mime_category_edit_dialog->p->iter);
|
|
||||||
g_free (mime_category_edit_dialog->p);
|
g_free (mime_category_edit_dialog->p);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
GObject *
|
GObject *
|
||||||
mime_category_edit_dialog_new (GtkTreeModel *model, GtkTreeIter *iter)
|
mime_category_edit_dialog_new (GtkTreeModel *model, MimeCategoryInfo *info)
|
||||||
{
|
{
|
||||||
return g_object_new (mime_category_edit_dialog_get_type (),
|
return g_object_new (mime_category_edit_dialog_get_type (),
|
||||||
"model", model,
|
"model", model,
|
||||||
"iterator", iter,
|
"mime-cat-info", info,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_dialog (MimeCategoryEditDialog *dialog)
|
fill_dialog (MimeCategoryEditDialog *dialog)
|
||||||
{
|
{
|
||||||
gtk_entry_set_text (GTK_ENTRY (WID ("description_entry")), mime_type_info_get_description (dialog->p->info));
|
mime_category_info_load_all (dialog->p->info);
|
||||||
|
|
||||||
|
gtk_entry_set_text (GTK_ENTRY (WID ("name_entry")), dialog->p->info->name);
|
||||||
|
|
||||||
populate_application_list (dialog);
|
populate_application_list (dialog);
|
||||||
|
|
||||||
if (dialog->p->info->entry.parent->type == MODEL_ENTRY_NONE)
|
|
||||||
gtk_widget_set_sensitive (WID ("use_category_defaults_toggle"), FALSE);
|
|
||||||
|
|
||||||
gtk_widget_set_sensitive (WID ("component_box"), FALSE);
|
|
||||||
|
|
||||||
gtk_widget_show_all (dialog->p->dialog_win);
|
gtk_widget_show_all (dialog->p->dialog_win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +302,7 @@ populate_application_list (MimeCategoryEditDialog *dialog)
|
||||||
|
|
||||||
menu = GTK_MENU (gtk_menu_new ());
|
menu = GTK_MENU (gtk_menu_new ());
|
||||||
|
|
||||||
app_list = mime_type_info_category_find_supported_apps (dialog->p->info);
|
app_list = mime_category_info_find_apps (dialog->p->info);
|
||||||
|
|
||||||
for (tmp = app_list, i = 0; tmp != NULL; tmp = tmp->next, i++) {
|
for (tmp = app_list, i = 0; tmp != NULL; tmp = tmp->next, i++) {
|
||||||
app = gnome_vfs_application_registry_get_mime_application (tmp->data);
|
app = gnome_vfs_application_registry_get_mime_application (tmp->data);
|
||||||
|
@ -363,9 +346,13 @@ static void
|
||||||
store_data (MimeCategoryEditDialog *dialog)
|
store_data (MimeCategoryEditDialog *dialog)
|
||||||
{
|
{
|
||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
path = gtk_tree_model_get_path (dialog->p->model, dialog->p->iter);
|
model_entry_append_to_dirty_list (MODEL_ENTRY (dialog->p->info));
|
||||||
gtk_tree_model_row_changed (dialog->p->model, path, dialog->p->iter);
|
|
||||||
|
mime_types_model_construct_iter (MIME_TYPES_MODEL (dialog->p->model), MODEL_ENTRY (dialog->p->info), &iter);
|
||||||
|
path = gtk_tree_model_get_path (dialog->p->model, &iter);
|
||||||
|
gtk_tree_model_row_changed (dialog->p->model, path, &iter);
|
||||||
gtk_tree_path_free (path);
|
gtk_tree_path_free (path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct _MimeCategoryEditDialogClass
|
||||||
GType mime_category_edit_dialog_get_type (void);
|
GType mime_category_edit_dialog_get_type (void);
|
||||||
|
|
||||||
GObject *mime_category_edit_dialog_new (GtkTreeModel *model,
|
GObject *mime_category_edit_dialog_new (GtkTreeModel *model,
|
||||||
GtkTreeIter *iter);
|
MimeCategoryInfo *info);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_MODEL,
|
PROP_MODEL,
|
||||||
PROP_ITER,
|
PROP_INFO,
|
||||||
PROP_IS_ADD
|
PROP_IS_ADD
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@ struct _MimeEditDialogPrivate
|
||||||
gboolean is_add;
|
gboolean is_add;
|
||||||
|
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GtkTreeIter *iter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static GObjectClass *parent_class;
|
static GObjectClass *parent_class;
|
||||||
|
@ -188,10 +187,10 @@ mime_edit_dialog_class_init (MimeEditDialogClass *class)
|
||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class, PROP_ITER,
|
(object_class, PROP_INFO,
|
||||||
g_param_spec_pointer ("iterator",
|
g_param_spec_pointer ("mime-type-info",
|
||||||
_("Iterator"),
|
_("MIME type information"),
|
||||||
_("Iterator on the model referring to object to edit"),
|
_("Structure with data on the MIME type"),
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
|
@ -221,10 +220,9 @@ mime_edit_dialog_set_prop (GObject *object, guint prop_id, const GValue *value,
|
||||||
mime_edit_dialog->p->model = GTK_TREE_MODEL (g_value_get_object (value));
|
mime_edit_dialog->p->model = GTK_TREE_MODEL (g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ITER:
|
case PROP_INFO:
|
||||||
if (g_value_get_pointer (value) != NULL) {
|
if (g_value_get_pointer (value) != NULL) {
|
||||||
mime_edit_dialog->p->iter = gtk_tree_iter_copy (g_value_get_pointer (value));
|
mime_edit_dialog->p->info = g_value_get_pointer (value);
|
||||||
mime_edit_dialog->p->info = MIME_TYPE_INFO (MODEL_ENTRY_FROM_ITER (mime_edit_dialog->p->iter));
|
|
||||||
fill_dialog (mime_edit_dialog);
|
fill_dialog (mime_edit_dialog);
|
||||||
|
|
||||||
gtk_widget_show_all (mime_edit_dialog->p->dialog_win);
|
gtk_widget_show_all (mime_edit_dialog->p->dialog_win);
|
||||||
|
@ -264,8 +262,8 @@ mime_edit_dialog_get_prop (GObject *object, guint prop_id, GValue *value, GParam
|
||||||
g_value_set_object (value, G_OBJECT (mime_edit_dialog->p->model));
|
g_value_set_object (value, G_OBJECT (mime_edit_dialog->p->model));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ITER:
|
case PROP_INFO:
|
||||||
g_value_set_pointer (value, mime_edit_dialog->p->iter);
|
g_value_set_pointer (value, mime_edit_dialog->p->info);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -294,11 +292,6 @@ mime_edit_dialog_dispose (GObject *object)
|
||||||
dialog->p->dialog_win = NULL;
|
dialog->p->dialog_win = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dialog->p->iter != NULL) {
|
|
||||||
gtk_tree_iter_free (dialog->p->iter);
|
|
||||||
dialog->p->iter = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,11 +311,11 @@ mime_edit_dialog_finalize (GObject *object)
|
||||||
}
|
}
|
||||||
|
|
||||||
GObject *
|
GObject *
|
||||||
mime_edit_dialog_new (GtkTreeModel *model, GtkTreeIter *iter)
|
mime_edit_dialog_new (GtkTreeModel *model, MimeTypeInfo *info)
|
||||||
{
|
{
|
||||||
return g_object_new (mime_edit_dialog_get_type (),
|
return g_object_new (mime_edit_dialog_get_type (),
|
||||||
"model", model,
|
"model", model,
|
||||||
"iterator", iter,
|
"mime-type-info", info,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,6 +530,7 @@ store_data (MimeEditDialog *dialog)
|
||||||
|
|
||||||
GnomeVFSMimeApplication *app;
|
GnomeVFSMimeApplication *app;
|
||||||
|
|
||||||
|
GtkTreeIter iter;
|
||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
GtkTreePath *old_path = NULL;
|
GtkTreePath *old_path = NULL;
|
||||||
|
|
||||||
|
@ -576,8 +570,11 @@ store_data (MimeEditDialog *dialog)
|
||||||
if (strcmp (tmp, tmp1)) {
|
if (strcmp (tmp, tmp1)) {
|
||||||
cat_changed = TRUE;
|
cat_changed = TRUE;
|
||||||
|
|
||||||
if (!dialog->p->is_add)
|
if (!dialog->p->is_add) {
|
||||||
old_path = gtk_tree_model_get_path (dialog->p->model, dialog->p->iter);
|
mime_types_model_construct_iter (MIME_TYPES_MODEL (dialog->p->model),
|
||||||
|
MODEL_ENTRY (dialog->p->info), &iter);
|
||||||
|
old_path = gtk_tree_model_get_path (dialog->p->model, &iter);
|
||||||
|
}
|
||||||
|
|
||||||
mime_type_info_set_category_name (dialog->p->info, tmp1);
|
mime_type_info_set_category_name (dialog->p->info, tmp1);
|
||||||
}
|
}
|
||||||
|
@ -611,7 +608,10 @@ store_data (MimeEditDialog *dialog)
|
||||||
ext_list = collect_filename_extensions (dialog);
|
ext_list = collect_filename_extensions (dialog);
|
||||||
mime_type_info_set_file_extensions (dialog->p->info, ext_list);
|
mime_type_info_set_file_extensions (dialog->p->info, ext_list);
|
||||||
|
|
||||||
mime_type_append_to_dirty_list (dialog->p->info);
|
model_entry_append_to_dirty_list (MODEL_ENTRY (dialog->p->info));
|
||||||
|
|
||||||
|
mime_types_model_construct_iter (MIME_TYPES_MODEL (dialog->p->model),
|
||||||
|
MODEL_ENTRY (dialog->p->info), &iter);
|
||||||
|
|
||||||
if (cat_changed) {
|
if (cat_changed) {
|
||||||
if (old_path != NULL) {
|
if (old_path != NULL) {
|
||||||
|
@ -619,18 +619,12 @@ store_data (MimeEditDialog *dialog)
|
||||||
gtk_tree_path_free (old_path);
|
gtk_tree_path_free (old_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dialog->p->iter == NULL) {
|
path = gtk_tree_model_get_path (dialog->p->model, &iter);
|
||||||
dialog->p->iter = g_new0 (GtkTreeIter, 1);
|
gtk_tree_model_row_inserted (dialog->p->model, path, &iter);
|
||||||
mime_types_model_construct_iter (MIME_TYPES_MODEL (dialog->p->model),
|
|
||||||
MODEL_ENTRY (dialog->p->info), dialog->p->iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
path = gtk_tree_model_get_path (dialog->p->model, dialog->p->iter);
|
|
||||||
gtk_tree_model_row_inserted (dialog->p->model, path, dialog->p->iter);
|
|
||||||
gtk_tree_path_free (path);
|
gtk_tree_path_free (path);
|
||||||
} else {
|
} else {
|
||||||
path = gtk_tree_model_get_path (dialog->p->model, dialog->p->iter);
|
path = gtk_tree_model_get_path (dialog->p->model, &iter);
|
||||||
gtk_tree_model_row_changed (dialog->p->model, path, dialog->p->iter);
|
gtk_tree_model_row_changed (dialog->p->model, path, &iter);
|
||||||
gtk_tree_path_free (path);
|
gtk_tree_path_free (path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct _MimeEditDialogClass
|
||||||
GType mime_edit_dialog_get_type (void);
|
GType mime_edit_dialog_get_type (void);
|
||||||
|
|
||||||
GObject *mime_edit_dialog_new (GtkTreeModel *model,
|
GObject *mime_edit_dialog_new (GtkTreeModel *model,
|
||||||
GtkTreeIter *iter);
|
MimeTypeInfo *info);
|
||||||
GObject *mime_add_dialog_new (GtkTreeModel *model);
|
GObject *mime_add_dialog_new (GtkTreeModel *model);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -38,10 +38,6 @@
|
||||||
#include "mime-type-info.h"
|
#include "mime-type-info.h"
|
||||||
#include "mime-types-model.h"
|
#include "mime-types-model.h"
|
||||||
|
|
||||||
/* List of MimeTypeInfo structures that have data to be committed */
|
|
||||||
|
|
||||||
static GList *dirty_list = NULL;
|
|
||||||
|
|
||||||
static const gchar *get_category_name (const gchar *mime_type);
|
static const gchar *get_category_name (const gchar *mime_type);
|
||||||
static GSList *get_lang_list (void);
|
static GSList *get_lang_list (void);
|
||||||
static gchar *form_extensions_string (const MimeTypeInfo *info,
|
static gchar *form_extensions_string (const MimeTypeInfo *info,
|
||||||
|
@ -51,7 +47,7 @@ static void get_icon_pixbuf (MimeTypeInfo *info,
|
||||||
const gchar *icon_path,
|
const gchar *icon_path,
|
||||||
gboolean want_large);
|
gboolean want_large);
|
||||||
|
|
||||||
static MimeTypeInfo *get_category (const gchar *category_name);
|
static MimeCategoryInfo *get_category (const gchar *category_name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,23 +83,6 @@ mime_type_info_new (const gchar *mime_type)
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
MimeTypeInfo *
|
|
||||||
mime_type_info_new_category (MimeTypeInfo *parent, const gchar *category)
|
|
||||||
{
|
|
||||||
MimeTypeInfo *info;
|
|
||||||
|
|
||||||
info = g_new0 (MimeTypeInfo, 1);
|
|
||||||
MODEL_ENTRY (info)->type = MODEL_ENTRY_CATEGORY;
|
|
||||||
|
|
||||||
info->description = g_strdup (category);
|
|
||||||
MODEL_ENTRY (info)->parent = MODEL_ENTRY (parent);
|
|
||||||
|
|
||||||
if (parent != NULL)
|
|
||||||
model_entry_insert_child (MODEL_ENTRY (parent), MODEL_ENTRY (info));
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fill in the remaining fields in a MimeTypeInfo structure; suitable for
|
/* Fill in the remaining fields in a MimeTypeInfo structure; suitable for
|
||||||
* subsequent use in an edit dialog */
|
* subsequent use in an edit dialog */
|
||||||
|
|
||||||
|
@ -233,7 +212,7 @@ mime_type_info_get_category_name (const MimeTypeInfo *info)
|
||||||
tmp = info->entry.parent;
|
tmp = info->entry.parent;
|
||||||
|
|
||||||
for (; tmp != NULL && tmp->type != MODEL_ENTRY_NONE; tmp = tmp->parent) {
|
for (; tmp != NULL && tmp->type != MODEL_ENTRY_NONE; tmp = tmp->parent) {
|
||||||
g_string_prepend (string, MIME_TYPE_INFO (tmp)->description);
|
g_string_prepend (string, MIME_CATEGORY_INFO (tmp)->name);
|
||||||
g_string_prepend (string, "/");
|
g_string_prepend (string, "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,12 +221,6 @@ mime_type_info_get_category_name (const MimeTypeInfo *info)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
GList *
|
|
||||||
mime_type_info_category_find_supported_apps (MimeTypeInfo *info)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mime_type_info_set_category_name (const MimeTypeInfo *info, const gchar *category_name)
|
mime_type_info_set_category_name (const MimeTypeInfo *info, const gchar *category_name)
|
||||||
{
|
{
|
||||||
|
@ -321,8 +294,6 @@ mime_type_info_save (const MimeTypeInfo *info)
|
||||||
void
|
void
|
||||||
mime_type_info_free (MimeTypeInfo *info)
|
mime_type_info_free (MimeTypeInfo *info)
|
||||||
{
|
{
|
||||||
dirty_list = g_list_remove (dirty_list, info);
|
|
||||||
|
|
||||||
g_free (info->mime_type);
|
g_free (info->mime_type);
|
||||||
g_free (info->description);
|
g_free (info->description);
|
||||||
g_free (info->icon_name);
|
g_free (info->icon_name);
|
||||||
|
@ -340,6 +311,120 @@ mime_type_info_free (MimeTypeInfo *info)
|
||||||
g_free (info);
|
g_free (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MimeCategoryInfo *
|
||||||
|
mime_category_info_new (MimeCategoryInfo *parent, const gchar *name)
|
||||||
|
{
|
||||||
|
MimeCategoryInfo *info;
|
||||||
|
|
||||||
|
info = g_new0 (MimeCategoryInfo, 1);
|
||||||
|
MODEL_ENTRY (info)->type = MODEL_ENTRY_CATEGORY;
|
||||||
|
|
||||||
|
info->name = g_strdup (name);
|
||||||
|
|
||||||
|
if (parent != NULL)
|
||||||
|
MODEL_ENTRY (info)->parent = MODEL_ENTRY (parent);
|
||||||
|
else
|
||||||
|
MODEL_ENTRY (info)->parent = get_model_entries ();
|
||||||
|
|
||||||
|
model_entry_insert_child (MODEL_ENTRY (info)->parent, MODEL_ENTRY (info));
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mime_category_info_load_all (MimeCategoryInfo *category)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mime_category_info_save (MimeCategoryInfo *category)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static GList *
|
||||||
|
find_possible_supported_apps (ModelEntry *entry)
|
||||||
|
{
|
||||||
|
GList *ret;
|
||||||
|
ModelEntry *tmp;
|
||||||
|
|
||||||
|
if (entry == NULL) return NULL;
|
||||||
|
|
||||||
|
switch (entry->type) {
|
||||||
|
case MODEL_ENTRY_CATEGORY:
|
||||||
|
for (tmp = entry->first_child; tmp != NULL; tmp = tmp->next) {
|
||||||
|
ret = find_possible_supported_apps (tmp);
|
||||||
|
|
||||||
|
if (ret != NULL)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
case MODEL_ENTRY_MIME_TYPE:
|
||||||
|
return gnome_vfs_application_registry_get_applications (MIME_TYPE_INFO (entry)->mime_type);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static GList *
|
||||||
|
intersect_lists (GList *list, GList *list1)
|
||||||
|
{
|
||||||
|
GList *tmp, *tmp1, *tmpnext;
|
||||||
|
|
||||||
|
tmp = list;
|
||||||
|
|
||||||
|
while (tmp != NULL) {
|
||||||
|
tmpnext = tmp->next;
|
||||||
|
|
||||||
|
for (tmp1 = list1; tmp1 != NULL; tmp1 = tmp1->next)
|
||||||
|
if (!strcmp (tmp->data, tmp1->data))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (tmp1 == NULL)
|
||||||
|
list = g_list_remove_link (list, tmp);
|
||||||
|
|
||||||
|
tmp = tmpnext;
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GList *
|
||||||
|
reduce_supported_app_list (ModelEntry *entry, GList *list)
|
||||||
|
{
|
||||||
|
GList *type_list;
|
||||||
|
ModelEntry *tmp;
|
||||||
|
|
||||||
|
switch (entry->type) {
|
||||||
|
case MODEL_ENTRY_CATEGORY:
|
||||||
|
for (tmp = entry->first_child; tmp != NULL; tmp = tmp->next)
|
||||||
|
list = reduce_supported_app_list (tmp, list);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MODEL_ENTRY_MIME_TYPE:
|
||||||
|
type_list = gnome_vfs_application_registry_get_applications (MIME_TYPE_INFO (entry)->mime_type);
|
||||||
|
list = intersect_lists (list, type_list);
|
||||||
|
g_list_free (type_list);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
GList *
|
||||||
|
mime_category_info_find_apps (MimeCategoryInfo *info)
|
||||||
|
{
|
||||||
|
GList *ret;
|
||||||
|
|
||||||
|
ret = find_possible_supported_apps (MODEL_ENTRY (info));
|
||||||
|
return reduce_supported_app_list (MODEL_ENTRY (info), ret);
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
mime_type_get_pretty_name_for_server (Bonobo_ServerInfo *server)
|
mime_type_get_pretty_name_for_server (Bonobo_ServerInfo *server)
|
||||||
{
|
{
|
||||||
|
@ -376,34 +461,6 @@ mime_type_get_pretty_name_for_server (Bonobo_ServerInfo *server)
|
||||||
return g_strdup_printf ("View as %s", view_as_name);
|
return g_strdup_printf ("View as %s", view_as_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
mime_type_append_to_dirty_list (MimeTypeInfo *info)
|
|
||||||
{
|
|
||||||
if (g_list_find (dirty_list, info) == NULL)
|
|
||||||
dirty_list = g_list_prepend (dirty_list, info);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
mime_type_remove_from_dirty_list (const gchar *mime_type)
|
|
||||||
{
|
|
||||||
GList *tmp = dirty_list, *tmp1;
|
|
||||||
|
|
||||||
while (tmp != NULL) {
|
|
||||||
tmp1 = tmp->next;
|
|
||||||
if (!strcmp (mime_type, ((MimeTypeInfo *) tmp->data)->mime_type))
|
|
||||||
dirty_list = g_list_remove_link (dirty_list, tmp);
|
|
||||||
tmp = tmp1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
mime_type_commit_dirty_list (void)
|
|
||||||
{
|
|
||||||
gnome_vfs_mime_freeze ();
|
|
||||||
g_list_foreach (dirty_list, (GFunc) mime_type_info_save, NULL);
|
|
||||||
gnome_vfs_mime_thaw ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static const gchar *
|
static const gchar *
|
||||||
|
@ -509,7 +566,7 @@ get_icon_pixbuf (MimeTypeInfo *info, const gchar *icon_path, gboolean want_large
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static MimeTypeInfo *
|
static MimeCategoryInfo *
|
||||||
get_category (const gchar *category_name)
|
get_category (const gchar *category_name)
|
||||||
{
|
{
|
||||||
ModelEntry *current, *child;
|
ModelEntry *current, *child;
|
||||||
|
@ -528,17 +585,17 @@ get_category (const gchar *category_name)
|
||||||
if (child->type != MODEL_ENTRY_CATEGORY)
|
if (child->type != MODEL_ENTRY_CATEGORY)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!strcmp (MIME_TYPE_INFO (child)->description, categories[i]))
|
if (!strcmp (MIME_CATEGORY_INFO (child)->name, categories[i]))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child == NULL)
|
if (child == NULL)
|
||||||
child = MODEL_ENTRY (mime_type_info_new_category (MIME_TYPE_INFO (current), categories[i]));
|
child = MODEL_ENTRY (mime_category_info_new (MIME_CATEGORY_INFO (current), categories[i]));
|
||||||
|
|
||||||
current = child;
|
current = child;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev (categories);
|
g_strfreev (categories);
|
||||||
|
|
||||||
return MIME_TYPE_INFO (current);
|
return MIME_CATEGORY_INFO (current);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,10 @@
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define MIME_TYPE_INFO(obj) ((MimeTypeInfo *) obj)
|
#define MIME_TYPE_INFO(obj) ((MimeTypeInfo *) obj)
|
||||||
|
#define MIME_CATEGORY_INFO(obj) ((MimeCategoryInfo *) obj)
|
||||||
|
|
||||||
typedef struct _MimeTypeInfo MimeTypeInfo;
|
typedef struct _MimeTypeInfo MimeTypeInfo;
|
||||||
|
typedef struct _MimeCategoryInfo MimeCategoryInfo;
|
||||||
|
|
||||||
struct _MimeTypeInfo
|
struct _MimeTypeInfo
|
||||||
{
|
{
|
||||||
|
@ -57,11 +59,19 @@ struct _MimeTypeInfo
|
||||||
gboolean needs_terminal;
|
gboolean needs_terminal;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _MimeCategoryInfo
|
||||||
|
{
|
||||||
|
ModelEntry entry;
|
||||||
|
|
||||||
|
gchar *name;
|
||||||
|
GnomeVFSMimeApplication *default_action;
|
||||||
|
gchar *custom_line;
|
||||||
|
gboolean needs_terminal;
|
||||||
|
};
|
||||||
|
|
||||||
void load_all_mime_types (void);
|
void load_all_mime_types (void);
|
||||||
|
|
||||||
MimeTypeInfo *mime_type_info_new (const gchar *mime_type);
|
MimeTypeInfo *mime_type_info_new (const gchar *mime_type);
|
||||||
MimeTypeInfo *mime_type_info_new_category (MimeTypeInfo *parent,
|
|
||||||
const gchar *category);
|
|
||||||
|
|
||||||
void mime_type_info_load_all (MimeTypeInfo *info);
|
void mime_type_info_load_all (MimeTypeInfo *info);
|
||||||
const gchar *mime_type_info_get_description (MimeTypeInfo *info);
|
const gchar *mime_type_info_get_description (MimeTypeInfo *info);
|
||||||
|
@ -76,19 +86,18 @@ gchar *mime_type_info_get_file_extensions_pretty_string
|
||||||
(MimeTypeInfo *info);
|
(MimeTypeInfo *info);
|
||||||
gchar *mime_type_info_get_category_name (const MimeTypeInfo *info);
|
gchar *mime_type_info_get_category_name (const MimeTypeInfo *info);
|
||||||
|
|
||||||
GList *mime_type_info_category_find_supported_apps
|
|
||||||
(MimeTypeInfo *info);
|
|
||||||
|
|
||||||
void mime_type_info_set_category_name (const MimeTypeInfo *info,
|
void mime_type_info_set_category_name (const MimeTypeInfo *info,
|
||||||
const gchar *category_name);
|
const gchar *category_name);
|
||||||
void mime_type_info_set_file_extensions (MimeTypeInfo *info,
|
void mime_type_info_set_file_extensions (MimeTypeInfo *info,
|
||||||
GList *list);
|
GList *list);
|
||||||
|
|
||||||
gchar *mime_type_get_pretty_name_for_server (Bonobo_ServerInfo *server);
|
MimeCategoryInfo *mime_category_info_new (MimeCategoryInfo *parent,
|
||||||
|
const gchar *name);
|
||||||
|
void mime_category_info_load_all (MimeCategoryInfo *category);
|
||||||
|
void mime_category_info_save (MimeCategoryInfo *category);
|
||||||
|
GList *mime_category_info_find_apps (MimeCategoryInfo *info);
|
||||||
|
|
||||||
void mime_type_append_to_dirty_list (MimeTypeInfo *info);
|
gchar *mime_type_get_pretty_name_for_server (Bonobo_ServerInfo *server);
|
||||||
void mime_type_remove_from_dirty_list (const gchar *mime_type);
|
|
||||||
void mime_type_commit_dirty_list (void);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -405,10 +405,13 @@ mime_types_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, gint co
|
||||||
|
|
||||||
switch (entry->type) {
|
switch (entry->type) {
|
||||||
case MODEL_ENTRY_MIME_TYPE:
|
case MODEL_ENTRY_MIME_TYPE:
|
||||||
case MODEL_ENTRY_CATEGORY:
|
|
||||||
g_value_set_static_string (value, mime_type_info_get_description (MIME_TYPE_INFO (entry)));
|
g_value_set_static_string (value, mime_type_info_get_description (MIME_TYPE_INFO (entry)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MODEL_ENTRY_CATEGORY:
|
||||||
|
g_value_set_static_string (value, MIME_CATEGORY_INFO (entry)->name);
|
||||||
|
break;
|
||||||
|
|
||||||
case MODEL_ENTRY_SERVICE:
|
case MODEL_ENTRY_SERVICE:
|
||||||
g_value_set_static_string (value, service_info_get_description (SERVICE_INFO (entry)));
|
g_value_set_static_string (value, service_info_get_description (SERVICE_INFO (entry)));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -30,6 +30,10 @@
|
||||||
#include "mime-type-info.h"
|
#include "mime-type-info.h"
|
||||||
#include "service-info.h"
|
#include "service-info.h"
|
||||||
|
|
||||||
|
/* List of MimeTypeInfo structures that have data to be committed */
|
||||||
|
|
||||||
|
static GList *dirty_list = NULL;
|
||||||
|
|
||||||
ModelEntry *
|
ModelEntry *
|
||||||
get_model_entries (void)
|
get_model_entries (void)
|
||||||
{
|
{
|
||||||
|
@ -125,3 +129,44 @@ model_entry_remove_child (ModelEntry *entry, ModelEntry *child)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
model_entry_save (ModelEntry *entry)
|
||||||
|
{
|
||||||
|
switch (entry->type) {
|
||||||
|
case MODEL_ENTRY_MIME_TYPE:
|
||||||
|
mime_type_info_save (MIME_TYPE_INFO (entry));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MODEL_ENTRY_SERVICE:
|
||||||
|
service_info_save (SERVICE_INFO (entry));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MODEL_ENTRY_CATEGORY:
|
||||||
|
mime_category_info_save (MIME_CATEGORY_INFO (entry));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
model_entry_append_to_dirty_list (ModelEntry *entry)
|
||||||
|
{
|
||||||
|
if (g_list_find (dirty_list, entry) == NULL)
|
||||||
|
dirty_list = g_list_prepend (dirty_list, entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
model_entry_remove_from_dirty_list (ModelEntry *entry)
|
||||||
|
{
|
||||||
|
dirty_list = g_list_remove (dirty_list, entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
model_entry_commit_dirty_list (void)
|
||||||
|
{
|
||||||
|
gnome_vfs_mime_freeze ();
|
||||||
|
g_list_foreach (dirty_list, (GFunc) model_entry_save, NULL);
|
||||||
|
gnome_vfs_mime_thaw ();
|
||||||
|
}
|
||||||
|
|
|
@ -61,6 +61,12 @@ void model_entry_insert_child (ModelEntry *entry,
|
||||||
void model_entry_remove_child (ModelEntry *entry,
|
void model_entry_remove_child (ModelEntry *entry,
|
||||||
ModelEntry *child);
|
ModelEntry *child);
|
||||||
|
|
||||||
|
void model_entry_save (ModelEntry *entry);
|
||||||
|
|
||||||
|
void model_entry_append_to_dirty_list (ModelEntry *entry);
|
||||||
|
void model_entry_remove_from_dirty_list (ModelEntry *entry);
|
||||||
|
void model_entry_commit_dirty_list (void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __MODEL_ENTRY_H */
|
#endif /* __MODEL_ENTRY_H */
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <glade/glade.h>
|
#include <glade/glade.h>
|
||||||
|
#include <gconf/gconf-client.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "service-edit-dialog.h"
|
#include "service-edit-dialog.h"
|
||||||
#include "mime-types-model.h"
|
#include "mime-types-model.h"
|
||||||
|
@ -35,7 +37,8 @@
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_MODEL,
|
PROP_MODEL,
|
||||||
PROP_ITER
|
PROP_INFO,
|
||||||
|
PROP_IS_ADD
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _ServiceEditDialogPrivate
|
struct _ServiceEditDialogPrivate
|
||||||
|
@ -43,9 +46,9 @@ struct _ServiceEditDialogPrivate
|
||||||
ServiceInfo *info;
|
ServiceInfo *info;
|
||||||
GladeXML *dialog_xml;
|
GladeXML *dialog_xml;
|
||||||
GtkWidget *dialog_win;
|
GtkWidget *dialog_win;
|
||||||
|
gboolean is_add;
|
||||||
|
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GtkTreeIter *iter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static GObjectClass *parent_class;
|
static GObjectClass *parent_class;
|
||||||
|
@ -68,9 +71,12 @@ static void service_edit_dialog_dispose (GObject *object);
|
||||||
static void service_edit_dialog_finalize (GObject *object);
|
static void service_edit_dialog_finalize (GObject *object);
|
||||||
|
|
||||||
static void fill_dialog (ServiceEditDialog *dialog);
|
static void fill_dialog (ServiceEditDialog *dialog);
|
||||||
|
static void setup_add_dialog (ServiceEditDialog *dialog);
|
||||||
|
|
||||||
static void populate_app_list (ServiceEditDialog *dialog);
|
static void populate_app_list (ServiceEditDialog *dialog);
|
||||||
|
|
||||||
static void store_data (ServiceEditDialog *dialog);
|
static void store_data (ServiceEditDialog *dialog);
|
||||||
|
static gboolean validate_data (ServiceEditDialog *dialog);
|
||||||
|
|
||||||
static void program_sensitive_cb (ServiceEditDialog *dialog,
|
static void program_sensitive_cb (ServiceEditDialog *dialog,
|
||||||
GtkToggleButton *tb);
|
GtkToggleButton *tb);
|
||||||
|
@ -161,10 +167,18 @@ service_edit_dialog_class_init (ServiceEditDialogClass *class)
|
||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class, PROP_ITER,
|
(object_class, PROP_INFO,
|
||||||
g_param_spec_pointer ("iterator",
|
g_param_spec_pointer ("service-info",
|
||||||
_("Iterator"),
|
_("Service info"),
|
||||||
_("Iterator"),
|
_("Structure containing service information"),
|
||||||
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
|
g_object_class_install_property
|
||||||
|
(object_class, PROP_IS_ADD,
|
||||||
|
g_param_spec_boolean ("is-add",
|
||||||
|
_("Is add"),
|
||||||
|
_("TRUE if this is an add service dialog"),
|
||||||
|
FALSE,
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
parent_class = G_OBJECT_CLASS
|
parent_class = G_OBJECT_CLASS
|
||||||
|
@ -186,10 +200,24 @@ service_edit_dialog_set_prop (GObject *object, guint prop_id, const GValue *valu
|
||||||
dialog->p->model = GTK_TREE_MODEL (g_value_get_object (value));
|
dialog->p->model = GTK_TREE_MODEL (g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ITER:
|
case PROP_INFO:
|
||||||
dialog->p->iter = gtk_tree_iter_copy (g_value_get_pointer (value));
|
if (g_value_get_pointer (value) != NULL) {
|
||||||
dialog->p->info = SERVICE_INFO (MODEL_ENTRY_FROM_ITER (dialog->p->iter));
|
dialog->p->info = g_value_get_pointer (value);
|
||||||
fill_dialog (dialog);
|
fill_dialog (dialog);
|
||||||
|
gtk_widget_show_all (dialog->p->dialog_win);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_IS_ADD:
|
||||||
|
dialog->p->is_add = g_value_get_boolean (value);
|
||||||
|
|
||||||
|
if (dialog->p->is_add) {
|
||||||
|
dialog->p->info = service_info_new (NULL);
|
||||||
|
setup_add_dialog (dialog);
|
||||||
|
gtk_widget_show_all (dialog->p->dialog_win);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -213,8 +241,12 @@ service_edit_dialog_get_prop (GObject *object, guint prop_id, GValue *value, GPa
|
||||||
g_value_set_object (value, G_OBJECT (dialog->p->model));
|
g_value_set_object (value, G_OBJECT (dialog->p->model));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ITER:
|
case PROP_INFO:
|
||||||
g_value_set_pointer (value, dialog->p->iter);
|
g_value_set_pointer (value, dialog->p->info);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_IS_ADD:
|
||||||
|
g_value_set_boolean (value, dialog->p->is_add);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -256,18 +288,26 @@ service_edit_dialog_finalize (GObject *object)
|
||||||
|
|
||||||
service_edit_dialog = SERVICE_EDIT_DIALOG (object);
|
service_edit_dialog = SERVICE_EDIT_DIALOG (object);
|
||||||
|
|
||||||
gtk_tree_iter_free (service_edit_dialog->p->iter);
|
|
||||||
g_free (service_edit_dialog->p);
|
g_free (service_edit_dialog->p);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
GObject *
|
GObject *
|
||||||
service_edit_dialog_new (GtkTreeModel *model, GtkTreeIter *iter)
|
service_edit_dialog_new (GtkTreeModel *model, ServiceInfo *info)
|
||||||
{
|
{
|
||||||
return g_object_new (service_edit_dialog_get_type (),
|
return g_object_new (service_edit_dialog_get_type (),
|
||||||
"model", model,
|
"model", model,
|
||||||
"iterator", iter,
|
"service-info", info,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
GObject *
|
||||||
|
service_add_dialog_new (GtkTreeModel *model)
|
||||||
|
{
|
||||||
|
return g_object_new (service_edit_dialog_get_type (),
|
||||||
|
"model", model,
|
||||||
|
"is-add", TRUE,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,8 +335,22 @@ fill_dialog (ServiceEditDialog *dialog)
|
||||||
gnome_file_entry_set_filename (GNOME_FILE_ENTRY (WID ("custom_program_entry")), dialog->p->info->custom_line);
|
gnome_file_entry_set_filename (GNOME_FILE_ENTRY (WID ("custom_program_entry")), dialog->p->info->custom_line);
|
||||||
|
|
||||||
populate_app_list (dialog);
|
populate_app_list (dialog);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_widget_show_all (dialog->p->dialog_win);
|
static void
|
||||||
|
setup_add_dialog (ServiceEditDialog *dialog)
|
||||||
|
{
|
||||||
|
GtkWidget *menu, *item;
|
||||||
|
|
||||||
|
item = gtk_menu_item_new_with_label (_("Custom"));
|
||||||
|
menu = gtk_menu_new ();
|
||||||
|
gtk_menu_append (GTK_MENU (menu), item);
|
||||||
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (WID ("program_select")), menu);
|
||||||
|
|
||||||
|
gtk_widget_set_sensitive (WID ("program_select"), FALSE);
|
||||||
|
|
||||||
|
gtk_widget_set_sensitive (WID ("look_at_content_toggle"), FALSE);
|
||||||
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("run_program_toggle")), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -341,6 +395,10 @@ store_data (ServiceEditDialog *dialog)
|
||||||
gint idx;
|
gint idx;
|
||||||
|
|
||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
if (dialog->p->is_add)
|
||||||
|
dialog->p->info->protocol = g_strdup (gtk_entry_get_text (GTK_ENTRY (WID ("protocol_entry"))));
|
||||||
|
|
||||||
g_free (dialog->p->info->description);
|
g_free (dialog->p->info->description);
|
||||||
dialog->p->info->description = g_strdup (gtk_entry_get_text (GTK_ENTRY (WID ("description_entry"))));
|
dialog->p->info->description = g_strdup (gtk_entry_get_text (GTK_ENTRY (WID ("description_entry"))));
|
||||||
|
@ -361,11 +419,68 @@ store_data (ServiceEditDialog *dialog)
|
||||||
dialog->p->info->app =
|
dialog->p->info->app =
|
||||||
gnome_vfs_mime_application_copy (g_object_get_data (menu_item, "app"));
|
gnome_vfs_mime_application_copy (g_object_get_data (menu_item, "app"));
|
||||||
|
|
||||||
service_info_save (dialog->p->info);
|
model_entry_append_to_dirty_list (MODEL_ENTRY (dialog->p->info));
|
||||||
|
|
||||||
path = gtk_tree_model_get_path (dialog->p->model, dialog->p->iter);
|
mime_types_model_construct_iter (MIME_TYPES_MODEL (dialog->p->model),
|
||||||
gtk_tree_model_row_changed (dialog->p->model, path, dialog->p->iter);
|
MODEL_ENTRY (dialog->p->info), &iter);
|
||||||
|
|
||||||
|
if (dialog->p->is_add) {
|
||||||
|
path = gtk_tree_model_get_path (dialog->p->model, &iter);
|
||||||
|
gtk_tree_model_row_inserted (dialog->p->model, path, &iter);
|
||||||
gtk_tree_path_free (path);
|
gtk_tree_path_free (path);
|
||||||
|
} else {
|
||||||
|
path = gtk_tree_model_get_path (dialog->p->model, &iter);
|
||||||
|
gtk_tree_model_row_changed (dialog->p->model, path, &iter);
|
||||||
|
gtk_tree_path_free (path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
validate_data (ServiceEditDialog *dialog)
|
||||||
|
{
|
||||||
|
const gchar *tmp, *tmp1;
|
||||||
|
gchar *dir;
|
||||||
|
GtkWidget *err_dialog;
|
||||||
|
|
||||||
|
tmp = gtk_entry_get_text (GTK_ENTRY (WID ("protocol_entry")));
|
||||||
|
|
||||||
|
if (tmp == NULL || *tmp == '\0') {
|
||||||
|
err_dialog = gnome_error_dialog_parented
|
||||||
|
(_("Please enter a protocol name."),
|
||||||
|
GTK_WINDOW (dialog->p->dialog_win));
|
||||||
|
|
||||||
|
gtk_window_set_modal (GTK_WINDOW (err_dialog), TRUE);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
for (tmp1 = tmp; *tmp1 != '\0' && isalnum (*tmp1); tmp1++);
|
||||||
|
|
||||||
|
if (*tmp1 != '\0') {
|
||||||
|
err_dialog = gnome_error_dialog_parented
|
||||||
|
(_("Invalid protocol name. Please enter a protocol name without any spaces or punctuation."),
|
||||||
|
GTK_WINDOW (dialog->p->dialog_win));
|
||||||
|
|
||||||
|
gtk_window_set_modal (GTK_WINDOW (err_dialog), TRUE);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dialog->p->is_add) {
|
||||||
|
dir = g_strconcat ("/desktop/gnome/url-handlers/", tmp, NULL);
|
||||||
|
if (gconf_client_dir_exists (gconf_client_get_default (), dir, NULL)) {
|
||||||
|
err_dialog = gnome_error_dialog_parented
|
||||||
|
(_("There is already a protocol by that name."),
|
||||||
|
GTK_WINDOW (dialog->p->dialog_win));
|
||||||
|
|
||||||
|
gtk_window_set_modal (GTK_WINDOW (err_dialog), TRUE);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
g_free (dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -399,8 +514,12 @@ program_changed_cb (ServiceEditDialog *dialog, GtkOptionMenu *option_menu)
|
||||||
static void
|
static void
|
||||||
response_cb (ServiceEditDialog *dialog, gint response_id)
|
response_cb (ServiceEditDialog *dialog, gint response_id)
|
||||||
{
|
{
|
||||||
if (response_id == GTK_RESPONSE_OK)
|
if (response_id == GTK_RESPONSE_OK) {
|
||||||
|
if (validate_data (dialog)) {
|
||||||
store_data (dialog);
|
store_data (dialog);
|
||||||
|
|
||||||
g_object_unref (G_OBJECT (dialog));
|
g_object_unref (G_OBJECT (dialog));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
g_object_unref (G_OBJECT (dialog));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -53,7 +53,8 @@ struct _ServiceEditDialogClass
|
||||||
GType service_edit_dialog_get_type (void);
|
GType service_edit_dialog_get_type (void);
|
||||||
|
|
||||||
GObject *service_edit_dialog_new (GtkTreeModel *model,
|
GObject *service_edit_dialog_new (GtkTreeModel *model,
|
||||||
GtkTreeIter *iter);
|
ServiceInfo *info);
|
||||||
|
GObject *service_add_dialog_new (GtkTreeModel *model);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ load_all_services (void)
|
||||||
if (protocol_name == NULL)
|
if (protocol_name == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
service_info_new (protocol_name, NULL);
|
service_info_new (protocol_name);
|
||||||
|
|
||||||
g_free (tmp->data);
|
g_free (tmp->data);
|
||||||
}
|
}
|
||||||
|
@ -92,13 +92,14 @@ load_all_services (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
ServiceInfo *
|
ServiceInfo *
|
||||||
service_info_new (const gchar *protocol, GConfChangeSet *changeset)
|
service_info_new (const gchar *protocol)
|
||||||
{
|
{
|
||||||
ServiceInfo *info;
|
ServiceInfo *info;
|
||||||
|
|
||||||
info = g_new0 (ServiceInfo, 1);
|
info = g_new0 (ServiceInfo, 1);
|
||||||
|
|
||||||
|
if (protocol != NULL)
|
||||||
info->protocol = g_strdup (protocol);
|
info->protocol = g_strdup (protocol);
|
||||||
info->changeset = changeset;
|
|
||||||
|
|
||||||
info->entry.type = MODEL_ENTRY_SERVICE;
|
info->entry.type = MODEL_ENTRY_SERVICE;
|
||||||
info->entry.parent = MODEL_ENTRY (get_services_category_entry ());
|
info->entry.parent = MODEL_ENTRY (get_services_category_entry ());
|
||||||
|
@ -148,12 +149,6 @@ service_info_get_description (ServiceInfo *info)
|
||||||
return info->description;
|
return info->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
service_info_set_changeset (ServiceInfo *info, GConfChangeSet *changeset)
|
|
||||||
{
|
|
||||||
info->changeset = changeset;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
service_info_save (const ServiceInfo *info)
|
service_info_save (const ServiceInfo *info)
|
||||||
{
|
{
|
||||||
|
@ -240,12 +235,7 @@ set_string (const ServiceInfo *info, gchar *end, gchar *value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
key = get_key_name (info, end);
|
key = get_key_name (info, end);
|
||||||
|
|
||||||
if (info->changeset != NULL)
|
|
||||||
gconf_change_set_set_string (info->changeset, key, value);
|
|
||||||
else
|
|
||||||
gconf_client_set_string (gconf_client_get_default (), key, value, NULL);
|
gconf_client_set_string (gconf_client_get_default (), key, value, NULL);
|
||||||
|
|
||||||
g_free (key);
|
g_free (key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,12 +245,7 @@ set_bool (const ServiceInfo *info, gchar *end, gboolean value)
|
||||||
gchar *key;
|
gchar *key;
|
||||||
|
|
||||||
key = get_key_name (info, end);
|
key = get_key_name (info, end);
|
||||||
|
|
||||||
if (info->changeset != NULL)
|
|
||||||
gconf_change_set_set_bool (info->changeset, key, value);
|
|
||||||
else
|
|
||||||
gconf_client_set_bool (gconf_client_get_default (), key, value, NULL);
|
gconf_client_set_bool (gconf_client_get_default (), key, value, NULL);
|
||||||
|
|
||||||
g_free (key);
|
g_free (key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,21 +253,9 @@ static gchar *
|
||||||
get_string (ServiceInfo *info, const gchar *end)
|
get_string (ServiceInfo *info, const gchar *end)
|
||||||
{
|
{
|
||||||
gchar *key, *ret;
|
gchar *key, *ret;
|
||||||
GConfValue *value;
|
|
||||||
gboolean found = FALSE;
|
|
||||||
|
|
||||||
key = get_key_name (info, end);
|
key = get_key_name (info, end);
|
||||||
|
|
||||||
if (info->changeset != NULL)
|
|
||||||
found = gconf_change_set_check_value (info->changeset, key, &value);
|
|
||||||
|
|
||||||
if (!found || info->changeset == NULL) {
|
|
||||||
ret = gconf_client_get_string (gconf_client_get_default (), key, NULL);
|
ret = gconf_client_get_string (gconf_client_get_default (), key, NULL);
|
||||||
} else {
|
|
||||||
ret = g_strdup (gconf_value_get_string (value));
|
|
||||||
gconf_value_free (value);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (key);
|
g_free (key);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -293,21 +266,9 @@ get_bool (const ServiceInfo *info, gchar *end)
|
||||||
{
|
{
|
||||||
gchar *key;
|
gchar *key;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
GConfValue *value;
|
|
||||||
gboolean found = FALSE;
|
|
||||||
|
|
||||||
key = get_key_name (info, end);
|
key = get_key_name (info, end);
|
||||||
|
|
||||||
if (info->changeset != NULL)
|
|
||||||
found = gconf_change_set_check_value (info->changeset, key, &value);
|
|
||||||
|
|
||||||
if (!found || info->changeset == NULL) {
|
|
||||||
ret = gconf_client_get_bool (gconf_client_get_default (), key, NULL);
|
ret = gconf_client_get_bool (gconf_client_get_default (), key, NULL);
|
||||||
} else {
|
|
||||||
ret = gconf_value_get_bool (value);
|
|
||||||
gconf_value_free (value);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (key);
|
g_free (key);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
#include <bonobo.h>
|
#include <bonobo.h>
|
||||||
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
|
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
|
||||||
#include <gconf/gconf-changeset.h>
|
|
||||||
|
|
||||||
#include "model-entry.h"
|
#include "model-entry.h"
|
||||||
|
|
||||||
|
@ -48,14 +47,11 @@ struct _ServiceInfo {
|
||||||
GnomeVFSMimeApplication *app;
|
GnomeVFSMimeApplication *app;
|
||||||
gchar *custom_line;
|
gchar *custom_line;
|
||||||
gboolean need_terminal;
|
gboolean need_terminal;
|
||||||
|
|
||||||
GConfChangeSet *changeset;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void load_all_services (void);
|
void load_all_services (void);
|
||||||
|
|
||||||
ServiceInfo *service_info_new (const gchar *protocol,
|
ServiceInfo *service_info_new (const gchar *protocol);
|
||||||
GConfChangeSet *changeset);
|
|
||||||
void service_info_load_all (ServiceInfo *info);
|
void service_info_load_all (ServiceInfo *info);
|
||||||
const gchar *service_info_get_description (ServiceInfo *info);
|
const gchar *service_info_get_description (ServiceInfo *info);
|
||||||
void service_info_save (const ServiceInfo *info);
|
void service_info_save (const ServiceInfo *info);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue