Reparent the iterator if necessary (mime_type_info_update): Don't call
2002-01-14 Bradford Hovinen <hovinen@ximian.com> * mime-type-info.c (mime_type_info_update): Reparent the iterator if necessary (mime_type_info_update): Don't call reinsert_model_entry * mime-types-model.c (insert_mime_type): Implement. Factor from mime_types_model_new
This commit is contained in:
parent
d6d5ff20d9
commit
09974bbcd7
4 changed files with 59 additions and 37 deletions
|
@ -1,5 +1,12 @@
|
||||||
2002-01-14 Bradford Hovinen <hovinen@ximian.com>
|
2002-01-14 Bradford Hovinen <hovinen@ximian.com>
|
||||||
|
|
||||||
|
* mime-type-info.c (mime_type_info_update): Reparent the iterator
|
||||||
|
if necessary
|
||||||
|
(mime_type_info_update): Don't call reinsert_model_entry
|
||||||
|
|
||||||
|
* mime-types-model.c (insert_mime_type): Implement. Factor from
|
||||||
|
mime_types_model_new
|
||||||
|
|
||||||
* mime-category-edit-dialog.c (populate_application_list):
|
* mime-category-edit-dialog.c (populate_application_list):
|
||||||
Implement. Mostly a copy from the corresponding function in
|
Implement. Mostly a copy from the corresponding function in
|
||||||
mime-edit-dialog.c
|
mime-edit-dialog.c
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
- When no apps/components are available, desensitize app/component list
|
- When no apps/components are available, desensitize app/component list
|
||||||
- Better sorting on the MIME types tree
|
- Better sorting on the MIME types tree
|
||||||
- Category selection
|
- Category selection
|
||||||
|
- Don't consider a mime type when generating category handler list if the mime type overrides the category default
|
||||||
|
- Implement override_category_default flag
|
||||||
|
|
||||||
CVS Surgery
|
CVS Surgery
|
||||||
- Move file-types to gnome-control-center, rename ???
|
- Move file-types to gnome-control-center, rename ???
|
||||||
|
|
|
@ -185,9 +185,6 @@ mime_type_info_save (const MimeTypeInfo *info)
|
||||||
tmp = form_extensions_string (info, " ", NULL);
|
tmp = form_extensions_string (info, " ", NULL);
|
||||||
gnome_vfs_mime_set_extensions_list (info->mime_type, tmp);
|
gnome_vfs_mime_set_extensions_list (info->mime_type, tmp);
|
||||||
g_free (tmp);
|
g_free (tmp);
|
||||||
|
|
||||||
if (strcmp (info->category, get_category_name (info->model, info->iter, FALSE)))
|
|
||||||
reinsert_model_entry (info->model, info->iter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -195,6 +192,17 @@ mime_type_info_update (MimeTypeInfo *info)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
gchar *tmp;
|
gchar *tmp;
|
||||||
|
GtkTreeIter parent;
|
||||||
|
|
||||||
|
tmp = get_category_name (info->model, info->iter, FALSE);
|
||||||
|
|
||||||
|
if (strcmp (info->category, tmp)) {
|
||||||
|
gtk_tree_store_remove (GTK_TREE_STORE (info->model), info->iter);
|
||||||
|
get_insertion_point (GTK_TREE_STORE (info->model), info->category, &parent);
|
||||||
|
gtk_tree_store_append (GTK_TREE_STORE (info->model), info->iter, &parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (tmp);
|
||||||
|
|
||||||
pixbuf = get_icon_pixbuf (info->icon_name);
|
pixbuf = get_icon_pixbuf (info->icon_name);
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,40 @@ get_protocol_name (const gchar *key)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
insert_mime_type (GtkTreeStore *model, const gchar *mime_type)
|
||||||
|
{
|
||||||
|
gchar *path_str;
|
||||||
|
const gchar *description;
|
||||||
|
const gchar *extensions;
|
||||||
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
|
GtkTreeIter iter;
|
||||||
|
GtkTreeIter child_iter;
|
||||||
|
|
||||||
|
path_str = get_category_path_for_mime_type (mime_type);
|
||||||
|
|
||||||
|
if (path_str != NULL) {
|
||||||
|
description = gnome_vfs_mime_get_description (mime_type);
|
||||||
|
extensions = gnome_vfs_mime_get_extensions_pretty_string (mime_type);
|
||||||
|
|
||||||
|
if (extensions == NULL || *extensions == '\0')
|
||||||
|
return;
|
||||||
|
|
||||||
|
pixbuf = get_icon_pixbuf (gnome_vfs_mime_get_icon (mime_type));
|
||||||
|
|
||||||
|
get_insertion_point (model, path_str, &iter);
|
||||||
|
|
||||||
|
gtk_tree_store_append (model, &child_iter, &iter);
|
||||||
|
gtk_tree_store_set (model, &child_iter,
|
||||||
|
ICON_COLUMN, pixbuf,
|
||||||
|
DESCRIPTION_COLUMN, description,
|
||||||
|
MIME_TYPE_COLUMN, mime_type,
|
||||||
|
EXTENSIONS_COLUMN, extensions,
|
||||||
|
-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GtkTreeModel *
|
GtkTreeModel *
|
||||||
mime_types_model_new (gboolean is_category_select)
|
mime_types_model_new (gboolean is_category_select)
|
||||||
{
|
{
|
||||||
|
@ -139,11 +173,6 @@ mime_types_model_new (gboolean is_category_select)
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GtkTreeIter child_iter;
|
GtkTreeIter child_iter;
|
||||||
gchar *mime_type;
|
|
||||||
gchar *path_str;
|
|
||||||
const gchar *description;
|
|
||||||
const gchar *extensions;
|
|
||||||
GdkPixbuf *pixbuf;
|
|
||||||
|
|
||||||
GSList *url_list;
|
GSList *url_list;
|
||||||
GSList *tmps;
|
GSList *tmps;
|
||||||
|
@ -161,30 +190,11 @@ mime_types_model_new (gboolean is_category_select)
|
||||||
gtk_tree_store_set (model, &iter, DESCRIPTION_COLUMN, categories[i], -1);
|
gtk_tree_store_set (model, &iter, DESCRIPTION_COLUMN, categories[i], -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; tmp != NULL; tmp = tmp->next) {
|
for (; tmp != NULL; tmp = tmp->next)
|
||||||
mime_type = tmp->data;
|
if (!is_category_select)
|
||||||
path_str = get_category_path_for_mime_type (mime_type);
|
insert_mime_type (model, tmp->data);
|
||||||
|
else
|
||||||
if (path_str != NULL && !is_category_select) {
|
get_category_path_for_mime_type (tmp->data);
|
||||||
description = gnome_vfs_mime_get_description (mime_type);
|
|
||||||
extensions = gnome_vfs_mime_get_extensions_pretty_string (mime_type);
|
|
||||||
|
|
||||||
if (extensions == NULL || *extensions == '\0')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pixbuf = get_icon_pixbuf (gnome_vfs_mime_get_icon (mime_type));
|
|
||||||
|
|
||||||
get_insertion_point (model, path_str, &iter);
|
|
||||||
|
|
||||||
gtk_tree_store_append (model, &child_iter, &iter);
|
|
||||||
gtk_tree_store_set (model, &child_iter,
|
|
||||||
ICON_COLUMN, pixbuf,
|
|
||||||
DESCRIPTION_COLUMN, description,
|
|
||||||
MIME_TYPE_COLUMN, mime_type,
|
|
||||||
EXTENSIONS_COLUMN, extensions,
|
|
||||||
-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_list_free (type_list);
|
g_list_free (type_list);
|
||||||
|
|
||||||
|
@ -222,11 +232,6 @@ mime_types_model_new (gboolean is_category_select)
|
||||||
return GTK_TREE_MODEL (model);
|
return GTK_TREE_MODEL (model);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
reinsert_model_entry (GtkTreeModel *model, GtkTreeIter *iter)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
GdkPixbuf *
|
GdkPixbuf *
|
||||||
get_icon_pixbuf (const gchar *short_icon_name)
|
get_icon_pixbuf (const gchar *short_icon_name)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue