# HG changeset patch # User Daniel Atallah # Date 1168904030 0 # Node ID 29e9a2373d32b6b337549931a96d33dde110e390 # Parent 9ebc7fa9d55681c4165e1c09c4693122e0a49076 [gaim-migrate @ 18133] Fix GTK+ 2.0.0 compatibility before nosnilmot notices. committer: Tailor Script diff -r 9ebc7fa9d556 -r 29e9a2373d32 gtk/gtksavedstatuses.c --- a/gtk/gtksavedstatuses.c Mon Jan 15 23:19:12 2007 +0000 +++ b/gtk/gtksavedstatuses.c Mon Jan 15 23:33:50 2007 +0000 @@ -304,7 +304,11 @@ char *title; selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); - sel_paths = gtk_tree_selection_get_selected_rows(selection, &model); +#if GTK_CHECK_VERSION(2,2,0) + sel_paths = gtk_tree_selection_get_selected_rows(selection, NULL); +#else + gtk_tree_selection_selected_foreach(selection, list_selected_helper, &sel_paths); +#endif /* This is ugly because we're not allowed to modify the model from within * gtk_tree_selection_selected_foreach() and the GtkTreePaths can become invalid diff -r 9ebc7fa9d556 -r 29e9a2373d32 gtk/plugins/spellchk.c --- a/gtk/plugins/spellchk.c Mon Jan 15 23:19:12 2007 +0000 +++ b/gtk/plugins/spellchk.c Mon Jan 15 23:33:50 2007 +0000 @@ -2075,19 +2075,25 @@ g_string_free(data, TRUE); } +#if !GTK_CHECK_VERSION(2,2,0) static void -check_if_something_is_selected(GtkTreeModel *model, - GtkTreePath *path, GtkTreeIter *iter, gpointer data) +count_selected_helper(GtkTreeModel *model, GtkTreePath *path, + GtkTreeIter *iter, gpointer user_data) { - *((gboolean*)data) = TRUE; + (*(gint *)user_data)++; } +#endif static void on_selection_changed(GtkTreeSelection *sel, gpointer data) { - gboolean is = FALSE; - gtk_tree_selection_selected_foreach(sel, check_if_something_is_selected, &is); - gtk_widget_set_sensitive((GtkWidget*)data, is); + gint num_selected; +#if GTK_CHECK_VERSION(2,2,0) + num_selected = gtk_tree_selection_count_selected_rows(sel); +#else + gtk_tree_selection_selected_foreach(sel, count_selected_helper, &num_selected); +#endif + gtk_widget_set_sensitive((GtkWidget*)data, (num_selected > 0)); } static gboolean non_empty(const char *s)