static void banlist_crop (GtkWidget * wid, banlist_info *banl) { session *sess = banl->sess; GtkTreeSelection *select; GSList *list = NULL, *node; int num_sel; /* remember which bans are selected */ select = gtk_tree_view_get_selection (get_view (sess)); /* gtk_tree_selected_get_selected_rows() isn't present in gtk 2.0.x */ gtk_tree_selection_selected_foreach (select, banlist_add_selected_cb, &list); num_sel = g_slist_length (list); /* select all, then unselect those that we remembered */ if (num_sel) { gtk_tree_selection_select_all (select); for (node = list; node; node = node->next) gtk_tree_selection_unselect_iter (select, node->data); g_slist_foreach (list, (GFunc)g_free, NULL); g_slist_free (list); banlist_unban (NULL, banl); } else fe_message (_("You must select some bans."), FE_MSG_ERROR); }
static void banlist_clear_cb (GtkDialog *dialog, gint response, gpointer sess) { GtkTreeSelection *sel; gtk_widget_destroy (GTK_WIDGET (dialog)); if (response == GTK_RESPONSE_OK) { sel = gtk_tree_view_get_selection (get_view (sess)); gtk_tree_selection_select_all (sel); banlist_unban (NULL, sess); } }