~ubuntu-branches/ubuntu/raring/pidgin/raring

« back to all changes in this revision

Viewing changes to finch/gntaccount.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-10-22 21:51:41 UTC
  • mto: (46.1.1 karmic)
  • mto: This revision was merged to the branch mainline in revision 31.
  • Revision ID: james.westby@ubuntu.com-20081022215141-ofqitm4aggw7x7ip
Tags: upstream-2.5.2
ImportĀ upstreamĀ versionĀ 2.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
503
503
        list = purple_plugins_get_protocols();
504
504
        if (list == NULL) {
505
505
                purple_notify_error(NULL, _("Error"),
506
 
                                _("There's no protocol plugins installed."),
 
506
                                _("There are no protocol plugins installed."),
507
507
                                _("(You probably forgot to 'make install'.)"));
508
508
                return;
509
509
        }
673
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
715
static void
677
716
reset_accounts_win(GntWidget *widget, gpointer null)
678
717
{
712
751
        }
713
752
 
714
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
756
        gnt_tree_set_col_width(GNT_TREE(accounts.tree), 0, 40);
717
757
        gnt_tree_set_col_width(GNT_TREE(accounts.tree), 1, 10);