From 80924cf2f0f3cf70a81f3a7e44f2c21911972d7f Mon Sep 17 00:00:00 2001 From: Padraig O'Briain Date: Fri, 2 Apr 2004 14:33:59 +0000 Subject: [PATCH] Check that cursor position has changed before calling 2004-04-02 Padraig O'Briain * gnome-theme-details.c (update_list_something): Check that cursor position has changed before calling gtk_tree_view_set_cursor. * gnome-theme-manager.c (update_settings_from_gconf): Check that cursor position has changed before calling gtk_tree_view_set_cursor. Fixes bug #131538. --- capplets/theme-switcher/ChangeLog | 9 +++++++++ capplets/theme-switcher/gnome-theme-details.c | 14 +++++++++++++- capplets/theme-switcher/gnome-theme-manager.c | 13 ++++++++++++- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/capplets/theme-switcher/ChangeLog b/capplets/theme-switcher/ChangeLog index 84d3ac017..51a734f42 100644 --- a/capplets/theme-switcher/ChangeLog +++ b/capplets/theme-switcher/ChangeLog @@ -1,3 +1,12 @@ +2004-04-02 Padraig O'Briain + + * gnome-theme-details.c (update_list_something): Check that cursor + position has changed before calling gtk_tree_view_set_cursor. + * gnome-theme-manager.c (update_settings_from_gconf): Check that + cursor position has changed before calling gtk_tree_view_set_cursor. + + Fixes bug #131538. + 2004-04-01 Jody Goldberg * Release 2.6.0.3 diff --git a/capplets/theme-switcher/gnome-theme-details.c b/capplets/theme-switcher/gnome-theme-details.c index db918f86a..288c0ec7a 100644 --- a/capplets/theme-switcher/gnome-theme-details.c +++ b/capplets/theme-switcher/gnome-theme-details.c @@ -508,8 +508,20 @@ update_list_something (GtkWidget *tree_view, const gchar *theme) if (! strcmp (theme, theme_id)) { GtkTreePath *path; + GtkTreePath *cursor_path; + gboolean cursor_same = FALSE; + + gtk_tree_view_get_cursor (GTK_TREE_VIEW (tree_view), &cursor_path, NULL); path = gtk_tree_model_get_path (model, &iter); - gtk_tree_view_set_cursor (GTK_TREE_VIEW (tree_view), path, NULL, FALSE); + if (cursor_path && gtk_tree_path_compare (path, cursor_path) == 0) + cursor_same = TRUE; + + gtk_tree_path_free (cursor_path); + + if (!cursor_same) + { + gtk_tree_view_set_cursor (GTK_TREE_VIEW (tree_view), path, NULL, FALSE); + } gtk_tree_path_free (path); theme_found = TRUE; } diff --git a/capplets/theme-switcher/gnome-theme-manager.c b/capplets/theme-switcher/gnome-theme-manager.c index 1f36eb246..648b93a80 100644 --- a/capplets/theme-switcher/gnome-theme-manager.c +++ b/capplets/theme-switcher/gnome-theme-manager.c @@ -860,9 +860,20 @@ update_settings_from_gconf (void) ! strcmp (current_icon_theme, meta_theme_info->icon_theme_name)) { GtkTreePath *path; + GtkTreePath *cursor_path; + gboolean cursor_same = FALSE; + gtk_tree_view_get_cursor (GTK_TREE_VIEW (tree_view), &cursor_path, NULL); path = gtk_tree_model_get_path (model, &iter); - gtk_tree_view_set_cursor (GTK_TREE_VIEW (tree_view), path, NULL, FALSE); + if (cursor_path && gtk_tree_path_compare (path, cursor_path) == 0) + cursor_same = TRUE; + + gtk_tree_path_free (cursor_path); + + if (!cursor_same) + { + gtk_tree_view_set_cursor (GTK_TREE_VIEW (tree_view), path, NULL, FALSE); + } gtk_tree_path_free (path); custom_theme_found = FALSE;