changeset 8406:f8b8ee06f26c

[gaim-migrate @ 9136] If nothing is selected in the accounts window (which will happen after you delete something), grey out the Modify and Delete buttons. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 08 Mar 2004 03:02:11 +0000
parents 1c4402a2ac71
children 15614a7cdc13
files src/gtkaccount.c
diffstat 1 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkaccount.c	Mon Mar 08 02:41:50 2004 +0000
+++ b/src/gtkaccount.c	Mon Mar 08 03:02:11 2004 +0000
@@ -1884,11 +1884,28 @@
 		add_account(dialog, (GaimAccount *)l->data);
 }
 
+#if !GTK_CHECK_VERSION(2,2,0)
+static void
+get_selected_helper(GtkTreeModel *model, GtkTreePath *path,
+					GtkTreeIter *iter, gpointer user_data)
+{
+	*((gboolean *)user_data) = TRUE;
+}
+#endif
+
 static void
 account_selected_cb(GtkTreeSelection *sel, AccountsWindow *dialog)
 {
-	gtk_widget_set_sensitive(dialog->modify_button, TRUE);
-	gtk_widget_set_sensitive(dialog->delete_button, TRUE);
+	gboolean selected = FALSE;
+
+#if GTK_CHECK_VERSION(2,2,0)
+	selected = (gtk_tree_selection_count_selected_rows(sel) > 0);
+#else
+	gtk_tree_selection_selected_foreach(sel, get_selected_helper, &selected);
+#endif
+
+	gtk_widget_set_sensitive(dialog->modify_button, selected);
+	gtk_widget_set_sensitive(dialog->delete_button, selected);
 }
 
 static GtkWidget *