Use asynchronous methods to generate thumbnails.
2007-05-13 Thomas Wood <thos@gnome.org> * appearance-themes.c: (themes_init), (theme_changed_func): Use asynchronous methods to generate thumbnails. svn path=/trunk/; revision=7610
This commit is contained in:
parent
55f1e82094
commit
a0e3a8b48d
2 changed files with 36 additions and 14 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2007-05-13 Thomas Wood <thos@gnome.org>
|
||||||
|
|
||||||
|
* appearance-themes.c: (themes_init), (theme_changed_func): Use asynchronous
|
||||||
|
methods to generate thumbnails.
|
||||||
|
|
||||||
2007-05-13 Jens Granseuer <jensgr@gmx.net>
|
2007-05-13 Jens Granseuer <jensgr@gmx.net>
|
||||||
|
|
||||||
* appearance-font.c: (cb_details_response), (cb_show_details):
|
* appearance-font.c: (cb_details_response), (cb_show_details):
|
||||||
|
|
|
@ -30,8 +30,14 @@ enum {
|
||||||
THEME_NAME_COLUMN,
|
THEME_NAME_COLUMN,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct theme_thumbnail_func_data {
|
||||||
|
GnomeThemeMetaInfo *info;
|
||||||
|
GtkListStore *store;
|
||||||
|
};
|
||||||
|
|
||||||
/* Theme functions */
|
/* Theme functions */
|
||||||
static void theme_changed_func (gpointer uri, AppearanceData *data);
|
static void theme_changed_func (gpointer uri, AppearanceData *data);
|
||||||
|
static void theme_thumbnail_func (GdkPixbuf *pixbuf, struct theme_thumbnail_func_data *data);
|
||||||
|
|
||||||
/* GUI Callbacks */
|
/* GUI Callbacks */
|
||||||
static void theme_custom_cb (GtkWidget *button, AppearanceData *data);
|
static void theme_custom_cb (GtkWidget *button, AppearanceData *data);
|
||||||
|
@ -45,7 +51,6 @@ themes_init (AppearanceData *data)
|
||||||
GtkWidget *w;
|
GtkWidget *w;
|
||||||
GList *theme_list, *l;
|
GList *theme_list, *l;
|
||||||
GtkListStore *theme_store;
|
GtkListStore *theme_store;
|
||||||
GtkTreeModel *sort_model;
|
|
||||||
|
|
||||||
/* initialise some stuff */
|
/* initialise some stuff */
|
||||||
gnome_theme_init (NULL);
|
gnome_theme_init (NULL);
|
||||||
|
@ -69,25 +74,22 @@ themes_init (AppearanceData *data)
|
||||||
gnome_theme_info_register_theme_change ((GFunc)theme_changed_func, data);
|
gnome_theme_info_register_theme_change ((GFunc)theme_changed_func, data);
|
||||||
for (l = theme_list; l; l = g_list_next (l))
|
for (l = theme_list; l; l = g_list_next (l))
|
||||||
{
|
{
|
||||||
gchar *name = ((GnomeThemeMetaInfo *)l->data)->name;
|
struct theme_thumbnail_func_data *tdata;
|
||||||
gchar *display_name = ((GnomeThemeMetaInfo *)l->data)->readable_name;
|
|
||||||
if (name)
|
tdata = g_new0 (struct theme_thumbnail_func_data, 1);
|
||||||
{
|
tdata->info = (GnomeThemeMetaInfo *)l->data;
|
||||||
GdkPixbuf *pixbuf = generate_theme_thumbnail (l->data, TRUE);
|
tdata->store = theme_store;
|
||||||
gtk_list_store_insert_with_values (theme_store, NULL, 0,
|
|
||||||
THEME_DISPLAY_NAME_COLUMN, display_name,
|
generate_theme_thumbnail_async (tdata->info, (ThemeThumbnailFunc) theme_thumbnail_func, tdata, NULL);
|
||||||
THEME_NAME_COLUMN, name,
|
|
||||||
THEME_PIXBUF_COLUMN, pixbuf,
|
|
||||||
-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
g_list_free (theme_list);
|
||||||
|
|
||||||
w = glade_xml_get_widget (data->xml, "theme_list");
|
w = glade_xml_get_widget (data->xml, "theme_list");
|
||||||
sort_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (theme_store));
|
GtkTreeModel *sort_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (theme_store));
|
||||||
gtk_icon_view_set_model (GTK_ICON_VIEW (w), GTK_TREE_MODEL (sort_model));
|
gtk_icon_view_set_model (GTK_ICON_VIEW (w), GTK_TREE_MODEL (sort_model));
|
||||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model), THEME_DISPLAY_NAME_COLUMN, GTK_SORT_ASCENDING);
|
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model), THEME_DISPLAY_NAME_COLUMN, GTK_SORT_ASCENDING);
|
||||||
|
|
||||||
w = glade_xml_get_widget (data->xml, "theme_install");
|
w = glade_xml_get_widget (data->xml, "theme_open");
|
||||||
gtk_button_set_image (GTK_BUTTON (w),
|
gtk_button_set_image (GTK_BUTTON (w),
|
||||||
gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON));
|
gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON));
|
||||||
}
|
}
|
||||||
|
@ -101,6 +103,21 @@ theme_changed_func (gpointer uri, AppearanceData *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
theme_thumbnail_func (GdkPixbuf *pixbuf, struct theme_thumbnail_func_data *data)
|
||||||
|
{
|
||||||
|
/* TODO: we should probably have already added the item, and only be updating
|
||||||
|
* the thumbnail here */
|
||||||
|
|
||||||
|
gtk_list_store_insert_with_values (data->store, NULL, 0,
|
||||||
|
THEME_DISPLAY_NAME_COLUMN, data->info->readable_name,
|
||||||
|
THEME_NAME_COLUMN, data->info->name,
|
||||||
|
THEME_PIXBUF_COLUMN, pixbuf,
|
||||||
|
-1);
|
||||||
|
gnome_theme_meta_info_free (data->info);
|
||||||
|
g_free (data);
|
||||||
|
}
|
||||||
|
|
||||||
/** GUI Callbacks **/
|
/** GUI Callbacks **/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue