Mercurial > pidgin
changeset 5703:cee14870644c
[gaim-migrate @ 6124]
Added some niceties, like the OK, Delete, and Modify buttons only being
clickable when something is selected or entered or whatever. Also, some bug
fixes. I had too many sanity checks. Some I did not want.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Tue, 03 Jun 2003 10:15:29 +0000 |
parents | 05858c215226 |
children | aa8dbb7e0a4d |
files | src/account.c src/gtkaccount.c |
diffstat | 2 files changed, 60 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/account.c Tue Jun 03 09:39:17 2003 +0000 +++ b/src/account.c Tue Jun 03 10:15:29 2003 +0000 @@ -179,7 +179,6 @@ gaim_account_set_username(GaimAccount *account, const char *username) { g_return_if_fail(account != NULL); - g_return_if_fail(username != NULL); if (account->username != NULL) g_free(account->username); @@ -193,7 +192,6 @@ gaim_account_set_password(GaimAccount *account, const char *password) { g_return_if_fail(account != NULL); - g_return_if_fail(password != NULL); if (account->password != NULL) g_free(account->password); @@ -207,7 +205,6 @@ gaim_account_set_alias(GaimAccount *account, const char *alias) { g_return_if_fail(account != NULL); - g_return_if_fail(alias != NULL); if (account->alias != NULL) g_free(account->alias); @@ -221,7 +218,6 @@ gaim_account_set_user_info(GaimAccount *account, const char *user_info) { g_return_if_fail(account != NULL); - g_return_if_fail(user_info != NULL); if (account->user_info != NULL) g_free(account->user_info); @@ -235,7 +231,6 @@ gaim_account_set_buddy_icon(GaimAccount *account, const char *icon) { g_return_if_fail(account != NULL); - g_return_if_fail(icon != NULL); if (account->buddy_icon != NULL) g_free(account->buddy_icon);
--- a/src/gtkaccount.c Tue Jun 03 09:39:17 2003 +0000 +++ b/src/gtkaccount.c Tue Jun 03 10:15:29 2003 +0000 @@ -62,6 +62,9 @@ GtkWidget *window; GtkWidget *treeview; + GtkWidget *modify_button; + GtkWidget *delete_button; + GtkListStore *model; GtkTreeIter drag_iter; @@ -90,6 +93,7 @@ GtkWidget *top_vbox; GtkWidget *bottom_vbox; + GtkWidget *ok_button; /* Login Options */ GtkWidget *login_frame; @@ -185,6 +189,16 @@ } static void +__screenname_changed_cb(GtkEntry *entry, AccountPrefsDialog *dialog) +{ + if (dialog->ok_button == NULL) + return; + + gtk_widget_set_sensitive(dialog->ok_button, + *gtk_entry_get_text(entry) != '\0'); +} + +static void __add_login_options(AccountPrefsDialog *dialog, GtkWidget *parent) { GtkWidget *frame; @@ -222,6 +236,9 @@ __add_pref_box(dialog, vbox, _("Screenname:"), dialog->screenname_entry); + g_signal_connect(G_OBJECT(dialog->screenname_entry), "changed", + G_CALLBACK(__screenname_changed_cb), dialog); + /* Do the user split thang */ if (dialog->plugin == NULL) /* Yeah right. */ user_splits = NULL; @@ -629,6 +646,21 @@ } static void +__port_popup_cb(GtkWidget *w, GtkMenu *menu, gpointer data) +{ + GtkWidget *item; + + item = gtk_menu_item_new_with_label( + _("you can see the butterflies mating")); + gtk_widget_show(item); + gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), item); + + item = gtk_menu_item_new_with_label(_("If you look real closely")); + gtk_widget_show(item); + gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), item); +} + +static void __add_proxy_options(AccountPrefsDialog *dialog, GtkWidget *parent) { GaimProxyInfo *proxy_info; @@ -670,8 +702,12 @@ dialog->proxy_port_entry = gtk_entry_new(); __add_pref_box(dialog, vbox2, _("_Port:"), dialog->proxy_port_entry); + g_signal_connect(G_OBJECT(dialog->proxy_port_entry), "populate-popup", + G_CALLBACK(__port_popup_cb), NULL); + /* User */ dialog->proxy_user_entry = gtk_entry_new(); + __add_pref_box(dialog, vbox2, _("_Username:"), dialog->proxy_user_entry); /* Password */ @@ -926,6 +962,8 @@ gtk_widget_destroy(dialog->window); __account_win_destroy_cb(NULL, NULL, dialog); + + gaim_accounts_sync(); } static void @@ -1027,8 +1065,14 @@ /* OK button */ button = gtk_button_new_from_stock(GTK_STOCK_OK); gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); + + if (dialog->account == NULL) + gtk_widget_set_sensitive(button, FALSE); + gtk_widget_show(button); + dialog->ok_button = button; + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(__ok_account_prefs_cb), dialog); @@ -1433,11 +1477,19 @@ __add_account(dialog, (GaimAccount *)l->data); } +static void +__account_selected_cb(GtkTreeSelection *sel, AccountsDialog *dialog) +{ + gtk_widget_set_sensitive(dialog->modify_button, TRUE); + gtk_widget_set_sensitive(dialog->delete_button, TRUE); +} + static GtkWidget * __create_accounts_list(AccountsDialog *dialog) { GtkWidget *sw; GtkWidget *treeview; + GtkTreeSelection *sel; GtkTargetEntry gte[] = {{"GAIM_ACCOUNT", GTK_TARGET_SAME_APP, 0}}; /* Create the scrolled window. */ @@ -1470,6 +1522,10 @@ __populate_accounts_list(dialog); + sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); + g_signal_connect(G_OBJECT(sel), "changed", + G_CALLBACK(__account_selected_cb), dialog); + /* Setup DND. I wanna be an orc! */ gtk_tree_view_enable_model_drag_source( GTK_TREE_VIEW(treeview), GDK_BUTTON1_MASK, gte, @@ -1552,7 +1608,9 @@ /* Modify button */ button = gtk_button_new_from_stock(GAIM_STOCK_MODIFY); + dialog->modify_button = button; gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); + gtk_widget_set_sensitive(button, FALSE); gtk_widget_show(button); g_signal_connect(G_OBJECT(button), "clicked", @@ -1560,7 +1618,9 @@ /* Delete button */ button = gtk_button_new_from_stock(GTK_STOCK_DELETE); + dialog->delete_button = button; gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); + gtk_widget_set_sensitive(button, FALSE); gtk_widget_show(button); g_signal_connect(G_OBJECT(button), "clicked",