Mercurial > pidgin.yaz
changeset 8134:ea3eb461efc0
[gaim-migrate @ 8839]
this makes the nifty account dropdowns reflect changes when an account is added or removed
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sat, 17 Jan 2004 19:21:39 +0000 |
parents | 7616ff76fe07 |
children | 8f4ce853e685 |
files | src/account.c src/gtkutils.c |
diffstat | 2 files changed, 31 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/account.c Sat Jan 17 17:43:32 2004 +0000 +++ b/src/account.c Sat Jan 17 19:21:39 2004 +0000 @@ -1418,6 +1418,8 @@ accounts = g_list_append(accounts, account); schedule_accounts_save(); + + gaim_signal_emit(gaim_accounts_get_handle(), "account-added", account); } void @@ -1428,6 +1430,8 @@ accounts = g_list_remove(accounts, account); schedule_accounts_save(); + + gaim_signal_emit(gaim_accounts_get_handle(), "account-removed", account); } void @@ -1637,6 +1641,14 @@ GAIM_SUBTYPE_ACCOUNT), gaim_value_new(GAIM_TYPE_STRING), gaim_value_new(GAIM_TYPE_UINT)); + + gaim_signal_register(handle, "account-added", + gaim_marshal_VOID__POINTER, NULL, 1, + gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_ACCOUNT)); + + gaim_signal_register(handle, "account-removed", + gaim_marshal_VOID__POINTER, NULL, 1, + gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_ACCOUNT)); } void
--- a/src/gtkutils.c Sat Jan 17 17:43:32 2004 +0000 +++ b/src/gtkutils.c Sat Jan 17 19:21:39 2004 +0000 @@ -873,7 +873,7 @@ } static void -account_menu_sign_on_off_cb(GaimConnection *gc, GtkWidget *optmenu) +regenerate_account_menu(GtkWidget *optmenu) { GtkWidget *menu; GtkWidget *item; @@ -896,6 +896,18 @@ create_account_menu(optmenu, account, check_account_func, show_all); } +static void +account_menu_sign_on_off_cb(GaimConnection *gc, GtkWidget *optmenu) +{ + regenerate_account_menu(optmenu); +} + +static void +account_menu_added_removed_cb(GaimAccount *account, GtkWidget *optmenu) +{ + regenerate_account_menu(optmenu); +} + static gboolean account_menu_destroyed_cb(GtkWidget *optmenu, GdkEvent *event, void *user_data) @@ -927,6 +939,12 @@ gaim_signal_connect(gaim_connections_get_handle(), "signed-off", optmenu, GAIM_CALLBACK(account_menu_sign_on_off_cb), optmenu); + gaim_signal_connect(gaim_accounts_get_handle(), "account-added", + optmenu, GAIM_CALLBACK(account_menu_added_removed_cb), + optmenu); + gaim_signal_connect(gaim_accounts_get_handle(), "account-removed", + optmenu, GAIM_CALLBACK(account_menu_added_removed_cb), + optmenu); /* Set some data. */ g_object_set_data(G_OBJECT(optmenu), "user_data", user_data);