comparison finch/gntpounce.c @ 19374:d65ce3df5be2

Make some of the dialogs look and behave more like each other.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 23 Aug 2007 07:05:03 +0000
parents 7ee0e0597a26
children 44b4e8bd759b 315151da0dc6
comparison
equal deleted inserted replaced
19373:c3d2abac662e 19374:d65ce3df5be2
450 gnt_box_add_widget(GNT_BOX(window), dialog->save_pounce); 450 gnt_box_add_widget(GNT_BOX(window), dialog->save_pounce);
451 451
452 452
453 gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); 453 gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE));
454 /* Now the button box! */ 454 /* Now the button box! */
455 bbox = gnt_hbox_new(TRUE); 455 bbox = gnt_hbox_new(FALSE);
456 456
457 /* Cancel button */ 457 /* Cancel button */
458 button = gnt_button_new(_("Cancel")); 458 button = gnt_button_new(_("Cancel"));
459 gnt_box_add_widget(GNT_BOX(bbox), button); 459 gnt_box_add_widget(GNT_BOX(bbox), button);
460 g_signal_connect(G_OBJECT(button), "activate", 460 g_signal_connect(G_OBJECT(button), "activate",
611 611
612 612
613 static void 613 static void
614 pounces_manager_add_cb(GntButton *button, gpointer user_data) 614 pounces_manager_add_cb(GntButton *button, gpointer user_data)
615 { 615 {
616 if (purple_accounts_get_all() == NULL) {
617 purple_notify_error(NULL, _("Cannot create pounce"),
618 _("You do not have any accounts."),
619 _("You must create an account first before you can create a pounce."));
620 return;
621 }
616 finch_pounce_editor_show(NULL, NULL, NULL); 622 finch_pounce_editor_show(NULL, NULL, NULL);
617 } 623 }
618 624
619 625
620 static void 626 static void
621 pounces_manager_modify_cb(GntButton *button, gpointer user_data) 627 pounces_manager_modify_cb(GntButton *button, gpointer user_data)
622 { 628 {
623 PouncesManager *dialog = user_data; 629 PouncesManager *dialog = user_data;
624 PurplePounce *pounce = gnt_tree_get_selection_data(GNT_TREE(dialog->tree)); 630 PurplePounce *pounce = gnt_tree_get_selection_data(GNT_TREE(dialog->tree));
625 finch_pounce_editor_show(NULL, NULL, pounce); 631 if (pounce)
632 finch_pounce_editor_show(NULL, NULL, pounce);
626 } 633 }
627 634
628 static void 635 static void
629 pounces_manager_delete_confirm_cb(PurplePounce *pounce) 636 pounces_manager_delete_confirm_cb(PurplePounce *pounce)
630 { 637 {
643 PurpleAccount *account; 650 PurpleAccount *account;
644 const char *pouncer, *pouncee; 651 const char *pouncer, *pouncee;
645 char *buf; 652 char *buf;
646 653
647 pounce = (PurplePounce *)gnt_tree_get_selection_data(GNT_TREE(dialog->tree)); 654 pounce = (PurplePounce *)gnt_tree_get_selection_data(GNT_TREE(dialog->tree));
655 if (pounce == NULL)
656 return;
657
648 account = purple_pounce_get_pouncer(pounce); 658 account = purple_pounce_get_pouncer(pounce);
649 pouncer = purple_account_get_username(account); 659 pouncer = purple_account_get_username(account);
650 pouncee = purple_pounce_get_pouncee(pounce); 660 pouncee = purple_pounce_get_pouncee(pounce);
651 buf = g_strdup_printf(_("Are you sure you want to delete the pounce on %s for %s?"), pouncee, pouncer); 661 buf = g_strdup_printf(_("Are you sure you want to delete the pounce on %s for %s?"), pouncee, pouncer);
652 purple_request_action(pounce, NULL, buf, NULL, 0, 662 purple_request_action(pounce, NULL, buf, NULL, 0,
694 gnt_tree_set_show_title(GNT_TREE(tree), TRUE); 704 gnt_tree_set_show_title(GNT_TREE(tree), TRUE);
695 705
696 gnt_box_add_widget(GNT_BOX(win), tree); 706 gnt_box_add_widget(GNT_BOX(win), tree);
697 707
698 /* Button box. */ 708 /* Button box. */
699 bbox = gnt_hbox_new(TRUE); 709 bbox = gnt_hbox_new(FALSE);
700 710
701 /* Add button */ 711 /* Add button */
702 button = gnt_button_new(_("Add")); 712 button = gnt_button_new(_("Add"));
703 gnt_box_add_widget(GNT_BOX(bbox), button); 713 gnt_box_add_widget(GNT_BOX(bbox), button);
704 gnt_util_set_trigger_widget(tree, GNT_KEY_INS, button); 714 gnt_util_set_trigger_widget(tree, GNT_KEY_INS, button);