| 889 { |
889 { |
| 890 GtkWidget *menu; |
890 GtkWidget *menu; |
| 891 GtkWidget *item; |
891 GtkWidget *item; |
| 892 gboolean show_all; |
892 gboolean show_all; |
| 893 GaimAccount *account; |
893 GaimAccount *account; |
| 894 GaimCheckAccountFunc check_account_func; |
894 GaimFilterAccountFunc filter_func; |
| 895 |
895 |
| 896 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu)); |
896 menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu)); |
| 897 item = gtk_menu_get_active(GTK_MENU(menu)); |
897 item = gtk_menu_get_active(GTK_MENU(menu)); |
| 898 account = g_object_get_data(G_OBJECT(item), "account"); |
898 account = g_object_get_data(G_OBJECT(item), "account"); |
| 899 |
899 |
| 900 show_all = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(optmenu), |
900 show_all = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(optmenu), |
| 901 "show_all")); |
901 "show_all")); |
| 902 |
902 |
| 903 check_account_func = g_object_get_data(G_OBJECT(optmenu), |
903 filter_func = g_object_get_data(G_OBJECT(optmenu), |
| 904 "check_account_func"); |
904 "filter_func"); |
| 905 |
905 |
| 906 gtk_option_menu_remove_menu(GTK_OPTION_MENU(optmenu)); |
906 gtk_option_menu_remove_menu(GTK_OPTION_MENU(optmenu)); |
| 907 |
907 |
| 908 create_account_menu(optmenu, account, check_account_func, show_all); |
908 create_account_menu(optmenu, account, filter_func, show_all); |
| 909 } |
909 } |
| 910 |
910 |
| 911 static void |
911 static void |
| 912 account_menu_sign_on_off_cb(GaimConnection *gc, GtkWidget *optmenu) |
912 account_menu_sign_on_off_cb(GaimConnection *gc, GtkWidget *optmenu) |
| 913 { |
913 { |
| 930 } |
930 } |
| 931 |
931 |
| 932 GtkWidget * |
932 GtkWidget * |
| 933 gaim_gtk_account_option_menu_new(GaimAccount *default_account, |
933 gaim_gtk_account_option_menu_new(GaimAccount *default_account, |
| 934 gboolean show_all, GCallback cb, |
934 gboolean show_all, GCallback cb, |
| 935 GaimCheckAccountFunc check_account_func, |
935 GaimFilterAccountFunc filter_func, |
| 936 gpointer user_data) |
936 gpointer user_data) |
| 937 { |
937 { |
| 938 GtkWidget *optmenu; |
938 GtkWidget *optmenu; |
| 939 |
939 |
| 940 /* Create the option menu */ |
940 /* Create the option menu */ |
| 959 optmenu); |
959 optmenu); |
| 960 |
960 |
| 961 /* Set some data. */ |
961 /* Set some data. */ |
| 962 g_object_set_data(G_OBJECT(optmenu), "user_data", user_data); |
962 g_object_set_data(G_OBJECT(optmenu), "user_data", user_data); |
| 963 g_object_set_data(G_OBJECT(optmenu), "show_all", GINT_TO_POINTER(show_all)); |
963 g_object_set_data(G_OBJECT(optmenu), "show_all", GINT_TO_POINTER(show_all)); |
| 964 g_object_set_data(G_OBJECT(optmenu), "check_account_func", |
964 g_object_set_data(G_OBJECT(optmenu), "filter_func", |
| 965 check_account_func); |
965 filter_func); |
| 966 |
966 |
| 967 /* Create and set the actual menu. */ |
967 /* Create and set the actual menu. */ |
| 968 create_account_menu(optmenu, default_account, check_account_func, show_all); |
968 create_account_menu(optmenu, default_account, filter_func, show_all); |
| 969 |
969 |
| 970 /* And now the last callback. */ |
970 /* And now the last callback. */ |
| 971 g_signal_connect(G_OBJECT(optmenu), "changed", |
971 g_signal_connect(G_OBJECT(optmenu), "changed", |
| 972 G_CALLBACK(account_menu_cb), cb); |
972 G_CALLBACK(account_menu_cb), cb); |
| 973 |
973 |