comparison src/gtkutils.c @ 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 ea073d234191
children 4971193f761d
comparison
equal deleted inserted replaced
8133:7616ff76fe07 8134:ea3eb461efc0
871 if (selected_index != -1) 871 if (selected_index != -1)
872 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), selected_index); 872 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), selected_index);
873 } 873 }
874 874
875 static void 875 static void
876 account_menu_sign_on_off_cb(GaimConnection *gc, GtkWidget *optmenu) 876 regenerate_account_menu(GtkWidget *optmenu)
877 { 877 {
878 GtkWidget *menu; 878 GtkWidget *menu;
879 GtkWidget *item; 879 GtkWidget *item;
880 gboolean show_all; 880 gboolean show_all;
881 GaimAccount *account; 881 GaimAccount *account;
892 "check_account_func"); 892 "check_account_func");
893 893
894 gtk_option_menu_remove_menu(GTK_OPTION_MENU(optmenu)); 894 gtk_option_menu_remove_menu(GTK_OPTION_MENU(optmenu));
895 895
896 create_account_menu(optmenu, account, check_account_func, show_all); 896 create_account_menu(optmenu, account, check_account_func, show_all);
897 }
898
899 static void
900 account_menu_sign_on_off_cb(GaimConnection *gc, GtkWidget *optmenu)
901 {
902 regenerate_account_menu(optmenu);
903 }
904
905 static void
906 account_menu_added_removed_cb(GaimAccount *account, GtkWidget *optmenu)
907 {
908 regenerate_account_menu(optmenu);
897 } 909 }
898 910
899 static gboolean 911 static gboolean
900 account_menu_destroyed_cb(GtkWidget *optmenu, GdkEvent *event, 912 account_menu_destroyed_cb(GtkWidget *optmenu, GdkEvent *event,
901 void *user_data) 913 void *user_data)
924 gaim_signal_connect(gaim_connections_get_handle(), "signed-on", 936 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
925 optmenu, GAIM_CALLBACK(account_menu_sign_on_off_cb), 937 optmenu, GAIM_CALLBACK(account_menu_sign_on_off_cb),
926 optmenu); 938 optmenu);
927 gaim_signal_connect(gaim_connections_get_handle(), "signed-off", 939 gaim_signal_connect(gaim_connections_get_handle(), "signed-off",
928 optmenu, GAIM_CALLBACK(account_menu_sign_on_off_cb), 940 optmenu, GAIM_CALLBACK(account_menu_sign_on_off_cb),
941 optmenu);
942 gaim_signal_connect(gaim_accounts_get_handle(), "account-added",
943 optmenu, GAIM_CALLBACK(account_menu_added_removed_cb),
944 optmenu);
945 gaim_signal_connect(gaim_accounts_get_handle(), "account-removed",
946 optmenu, GAIM_CALLBACK(account_menu_added_removed_cb),
929 optmenu); 947 optmenu);
930 948
931 /* Set some data. */ 949 /* Set some data. */
932 g_object_set_data(G_OBJECT(optmenu), "user_data", user_data); 950 g_object_set_data(G_OBJECT(optmenu), "user_data", user_data);
933 g_object_set_data(G_OBJECT(optmenu), "show_all", GINT_TO_POINTER(show_all)); 951 g_object_set_data(G_OBJECT(optmenu), "show_all", GINT_TO_POINTER(show_all));