add GnomeThemeElement parameter to the ThemeChangedCallback so that the

2009-01-25  Jens Granseuer  <jensgr@gmx.net>

	* gnome-theme-info.c: (handle_change_signal), (update_theme_index),
	(update_common_theme_dir_index):
	* gnome-theme-info.h: add GnomeThemeElement parameter to the
	ThemeChangedCallback so that the receiver can determine what part of
	the theme changed (part of bug #568595)

2009-01-25  Jens Granseuer  <jensgr@gmx.net>

	Fix newly installed themes appearing twice in the GTK themes list if
	the package contains themes for both GTK and metacity (bug #568595)

	* appearance-style.c: (changed_on_disk_cb): check the new
	GnomeThemeElement parameter instead of the theme properties to
	determine what part of the theme changed
	* appearance-themes.c: (theme_changed_on_disk_cb): use new callback
	signature

svn path=/trunk/; revision=9206
This commit is contained in:
Jens Granseuer 2009-01-25 11:05:45 +00:00 committed by Jens Granseuer
parent 19f8c86dc1
commit 65d2e5c3e5
6 changed files with 39 additions and 17 deletions

View file

@ -1,3 +1,14 @@
2009-01-25 Jens Granseuer <jensgr@gmx.net>
Fix newly installed themes appearing twice in the GTK themes list if
the package contains themes for both GTK and metacity (bug #568595)
* appearance-style.c: (changed_on_disk_cb): check the new
GnomeThemeElement parameter instead of the theme properties to
determine what part of the theme changed
* appearance-themes.c: (theme_changed_on_disk_cb): use new callback
signature
==================== 2.25.3 ====================
==================== 2.25.2 ====================

View file

@ -793,19 +793,20 @@ create_thumbnail (const gchar *name, GdkPixbuf *default_thumb, AppearanceData *d
static void
changed_on_disk_cb (GnomeThemeCommonInfo *theme,
GnomeThemeChangeType change_type,
GnomeThemeElement element_type,
AppearanceData *data)
{
if (theme->type == GNOME_THEME_TYPE_REGULAR) {
GnomeThemeInfo *info = (GnomeThemeInfo *) theme;
if (change_type == GNOME_THEME_CHANGE_DELETED) {
if (info->has_gtk)
if (element_type & GNOME_THEME_GTK_2)
remove_from_treeview ("gtk_themes_list", info->name, data);
if (info->has_metacity)
if (element_type & GNOME_THEME_METACITY)
remove_from_treeview ("window_themes_list", info->name, data);
} else {
if (info->has_gtk) {
if (element_type & GNOME_THEME_GTK_2) {
if (change_type == GNOME_THEME_CHANGE_CREATED)
add_to_treeview ("gtk_themes_list", info->name, info->name, data->gtk_theme_icon, data);
else if (change_type == GNOME_THEME_CHANGE_CHANGED)
@ -815,7 +816,7 @@ changed_on_disk_cb (GnomeThemeCommonInfo *theme,
(ThemeThumbnailFunc) gtk_theme_thumbnail_cb, data, NULL);
}
if (info->has_metacity) {
if (element_type & GNOME_THEME_METACITY) {
if (change_type == GNOME_THEME_CHANGE_CREATED)
add_to_treeview ("window_themes_list", info->name, info->name, data->window_theme_icon, data);
else if (change_type == GNOME_THEME_CHANGE_CHANGED)

View file

@ -172,6 +172,7 @@ theme_thumbnail_generate (GnomeThemeMetaInfo *info, AppearanceData *data)
static void
theme_changed_on_disk_cb (GnomeThemeCommonInfo *theme,
GnomeThemeChangeType change_type,
GnomeThemeElement element_type,
AppearanceData *data)
{
if (theme->type == GNOME_THEME_TYPE_METATHEME) {

View file

@ -1,3 +1,11 @@
2009-01-25 Jens Granseuer <jensgr@gmx.net>
* gnome-theme-info.c: (handle_change_signal), (update_theme_index),
(update_common_theme_dir_index):
* gnome-theme-info.h: add GnomeThemeElement parameter to the
ThemeChangedCallback so that the receiver can determine what part of
the theme changed (part of bug #568595)
==================== 2.25.3 ====================
==================== 2.25.2 ====================

View file

@ -688,7 +688,8 @@ read_cursor_fonts (void)
static void
handle_change_signal (gpointer data,
GnomeThemeChangeType change_type)
GnomeThemeChangeType change_type,
GnomeThemeElement element_type)
{
#ifdef DEBUG
gchar *type_str = NULL;
@ -703,7 +704,7 @@ handle_change_signal (gpointer data,
for (list = callbacks; list; list = list->next) {
ThemeCallbackData *callback_data = list->data;
(* callback_data->func) (theme, change_type, callback_data->data);
(* callback_data->func) (theme, change_type, element_type, callback_data->data);
}
#ifdef DEBUG
@ -714,12 +715,11 @@ handle_change_signal (gpointer data,
else if (theme->type == GNOME_THEME_TYPE_CURSOR)
type_str = "cursor";
else if (theme->type == GNOME_THEME_TYPE_REGULAR) {
GnomeThemeInfo *rtheme = (GnomeThemeInfo *) theme;
if (rtheme->has_gtk)
if (element_type & GNOME_THEME_GTK_2)
element_str = "gtk-2";
else if (rtheme->has_keybinding)
else if (element_type & GNOME_THEME_GTK_2_KEYBINDING)
element_str = "keybinding";
else if (rtheme->has_metacity)
else if (element_type & GNOME_THEME_METACITY)
element_str = "metacity";
}
@ -784,7 +784,7 @@ update_theme_index (GFile *index_uri,
g_hash_table_insert (theme_hash_by_uri, g_strdup (common_theme_dir), theme_info);
add_theme_to_hash_by_name (theme_hash_by_name, theme_info);
handle_change_signal (theme_info, GNOME_THEME_CHANGE_CREATED);
handle_change_signal (theme_info, GNOME_THEME_CHANGE_CREATED, key_element);
}
} else {
gboolean theme_used_to_exist = FALSE;
@ -806,11 +806,11 @@ update_theme_index (GFile *index_uri,
}
if (theme_exists && theme_used_to_exist) {
handle_change_signal (theme_info, GNOME_THEME_CHANGE_CHANGED);
handle_change_signal (theme_info, GNOME_THEME_CHANGE_CHANGED, key_element);
} else if (theme_exists && !theme_used_to_exist) {
handle_change_signal (theme_info, GNOME_THEME_CHANGE_CREATED);
handle_change_signal (theme_info, GNOME_THEME_CHANGE_CREATED, key_element);
} else if (!theme_exists && theme_used_to_exist) {
handle_change_signal (theme_info, GNOME_THEME_CHANGE_DELETED);
handle_change_signal (theme_info, GNOME_THEME_CHANGE_DELETED, key_element);
}
if (!theme_info->has_metacity && !theme_info->has_keybinding && !theme_info->has_gtk) {
@ -906,7 +906,7 @@ update_common_theme_dir_index (GFile *theme_index_uri,
if (theme_exists) {
g_hash_table_insert (hash_by_uri, g_strdup (common_theme_dir), theme_info);
add_theme_to_hash_by_name (hash_by_name, theme_info);
handle_change_signal (theme_info, GNOME_THEME_CHANGE_CREATED);
handle_change_signal (theme_info, GNOME_THEME_CHANGE_CREATED, 0);
}
} else {
if (theme_exists) {
@ -916,7 +916,7 @@ update_common_theme_dir_index (GFile *theme_index_uri,
remove_theme_from_hash_by_name (hash_by_name, old_theme_info);
g_hash_table_insert (hash_by_uri, g_strdup (common_theme_dir), theme_info);
add_theme_to_hash_by_name (hash_by_name, theme_info);
handle_change_signal (theme_info, GNOME_THEME_CHANGE_CHANGED);
handle_change_signal (theme_info, GNOME_THEME_CHANGE_CHANGED, 0);
theme_free (old_theme_info);
} else {
theme_free (theme_info);
@ -925,7 +925,7 @@ update_common_theme_dir_index (GFile *theme_index_uri,
g_hash_table_remove (hash_by_uri, common_theme_dir);
remove_theme_from_hash_by_name (hash_by_name, old_theme_info);
handle_change_signal (old_theme_info, GNOME_THEME_CHANGE_DELETED);
handle_change_signal (old_theme_info, GNOME_THEME_CHANGE_DELETED, 0);
theme_free (old_theme_info);
}
}

View file

@ -131,6 +131,7 @@ enum {
typedef void (* ThemeChangedCallback) (GnomeThemeCommonInfo *theme,
GnomeThemeChangeType change_type,
GnomeThemeElement element_type,
gpointer user_data);
#define GNOME_THEME_ERROR gnome_theme_info_error_quark ()