Mercurial > pidgin
comparison src/buddy.c @ 3313:b0d5ce77f7dd
[gaim-migrate @ 3331]
Added capability for protocol-specific "edit buddy menu" items.
committer: Tailor Script <tailor@pidgin.im>
author | Jim Seymour <jseymour> |
---|---|
date | Sat, 15 Jun 2002 20:21:01 +0000 |
parents | 86fdd015f40e |
children | 3b00d97d59aa |
comparison
equal
deleted
inserted
replaced
3312:0c7bd995eb03 | 3313:b0d5ce77f7dd |
---|---|
787 GtkCTreeNode *node; | 787 GtkCTreeNode *node; |
788 int *type; | 788 int *type; |
789 int row, column; | 789 int row, column; |
790 static GtkWidget *menu = NULL; | 790 static GtkWidget *menu = NULL; |
791 GtkWidget *button; | 791 GtkWidget *button; |
792 static GList *mo_top = NULL; | |
792 | 793 |
793 if (event->button != 3 || event->type != GDK_BUTTON_PRESS) | 794 if (event->button != 3 || event->type != GDK_BUTTON_PRESS) |
794 return FALSE; | 795 return FALSE; |
795 | 796 |
796 if (!gtk_clist_get_selection_info(GTK_CLIST(edittree), event->x, event->y, &row, &column)) | 797 if (!gtk_clist_get_selection_info(GTK_CLIST(edittree), event->x, event->y, &row, &column)) |
804 * thus freeing-up the memory it occupied. | 805 * thus freeing-up the memory it occupied. |
805 */ | 806 */ |
806 if(menu) { | 807 if(menu) { |
807 gtk_widget_destroy(menu); | 808 gtk_widget_destroy(menu); |
808 menu = NULL; /* safety measure */ | 809 menu = NULL; /* safety measure */ |
810 if(mo_top) { | |
811 g_list_foreach(mo_top, (GFunc)g_free, NULL); | |
812 g_list_free(mo_top); | |
813 mo_top = NULL; | |
814 } | |
809 } | 815 } |
810 | 816 |
811 if (*type == EDIT_GROUP) { | 817 if (*type == EDIT_GROUP) { |
812 struct group *group = (struct group *)type; | 818 struct group *group = (struct group *)type; |
813 menu = gtk_menu_new(); | 819 menu = gtk_menu_new(); |
858 button = gtk_menu_item_new_with_label(_("View Log")); | 864 button = gtk_menu_item_new_with_label(_("View Log")); |
859 gtk_signal_connect(GTK_OBJECT(button), "activate", | 865 gtk_signal_connect(GTK_OBJECT(button), "activate", |
860 GTK_SIGNAL_FUNC(pressed_log), b->name); | 866 GTK_SIGNAL_FUNC(pressed_log), b->name); |
861 gtk_menu_append(GTK_MENU(menu), button); | 867 gtk_menu_append(GTK_MENU(menu), button); |
862 gtk_widget_show(button); | 868 gtk_widget_show(button); |
869 | |
870 /* | |
871 * Add protocol-specific edit buddy menu items if they exist | |
872 */ | |
873 if (b->gc->prpl->edit_buddy_menu) { | |
874 GList *mo = mo_top = b->gc->prpl->edit_buddy_menu(b->gc, b->name); | |
875 | |
876 while (mo) { | |
877 struct proto_buddy_menu *pbm = mo->data; | |
878 GtkWidget *button; | |
879 | |
880 button = gtk_menu_item_new_with_label(pbm->label); | |
881 gtk_signal_connect(GTK_OBJECT(button), "activate", | |
882 GTK_SIGNAL_FUNC(menu_click), b->name); | |
883 gtk_object_set_user_data(GTK_OBJECT(button), mo); | |
884 gtk_menu_append(GTK_MENU(menu), button); | |
885 gtk_widget_show(button); | |
886 | |
887 mo = mo->next; | |
888 } | |
889 } | |
863 | 890 |
864 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time); | 891 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time); |
865 | 892 |
866 return TRUE; | 893 return TRUE; |
867 } | 894 } |