| 790 GaimConnection *gc = (GaimConnection *)p->data; |
790 GaimConnection *gc = (GaimConnection *)p->data; |
| 791 |
791 |
| 792 account = gaim_connection_get_account(gc); |
792 account = gaim_connection_get_account(gc); |
| 793 } |
793 } |
| 794 |
794 |
| |
795 if (check_account_func == NULL || !check_account_func(account)) |
| |
796 continue; |
| |
797 |
| 795 plugin = gaim_find_prpl(gaim_account_get_protocol(account)); |
798 plugin = gaim_find_prpl(gaim_account_get_protocol(account)); |
| 796 |
799 |
| 797 if (plugin != NULL) |
800 if (plugin != NULL) |
| 798 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); |
801 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); |
| 799 |
802 |
| 869 { |
872 { |
| 870 GtkWidget *menu; |
873 GtkWidget *menu; |
| 871 GtkWidget *item; |
874 GtkWidget *item; |
| 872 gboolean show_all; |
875 gboolean show_all; |
| 873 GaimAccount *account; |
876 GaimAccount *account; |
| |
877 GaimCheckAccountFunc check_account_func; |
| 874 |
878 |
| 875 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu)); |
879 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu)); |
| 876 item = gtk_menu_get_active(GTK_MENU(menu)); |
880 item = gtk_menu_get_active(GTK_MENU(menu)); |
| 877 account = g_object_get_data(G_OBJECT(item), "account"); |
881 account = g_object_get_data(G_OBJECT(item), "account"); |
| 878 |
882 |
| 879 show_all = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(optmenu), |
883 show_all = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(optmenu), |
| 880 "show_all")); |
884 "show_all")); |
| 881 |
885 |
| |
886 check_account_func = g_object_get_data(G_OBJECT(item), |
| |
887 "check_account_func"); |
| |
888 |
| 882 gtk_option_menu_remove_menu(GTK_OPTION_MENU(optmenu)); |
889 gtk_option_menu_remove_menu(GTK_OPTION_MENU(optmenu)); |
| 883 |
890 |
| 884 create_account_menu(optmenu, account, show_all); |
891 create_account_menu(optmenu, account, check_account_func, show_all); |
| 885 } |
892 } |
| 886 |
893 |
| 887 static gboolean |
894 static gboolean |
| 888 account_menu_destroyed_cb(GtkWidget *optmenu, GdkEvent *event, |
895 account_menu_destroyed_cb(GtkWidget *optmenu, GdkEvent *event, |
| 889 void *user_data) |
896 void *user_data) |
| 894 } |
901 } |
| 895 |
902 |
| 896 GtkWidget * |
903 GtkWidget * |
| 897 gaim_gtk_account_option_menu_new(GaimAccount *default_account, |
904 gaim_gtk_account_option_menu_new(GaimAccount *default_account, |
| 898 gboolean show_all, GCallback cb, |
905 gboolean show_all, GCallback cb, |
| |
906 GaimCheckAccountFunc check_account_func, |
| 899 gpointer user_data) |
907 gpointer user_data) |
| 900 { |
908 { |
| 901 GtkWidget *optmenu; |
909 GtkWidget *optmenu; |
| 902 |
910 |
| 903 /* Create the option menu */ |
911 /* Create the option menu */ |
| 916 optmenu); |
924 optmenu); |
| 917 |
925 |
| 918 /* Set some data. */ |
926 /* Set some data. */ |
| 919 g_object_set_data(G_OBJECT(optmenu), "user_data", user_data); |
927 g_object_set_data(G_OBJECT(optmenu), "user_data", user_data); |
| 920 g_object_set_data(G_OBJECT(optmenu), "show_all", GINT_TO_POINTER(show_all)); |
928 g_object_set_data(G_OBJECT(optmenu), "show_all", GINT_TO_POINTER(show_all)); |
| |
929 g_object_set_data(G_OBJECT(optmenu), "chck_account_func", |
| |
930 check_account_func); |
| 921 |
931 |
| 922 /* Create and set the actual menu. */ |
932 /* Create and set the actual menu. */ |
| 923 create_account_menu(optmenu, default_account, show_all); |
933 create_account_menu(optmenu, default_account, check_account_func, show_all); |
| 924 |
934 |
| 925 /* And now the last callback. */ |
935 /* And now the last callback. */ |
| 926 g_signal_connect(G_OBJECT(optmenu), "changed", |
936 g_signal_connect(G_OBJECT(optmenu), "changed", |
| 927 G_CALLBACK(account_menu_cb), cb); |
937 G_CALLBACK(account_menu_cb), cb); |
| 928 |
938 |