| 689 g_object_set_data(G_OBJECT(optmenu), "user_data", user_data); |
689 g_object_set_data(G_OBJECT(optmenu), "user_data", user_data); |
| 690 |
690 |
| 691 menu = gtk_menu_new(); |
691 menu = gtk_menu_new(); |
| 692 gtk_widget_show(menu); |
692 gtk_widget_show(menu); |
| 693 |
693 |
| 694 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
694 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
| 695 |
695 |
| 696 if (show_all) |
696 if (show_all) |
| 697 list = gaim_accounts_get_all(); |
697 list = gaim_accounts_get_all(); |
| 698 else |
698 else |
| 699 list = gaim_connections_get_all(); |
699 list = gaim_connections_get_all(); |
| 700 |
700 |
| |
701 gaim_debug(GAIM_DEBUG_INFO, "gtkutils", "Populating menu\n"); |
| |
702 |
| 701 for (p = list, i = 0; p != NULL; p = p->next, i++) { |
703 for (p = list, i = 0; p != NULL; p = p->next, i++) { |
| 702 GaimPluginProtocolInfo *prpl_info = NULL; |
704 GaimPluginProtocolInfo *prpl_info = NULL; |
| 703 GaimPlugin *plugin; |
705 GaimPlugin *plugin; |
| 704 |
706 |
| 705 if (show_all) |
707 if (show_all) |
| 707 else { |
709 else { |
| 708 GaimConnection *gc = (GaimConnection *)p->data; |
710 GaimConnection *gc = (GaimConnection *)p->data; |
| 709 |
711 |
| 710 account = gaim_connection_get_account(gc); |
712 account = gaim_connection_get_account(gc); |
| 711 } |
713 } |
| |
714 |
| |
715 gaim_debug(GAIM_DEBUG_INFO, "gtkutils", "Adding item.\n"); |
| 712 |
716 |
| 713 plugin = gaim_find_prpl(gaim_account_get_protocol(account)); |
717 plugin = gaim_find_prpl(gaim_account_get_protocol(account)); |
| 714 |
718 |
| 715 if (plugin != NULL) |
719 if (plugin != NULL) |
| 716 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); |
720 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); |
| 766 g_object_set_data(G_OBJECT(item), "account", account); |
770 g_object_set_data(G_OBJECT(item), "account", account); |
| 767 |
771 |
| 768 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
772 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
| 769 gtk_widget_show(item); |
773 gtk_widget_show(item); |
| 770 |
774 |
| 771 if (account == default_account) |
775 if (default_account != NULL && account == default_account) |
| 772 selected_index = i; |
776 selected_index = i; |
| 773 } |
777 } |
| |
778 |
| |
779 gaim_debug(GAIM_DEBUG_INFO, "gtkutils", "Done populating menu\n"); |
| 774 |
780 |
| 775 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); |
781 gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu); |
| 776 |
782 |
| 777 if (selected_index != -1) |
783 if (selected_index != -1) |
| 778 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), selected_index); |
784 gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), selected_index); |