diff options
Diffstat (limited to 'mail/em-folder-view.c')
-rw-r--r-- | mail/em-folder-view.c | 141 |
1 files changed, 0 insertions, 141 deletions
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 6276fb1158..7412f0abe3 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -338,143 +338,6 @@ emfv_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, EMFolder /* Popup menu In many cases these are the functions called by the bonobo callbacks too */ -static EPopupItem emfv_popup_items[] = { - - { E_POPUP_SUBMENU, "60.label.00", N_("_Label"), NULL, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY }, - { E_POPUP_ITEM, "60.label.00/00.label", N_("_None"), emfv_popup_label_clear, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY }, - { E_POPUP_BAR, "60.label.00/00.label.00", NULL, NULL, NULL, NULL }, - { E_POPUP_BAR, "60.label.00/01.label", NULL, NULL, NULL, NULL }, - { E_POPUP_ITEM, "60.label.00/01.label.00", N_("_New Label"), emfv_popup_label_new, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY }, - -}; - -static enum _e_popup_t -emfv_popup_labels_get_state_for_tag (EMFolderView *emfv, GPtrArray *uids, const char *label_tag) -{ - enum _e_popup_t state = 0; - int i; - gboolean exists = FALSE, not_exists = FALSE; - - g_return_val_if_fail (emfv != 0, state); - g_return_val_if_fail (label_tag != NULL, state); - - for (i = 0; i < uids->len && (!exists || !not_exists); i++) { - if (camel_folder_get_message_user_flag (emfv->folder, uids->pdata[i], label_tag)) - exists = TRUE; - else { - const char *label = e_util_labels_get_new_tag (camel_folder_get_message_user_tag (emfv->folder, uids->pdata[i], "label")); - - /* backward compatibility... */ - if (label && !strcmp (label, label_tag)) - exists = TRUE; - else - not_exists = TRUE; - } - } - - if (exists && not_exists) - state = E_POPUP_INCONSISTENT; - else if (exists) - state = E_POPUP_ACTIVE; - - return state; -} - -static void -emfv_popup_labels_free(EPopup *ep, GSList *l, void *data) -{ - while (l) { - GSList *n = l->next; - EPopupItem *item = l->data; - - g_free(item->path); - g_free(item); - - g_slist_free_1(l); - l = n; - } -} - -static void -emfv_popup_items_free(EPopup *ep, GSList *items, void *data) -{ - g_slist_free(items); -} - -static void -emfv_popup(EMFolderView *emfv, GdkEvent *event, int on_display) -{ - GSList *menus = NULL, *l, *label_list = NULL; - GtkMenu *menu; - EMPopup *emp; - EMPopupTargetSelect *target; - int i; - - /** @HookPoint-EMPopup: Message List Context Menu - * @Id: org.gnome.evolution.mail.folderview.popup.select - * @Type: EMPopup - * @Target: EMPopupTargetSelect - * - * This is the context menu shown on the message list or over a message. - */ - emp = em_popup_new("org.gnome.evolution.mail.folderview.popup"); - target = em_folder_view_get_popup_target(emfv, emp, on_display); - - for (i=0;i<sizeof(emfv_popup_items)/sizeof(emfv_popup_items[0]);i++) - menus = g_slist_prepend(menus, &emfv_popup_items[i]); - - e_popup_add_items((EPopup *)emp, menus, NULL, emfv_popup_items_free, emfv); - - i = 1; - if (!on_display) { - GPtrArray *uids = message_list_get_selected (emfv->list); - - for (l = mail_config_get_labels (); l; l = l->next) { - EPopupItem *item; - EUtilLabel *label = l->data; - GdkPixmap *pixmap; - GdkColor colour; - GdkGC *gc; - - item = g_malloc0(sizeof(*item)); - item->type = E_POPUP_TOGGLE | emfv_popup_labels_get_state_for_tag (emfv, uids, label->tag); - item->path = g_strdup_printf("60.label.00/00.label.%02d", i++); - item->label = label->name; - item->activate = emfv_popup_label_set; - item->user_data = label->tag; - - item->visible = EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY; - - gdk_color_parse (label->colour, &colour); - gdk_colormap_alloc_color(gdk_colormap_get_system(), &colour, FALSE, TRUE); - - pixmap = gdk_pixmap_new(((GtkWidget *)emfv)->window, 16, 16, -1); - gc = gdk_gc_new(((GtkWidget *)emfv)->window); - gdk_gc_set_foreground(gc, &colour); - gdk_draw_rectangle(pixmap, gc, TRUE, 0, 0, 16, 16); - g_object_unref(gc); - - item->image = gtk_image_new_from_pixmap(pixmap, NULL); - gtk_widget_show(item->image); - - label_list = g_slist_prepend(label_list, item); - } - - message_list_free_uids (emfv->list, uids); - } - - e_popup_add_items((EPopup *)emp, label_list, NULL, emfv_popup_labels_free, emfv); - - menu = e_popup_create_menu_once((EPopup *)emp, (EPopupTarget *)target, 0); - - if (event == NULL || event->type == GDK_KEY_PRESS) { - /* FIXME: menu pos function */ - gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, event ? event->key.time : gtk_get_current_event_time()); - } else { - gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button.button, event->button.time); - } -} - /* ********************************************************************** */ /* Bonobo menu's */ @@ -487,10 +350,6 @@ from(BonoboUIComponent *uid, void *data, const char *path) \ to(NULL, NULL, data); \ } -//EMFV_MAP_CALLBACK(emfv_message_delete, emfv_popup_delete) -//EMFV_MAP_CALLBACK(emfv_message_open, emfv_popup_open) -//EMFV_MAP_CALLBACK(emfv_message_source, emfv_popup_source) - static void prepare_offline(void *key, void *value, void *data) { |