add a description entry. Still needs escaping.
Tue Jan 7 03:10:36 2003 Jonathan Blandford <jrb@gnome.org> * gnome-theme-save.c (save_dialog_response): add a description entry. Still needs escaping. * theme-thumbnail.c (generate_theme_thumbnail): read the thumbnail back from the child correctly. I think thumbnailing fully works. * TODO: Update
This commit is contained in:
parent
ff2eb3c60c
commit
003a40868f
6 changed files with 62 additions and 20 deletions
|
@ -1,3 +1,13 @@
|
|||
Tue Jan 7 03:10:36 2003 Jonathan Blandford <jrb@gnome.org>
|
||||
|
||||
* gnome-theme-save.c (save_dialog_response): add a description
|
||||
entry. Still needs escaping.
|
||||
|
||||
* theme-thumbnail.c (generate_theme_thumbnail): read the thumbnail
|
||||
back from the child correctly. I think thumbnailing fully works.
|
||||
|
||||
* TODO: Update
|
||||
|
||||
2003-01-06 Seth Nickell <snickell@stanford.edu>
|
||||
|
||||
* gnome-theme-manager.c: (load_meta_themes):
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
Left TODO:
|
||||
|
||||
* Find initial theme, and if it's not a metatheme keep it around to put
|
||||
* Find initial theme, and if it's a custom metatheme keep it around to put
|
||||
in the list when selecting a different theme.
|
||||
|
||||
* Change custom theme removal addition to handle above
|
||||
* Change custom theme removal addition to handle above.
|
||||
|
||||
* Change custom theme text to indicate what themes are being used.
|
||||
|
||||
* Create an icon for custom themes
|
||||
|
||||
* Create a default icon.
|
||||
|
||||
* Notice when a directory is removed.
|
||||
|
||||
* Sanity check saving.
|
||||
|
||||
|
||||
* Sanity check saving. In particular, \n needs escaping.
|
||||
|
||||
* Fix when saving a theme. Seems to be a small race condition there
|
||||
that screws a lot up. Should be trackable, though I fear it's going
|
||||
to test my fam-fu
|
||||
|
|
|
@ -417,7 +417,7 @@ load_meta_themes (GtkTreeView *tree_view,
|
|||
blurb = g_strdup_printf ("<span size=\"larger\" weight=\"bold\">%s</span>\n%s",
|
||||
list_meta_theme_info->readable_name, list_meta_theme_info->comment);
|
||||
if (i <= MAX_ELEMENTS_BEFORE_SCROLLING)
|
||||
pixbuf = generate_theme_thumbnail (list_meta_theme_info);
|
||||
pixbuf = generate_theme_thumbnail (list_meta_theme_info, FALSE);
|
||||
else
|
||||
pixbuf = default_image;
|
||||
|
||||
|
@ -622,9 +622,13 @@ add_custom_row_to_meta_theme (const gchar *current_gtk_theme,
|
|||
tree_view = WID ("meta_theme_treeview");
|
||||
model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view));
|
||||
|
||||
g_free (custom_meta_theme_info.gtk_theme_name);
|
||||
custom_meta_theme_info.gtk_theme_name = g_strdup (current_gtk_theme);
|
||||
g_free (custom_meta_theme_info.metacity_theme_name);
|
||||
custom_meta_theme_info.metacity_theme_name = g_strdup (current_window_theme);
|
||||
g_free (custom_meta_theme_info.icon_theme_name);
|
||||
custom_meta_theme_info.icon_theme_name = g_strdup (current_icon_theme);
|
||||
g_free (custom_meta_theme_info.name);
|
||||
custom_meta_theme_info.name = g_strdup ("Custom Theme");
|
||||
|
||||
for (valid = gtk_tree_model_get_iter_first (model, &iter);
|
||||
|
@ -655,7 +659,9 @@ add_custom_row_to_meta_theme (const gchar *current_gtk_theme,
|
|||
/* Commented out because it does odd things */
|
||||
/*theme_thumbnail_invalidate_cache (&custom_meta_theme_info);*/
|
||||
|
||||
pixbuf = generate_theme_thumbnail (&custom_meta_theme_info);
|
||||
pixbuf = generate_theme_thumbnail (&custom_meta_theme_info, TRUE);
|
||||
g_print ("%d %d\n" ,gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf));
|
||||
gdk_pixbuf_save (pixbuf, "/tmp/out.png", "png", NULL, NULL);
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
|
||||
META_THEME_PIXBUF_COLUMN, pixbuf,
|
||||
|
|
|
@ -55,6 +55,7 @@ setup_directory_structure (const gchar *theme_name,
|
|||
static gboolean
|
||||
write_theme_to_disk (GnomeThemeMetaInfo *meta_theme_info,
|
||||
const gchar *theme_name,
|
||||
const gchar *theme_description,
|
||||
GError **error)
|
||||
{
|
||||
gchar *dir;
|
||||
|
@ -74,7 +75,7 @@ write_theme_to_disk (GnomeThemeMetaInfo *meta_theme_info,
|
|||
gnome_vfs_truncate_handle (handle, 0);
|
||||
|
||||
/* start making the theme file */
|
||||
str = g_strdup_printf (theme_header, theme_name, theme_name);
|
||||
str = g_strdup_printf (theme_header, theme_name, theme_description);
|
||||
gnome_vfs_write (handle, str, strlen (str), &bytes_written);
|
||||
g_free (str);
|
||||
|
||||
|
@ -103,6 +104,7 @@ write_theme_to_disk (GnomeThemeMetaInfo *meta_theme_info,
|
|||
static gboolean
|
||||
save_theme_to_disk (GnomeThemeMetaInfo *meta_theme_info,
|
||||
const gchar *theme_name,
|
||||
const gchar *theme_description,
|
||||
GError **error)
|
||||
{
|
||||
if (! check_theme_name (theme_name, error))
|
||||
|
@ -111,7 +113,7 @@ save_theme_to_disk (GnomeThemeMetaInfo *meta_theme_info,
|
|||
if (! setup_directory_structure (theme_name, error))
|
||||
return FALSE;
|
||||
|
||||
if (! write_theme_to_disk (meta_theme_info, theme_name, error))
|
||||
if (! write_theme_to_disk (meta_theme_info, theme_name, theme_description, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
@ -123,20 +125,32 @@ save_dialog_response (GtkWidget *save_dialog,
|
|||
gpointer data)
|
||||
{
|
||||
GnomeThemeMetaInfo *meta_theme_info;
|
||||
char *theme_description = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
GladeXML *dialog;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *text_view;
|
||||
GtkTextBuffer *buffer;
|
||||
const char *theme_name;
|
||||
GtkTextIter start_iter;
|
||||
GtkTextIter end_iter;
|
||||
|
||||
|
||||
dialog = gnome_theme_manager_get_theme_dialog ();
|
||||
entry = WID ("save_dialog_entry");
|
||||
|
||||
theme_name = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||
|
||||
text_view = WID ("save_dialog_textview");
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
|
||||
gtk_text_buffer_get_start_iter (buffer, &start_iter);
|
||||
gtk_text_buffer_get_end_iter (buffer, &end_iter);
|
||||
theme_description = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE);
|
||||
|
||||
meta_theme_info = (GnomeThemeMetaInfo *) g_object_get_data (G_OBJECT (save_dialog), "meta-theme-info");
|
||||
if (! save_theme_to_disk (meta_theme_info, theme_name, &error))
|
||||
if (! save_theme_to_disk (meta_theme_info, theme_name, theme_description, &error))
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
|
@ -145,6 +159,7 @@ save_dialog_response (GtkWidget *save_dialog,
|
|||
out:
|
||||
g_clear_error (&error);
|
||||
gtk_widget_hide (save_dialog);
|
||||
g_free (theme_description);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
|
|
|
@ -121,6 +121,7 @@ create_image (ThemeThumbnailData *theme_thumbnail_data,
|
|||
GdkPixbuf *folder_icon;
|
||||
char *folder_icon_name;
|
||||
char *foo;
|
||||
|
||||
settings = gtk_settings_get_default ();
|
||||
g_object_set (G_OBJECT (settings),
|
||||
"gtk-theme-name", (char *) theme_thumbnail_data->control_theme_name->data,
|
||||
|
@ -384,7 +385,6 @@ message_from_child (GIOChannel *source,
|
|||
1024,
|
||||
&bytes_read,
|
||||
NULL);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case G_IO_STATUS_NORMAL:
|
||||
|
@ -448,7 +448,8 @@ theme_thumbnail_invalidate_cache (GnomeThemeMetaInfo *meta_theme_info)
|
|||
}
|
||||
|
||||
GdkPixbuf *
|
||||
generate_theme_thumbnail (GnomeThemeMetaInfo *meta_theme_info)
|
||||
generate_theme_thumbnail (GnomeThemeMetaInfo *meta_theme_info,
|
||||
gboolean clear_cache)
|
||||
{
|
||||
GdkPixbuf *retval = NULL;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
|
@ -461,7 +462,10 @@ generate_theme_thumbnail (GnomeThemeMetaInfo *meta_theme_info)
|
|||
pixbuf = g_hash_table_lookup (theme_hash, meta_theme_info->name);
|
||||
if (pixbuf != NULL)
|
||||
{
|
||||
return pixbuf;
|
||||
if (clear_cache)
|
||||
;//g_hash_table_remove (theme_hash, meta_theme_info->name);
|
||||
else
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, ICON_SIZE_WIDTH, ICON_SIZE_HEIGHT);
|
||||
|
@ -478,7 +482,16 @@ generate_theme_thumbnail (GnomeThemeMetaInfo *meta_theme_info)
|
|||
|
||||
for (i = 0; i < ICON_SIZE_HEIGHT; i++)
|
||||
{
|
||||
read (pipe_from_factory_fd[0], pixels + (rowstride)*i, ICON_SIZE_WIDTH * gdk_pixbuf_get_n_channels (pixbuf));
|
||||
gint j = 0;
|
||||
gint bytes_read;
|
||||
|
||||
do
|
||||
{
|
||||
bytes_read = read (pipe_from_factory_fd[0], pixels + (rowstride)*i + j, ICON_SIZE_WIDTH * gdk_pixbuf_get_n_channels (pixbuf) - j);
|
||||
if (bytes_read > 0)
|
||||
j += bytes_read;
|
||||
}
|
||||
while (j < ICON_SIZE_WIDTH * gdk_pixbuf_get_n_channels (pixbuf));
|
||||
}
|
||||
|
||||
retval = gdk_pixbuf_scale_simple (pixbuf, ICON_SIZE_WIDTH/2, ICON_SIZE_HEIGHT/2, GDK_INTERP_BILINEAR);
|
||||
|
|
|
@ -9,7 +9,8 @@ typedef void (* ThemeThumbnailFunc) (GdkPixbuf *pixbuf,
|
|||
gpointer data);
|
||||
|
||||
|
||||
GdkPixbuf *generate_theme_thumbnail (GnomeThemeMetaInfo *meta_theme_info);
|
||||
GdkPixbuf *generate_theme_thumbnail (GnomeThemeMetaInfo *meta_theme_info,
|
||||
gboolean clear_cache);
|
||||
void generate_theme_thumbnail_async (GnomeThemeMetaInfo *meta_theme_info,
|
||||
ThemeThumbnailFunc func,
|
||||
gpointer data,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue