Generate thumbnails for the custom theme.

2003-01-05  Seth Nickell  <snickell@stanford.edu>

	* gnome-theme-manager.c: (add_custom_row_to_meta_theme),
	(remove_custom_row_from_meta_theme):
	* theme-thumbnail.c: (theme_thumbnail_invalidate_cache):
	* theme-thumbnail.h:

	Generate thumbnails for the custom theme.
This commit is contained in:
Seth Nickell 2003-01-05 23:26:04 +00:00 committed by Seth Nickell
parent a50a9ea95d
commit fff1f909c8
4 changed files with 40 additions and 8 deletions

View file

@ -1,3 +1,12 @@
2003-01-05 Seth Nickell <snickell@stanford.edu>
* gnome-theme-manager.c: (add_custom_row_to_meta_theme),
(remove_custom_row_from_meta_theme):
* theme-thumbnail.c: (theme_thumbnail_invalidate_cache):
* theme-thumbnail.h:
Generate thumbnails for the custom theme.
Thu Jan 2 08:57:54 2003 Jonathan Blandford <jrb@gnome.org> Thu Jan 2 08:57:54 2003 Jonathan Blandford <jrb@gnome.org>
* gnome-theme-manager.c: correctly merge disk updates and the * gnome-theme-manager.c: correctly merge disk updates and the

View file

@ -620,6 +620,7 @@ add_custom_row_to_meta_theme (const gchar *current_gtk_theme,
GtkTreeIter iter; GtkTreeIter iter;
gboolean valid; gboolean valid;
gchar *blurb; gchar *blurb;
GdkPixbuf *pixbuf;
dialog = gnome_theme_manager_get_theme_dialog (); dialog = gnome_theme_manager_get_theme_dialog ();
tree_view = WID ("meta_theme_treeview"); tree_view = WID ("meta_theme_treeview");
@ -628,6 +629,7 @@ add_custom_row_to_meta_theme (const gchar *current_gtk_theme,
custom_meta_theme_info.gtk_theme_name = g_strdup (current_gtk_theme); custom_meta_theme_info.gtk_theme_name = g_strdup (current_gtk_theme);
custom_meta_theme_info.metacity_theme_name = g_strdup (current_window_theme); custom_meta_theme_info.metacity_theme_name = g_strdup (current_window_theme);
custom_meta_theme_info.icon_theme_name = g_strdup (current_icon_theme); custom_meta_theme_info.icon_theme_name = g_strdup (current_icon_theme);
custom_meta_theme_info.name = g_strdup (_("Custom Theme\n"));
for (valid = gtk_tree_model_get_iter_first (model, &iter); for (valid = gtk_tree_model_get_iter_first (model, &iter);
valid; valid;
@ -653,11 +655,20 @@ add_custom_row_to_meta_theme (const gchar *current_gtk_theme,
blurb = g_strdup_printf ("<span size=\"larger\" weight=\"bold\">%s</span>\n%s", blurb = g_strdup_printf ("<span size=\"larger\" weight=\"bold\">%s</span>\n%s",
_("Custom theme"), _("You can save this theme by pressing the Save Theme button.")); _("Custom theme"), _("You can save this theme by pressing the Save Theme button."));
printf ("Thumbnailing\n");
/* Invalidate the cache because the custom theme has potentially changed */
/* Commented out because it does odd things */
/*theme_thumbnail_invalidate_cache (&custom_meta_theme_info);*/
pixbuf = generate_theme_thumbnail (&custom_meta_theme_info);
gtk_list_store_set (GTK_LIST_STORE (model), &iter, gtk_list_store_set (GTK_LIST_STORE (model), &iter,
META_THEME_PIXBUF_COLUMN, pixbuf,
META_THEME_NAME_COLUMN, blurb, META_THEME_NAME_COLUMN, blurb,
META_THEME_FLAG_COLUMN, THEME_FLAG_CUSTOM, META_THEME_FLAG_COLUMN, THEME_FLAG_CUSTOM,
META_THEME_PIXBUF_COLUMN, default_image,
-1); -1);
gtk_widget_set_sensitive (WID ("meta_theme_save_button"), TRUE); gtk_widget_set_sensitive (WID ("meta_theme_save_button"), TRUE);
path = gtk_tree_model_get_path (model, &iter); path = gtk_tree_model_get_path (model, &iter);
gtk_tree_view_set_cursor (GTK_TREE_VIEW (tree_view), path, NULL, FALSE); gtk_tree_view_set_cursor (GTK_TREE_VIEW (tree_view), path, NULL, FALSE);
@ -697,12 +708,14 @@ remove_custom_row_from_meta_theme (GtkTreeModel *model)
g_free (custom_meta_theme_info.gtk_theme_name); g_free (custom_meta_theme_info.gtk_theme_name);
g_free (custom_meta_theme_info.metacity_theme_name); g_free (custom_meta_theme_info.metacity_theme_name);
g_free (custom_meta_theme_info.icon_theme_name); g_free (custom_meta_theme_info.icon_theme_name);
g_free (custom_meta_theme_info.name);
gtk_widget_set_sensitive (WID ("meta_theme_save_button"), FALSE); gtk_widget_set_sensitive (WID ("meta_theme_save_button"), FALSE);
custom_meta_theme_info.gtk_theme_name = NULL; custom_meta_theme_info.gtk_theme_name = NULL;
custom_meta_theme_info.metacity_theme_name = NULL; custom_meta_theme_info.metacity_theme_name = NULL;
custom_meta_theme_info.icon_theme_name = NULL; custom_meta_theme_info.icon_theme_name = NULL;
custom_meta_theme_info.name = NULL;
} }

View file

@ -438,6 +438,15 @@ message_from_child (GIOChannel *source,
return TRUE; return TRUE;
} }
void
theme_thumbnail_invalidate_cache (GnomeThemeMetaInfo *meta_theme_info)
{
gboolean success;
success = g_hash_table_remove (theme_hash, meta_theme_info->name);
printf ("Success is %d\n", success);
}
GdkPixbuf * GdkPixbuf *
generate_theme_thumbnail (GnomeThemeMetaInfo *meta_theme_info) generate_theme_thumbnail (GnomeThemeMetaInfo *meta_theme_info)
{ {

View file

@ -9,13 +9,14 @@ typedef void (* ThemeThumbnailFunc) (GdkPixbuf *pixbuf,
gpointer data); gpointer data);
GdkPixbuf *generate_theme_thumbnail (GnomeThemeMetaInfo *meta_theme_info); GdkPixbuf *generate_theme_thumbnail (GnomeThemeMetaInfo *meta_theme_info);
void generate_theme_thumbnail_async (GnomeThemeMetaInfo *meta_theme_info, void generate_theme_thumbnail_async (GnomeThemeMetaInfo *meta_theme_info,
ThemeThumbnailFunc func, ThemeThumbnailFunc func,
gpointer data, gpointer data,
GDestroyNotify destroy); GDestroyNotify destroy);
void theme_thumbnail_factory_init (int argc, void theme_thumbnail_invalidate_cache (GnomeThemeMetaInfo *meta_theme_info);
char *argv[]); void theme_thumbnail_factory_init (int argc,
char *argv[]);