Mercurial > pidgin
comparison finch/gntaccount.c @ 26155:eb21f65728c0
propagate from branch 'im.pidgin.pidgin' (head bc80dc424bc7a7e274901f9124173538e5b43f41)
to branch 'im.pidgin.soc.2008.yahoo' (head 42700e96e9188523e8d99406abde695abf97caf5)
author | Sulabh Mahajan <sulabh@soc.pidgin.im> |
---|---|
date | Wed, 12 Nov 2008 10:18:49 +0000 |
parents | 81169f04ab1c |
children | 024818afb013 bb99ee66120e |
comparison
equal
deleted
inserted
replaced
26154:618d122af044 | 26155:eb21f65728c0 |
---|---|
501 } | 501 } |
502 | 502 |
503 list = purple_plugins_get_protocols(); | 503 list = purple_plugins_get_protocols(); |
504 if (list == NULL) { | 504 if (list == NULL) { |
505 purple_notify_error(NULL, _("Error"), | 505 purple_notify_error(NULL, _("Error"), |
506 _("There's no protocol plugins installed."), | 506 _("There are no protocol plugins installed."), |
507 _("(You probably forgot to 'make install'.)")); | 507 _("(You probably forgot to 'make install'.)")); |
508 return; | 508 return; |
509 } | 509 } |
510 | 510 |
511 dialog = g_new0(AccountEditDialog, 1); | 511 dialog = g_new0(AccountEditDialog, 1); |
671 PurpleAccount *account = key; | 671 PurpleAccount *account = key; |
672 | 672 |
673 purple_account_set_enabled(account, FINCH_UI, gnt_tree_get_choice(GNT_TREE(widget), key)); | 673 purple_account_set_enabled(account, FINCH_UI, gnt_tree_get_choice(GNT_TREE(widget), key)); |
674 } | 674 } |
675 | 675 |
676 static gboolean | |
677 account_list_key_pressed_cb(GntWidget *widget, const char *text, gpointer null) | |
678 { | |
679 GntTree *tree = GNT_TREE(widget); | |
680 PurpleAccount *account = gnt_tree_get_selection_data(tree); | |
681 int move, pos, count; | |
682 GList *accounts; | |
683 | |
684 if (!account) | |
685 return FALSE; | |
686 | |
687 switch (text[0]) { | |
688 case '-': | |
689 move = -1; | |
690 break; | |
691 case '=': | |
692 move = 2; /* XXX: This seems to be a bug in libpurple */ | |
693 break; | |
694 default: | |
695 return FALSE; | |
696 } | |
697 | |
698 accounts = purple_accounts_get_all(); | |
699 count = g_list_length(accounts); | |
700 pos = g_list_index(accounts, account); | |
701 pos = (move + pos + count + 1) % (count + 1); | |
702 purple_accounts_reorder(account, pos); | |
703 | |
704 /* I don't like this, but recreating the entire list seems to be | |
705 * the easiest way of doing it */ | |
706 gnt_tree_remove_all(tree); | |
707 accounts = purple_accounts_get_all(); | |
708 for (; accounts; accounts = accounts->next) | |
709 account_add(accounts->data); | |
710 gnt_tree_set_selected(tree, account); | |
711 | |
712 return TRUE; | |
713 } | |
714 | |
676 static void | 715 static void |
677 reset_accounts_win(GntWidget *widget, gpointer null) | 716 reset_accounts_win(GntWidget *widget, gpointer null) |
678 { | 717 { |
679 accounts.window = NULL; | 718 accounts.window = NULL; |
680 accounts.tree = NULL; | 719 accounts.tree = NULL; |
710 PurpleAccount *account = iter->data; | 749 PurpleAccount *account = iter->data; |
711 account_add(account); | 750 account_add(account); |
712 } | 751 } |
713 | 752 |
714 g_signal_connect(G_OBJECT(accounts.tree), "toggled", G_CALLBACK(account_toggled), NULL); | 753 g_signal_connect(G_OBJECT(accounts.tree), "toggled", G_CALLBACK(account_toggled), NULL); |
754 g_signal_connect(G_OBJECT(accounts.tree), "key_pressed", G_CALLBACK(account_list_key_pressed_cb), NULL); | |
715 | 755 |
716 gnt_tree_set_col_width(GNT_TREE(accounts.tree), 0, 40); | 756 gnt_tree_set_col_width(GNT_TREE(accounts.tree), 0, 40); |
717 gnt_tree_set_col_width(GNT_TREE(accounts.tree), 1, 10); | 757 gnt_tree_set_col_width(GNT_TREE(accounts.tree), 1, 10); |
718 gnt_box_add_widget(GNT_BOX(accounts.window), accounts.tree); | 758 gnt_box_add_widget(GNT_BOX(accounts.window), accounts.tree); |
719 | 759 |