Mercurial > pidgin
changeset 15340:29e9a2373d32
[gaim-migrate @ 18133]
Fix GTK+ 2.0.0 compatibility before nosnilmot notices.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Mon, 15 Jan 2007 23:33:50 +0000 |
parents | 9ebc7fa9d556 |
children | ca7cc867fa58 |
files | gtk/gtksavedstatuses.c gtk/plugins/spellchk.c |
diffstat | 2 files changed, 17 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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)