comparison src/gtkaccount.c @ 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 a94f46d89b61
comparison
equal deleted inserted replaced
8405:1c4402a2ac71 8406:f8b8ee06f26c
1882 1882
1883 for (l = gaim_accounts_get_all(); l != NULL; l = l->next) 1883 for (l = gaim_accounts_get_all(); l != NULL; l = l->next)
1884 add_account(dialog, (GaimAccount *)l->data); 1884 add_account(dialog, (GaimAccount *)l->data);
1885 } 1885 }
1886 1886
1887 #if !GTK_CHECK_VERSION(2,2,0)
1888 static void
1889 get_selected_helper(GtkTreeModel *model, GtkTreePath *path,
1890 GtkTreeIter *iter, gpointer user_data)
1891 {
1892 *((gboolean *)user_data) = TRUE;
1893 }
1894 #endif
1895
1887 static void 1896 static void
1888 account_selected_cb(GtkTreeSelection *sel, AccountsWindow *dialog) 1897 account_selected_cb(GtkTreeSelection *sel, AccountsWindow *dialog)
1889 { 1898 {
1890 gtk_widget_set_sensitive(dialog->modify_button, TRUE); 1899 gboolean selected = FALSE;
1891 gtk_widget_set_sensitive(dialog->delete_button, TRUE); 1900
1901 #if GTK_CHECK_VERSION(2,2,0)
1902 selected = (gtk_tree_selection_count_selected_rows(sel) > 0);
1903 #else
1904 gtk_tree_selection_selected_foreach(sel, get_selected_helper, &selected);
1905 #endif
1906
1907 gtk_widget_set_sensitive(dialog->modify_button, selected);
1908 gtk_widget_set_sensitive(dialog->delete_button, selected);
1892 } 1909 }
1893 1910
1894 static GtkWidget * 1911 static GtkWidget *
1895 create_accounts_list(AccountsWindow *dialog) 1912 create_accounts_list(AccountsWindow *dialog)
1896 { 1913 {