Mercurial > pidgin.yaz
comparison src/gtkutils.c @ 8289:e39ea2b4f6cd
[gaim-migrate @ 9013]
- Moved GaimCheckAccountFunc into account.h, and renamed it to
GaimFilterAccountFunc.
- Added filter functions to the account field in the gaim_request_fields
API.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Thu, 19 Feb 2004 07:25:31 +0000 |
parents | 4a6448907382 |
children | 19459d9eead2 |
comparison
equal
deleted
inserted
replaced
8288:dde73afb3283 | 8289:e39ea2b4f6cd |
---|---|
759 user_data); | 759 user_data); |
760 } | 760 } |
761 | 761 |
762 static void | 762 static void |
763 create_account_menu(GtkWidget *optmenu, GaimAccount *default_account, | 763 create_account_menu(GtkWidget *optmenu, GaimAccount *default_account, |
764 GaimCheckAccountFunc check_account_func, gboolean show_all) | 764 GaimFilterAccountFunc filter_func, gboolean show_all) |
765 { | 765 { |
766 GaimAccount *account; | 766 GaimAccount *account; |
767 GtkWidget *menu; | 767 GtkWidget *menu; |
768 GtkWidget *item; | 768 GtkWidget *item; |
769 GtkWidget *image; | 769 GtkWidget *image; |
799 GaimConnection *gc = (GaimConnection *)p->data; | 799 GaimConnection *gc = (GaimConnection *)p->data; |
800 | 800 |
801 account = gaim_connection_get_account(gc); | 801 account = gaim_connection_get_account(gc); |
802 } | 802 } |
803 | 803 |
804 if (check_account_func && !check_account_func(account)) { | 804 if (filter_func && !filter_func(account)) { |
805 i--; | 805 i--; |
806 continue; | 806 continue; |
807 } | 807 } |
808 | 808 |
809 plugin = gaim_find_prpl(gaim_account_get_protocol_id(account)); | 809 plugin = gaim_find_prpl(gaim_account_get_protocol_id(account)); |
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 |