aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-popup.h
diff options
context:
space:
mode:
authorMichael Zucci <zucchi@src.gnome.org>2004-09-20 13:59:55 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-09-20 13:59:55 +0800
commitef6a3af717132e0750f226fa8a0ee0f3c98e19f0 (patch)
treef4ed25f7a247a8ccb855a8d940777e7a3d21a3e3 /mail/em-popup.h
parent96111b1f1487ca3fe454b340a73ba927cc6bfb83 (diff)
downloadgsoc2013-evolution-ef6a3af717132e0750f226fa8a0ee0f3c98e19f0.tar.gz
gsoc2013-evolution-ef6a3af717132e0750f226fa8a0ee0f3c98e19f0.tar.zst
gsoc2013-evolution-ef6a3af717132e0750f226fa8a0ee0f3c98e19f0.zip
Merged notzed-eplugin-2-branch to head.
svn path=/trunk/; revision=27300
Diffstat (limited to 'mail/em-popup.h')
-rw-r--r--mail/em-popup.h275
1 files changed, 197 insertions, 78 deletions
diff --git a/mail/em-popup.h b/mail/em-popup.h
index 8f235d19e0..d35f171629 100644
--- a/mail/em-popup.h
+++ b/mail/em-popup.h
@@ -25,55 +25,71 @@
#include <glib-object.h>
+#include "e-util/e-popup.h"
+
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
-/* NB: This is TEMPORARY, to be replaced by EggMenu, if it does what we need? */
-
typedef struct _EMPopup EMPopup;
typedef struct _EMPopupClass EMPopupClass;
-typedef struct _EMPopupItem EMPopupItem;
-typedef struct _EMPopupFactory EMPopupFactory; /* anonymous type */
-typedef struct _EMPopupTarget EMPopupTarget;
-
-typedef void (*EMPopupFactoryFunc)(EMPopup *emp, EMPopupTarget *target, void *data);
-
-/* Menu item descriptions */
-enum _em_popup_t {
- EM_POPUP_ITEM = 0,
- EM_POPUP_TOGGLE,
- EM_POPUP_RADIO,
- EM_POPUP_IMAGE,
- EM_POPUP_SUBMENU,
- EM_POPUP_BAR,
- EM_POPUP_TYPE_MASK = 0xffff,
- EM_POPUP_ACTIVE = 0x10000,
-};
-
-struct _EMPopupItem {
- enum _em_popup_t type;
- char *path; /* absolute path! must sort ascii-lexographically into the right spot */
- char *label;
- GCallback activate;
- void *activate_data;
- void *image; /* char* for item type, GtkWidget * for image type */
- guint32 mask;
-};
-
-/* Current target description */
-/* Types of popup tagets */
+/**
+ * enum _em_popup_target_t - A list of mail popup target types.
+ *
+ * @EM_POPUP_TARGET_SELECT: A selection of messages.
+ * @EM_POPUP_TARGET_URI: A URI.
+ * @EM_POPUP_TARGET_PART: A CamelMimePart message part.
+ * @EM_POPUP_TARGET_FOLDER: A folder URI.
+ * @EM_POPUP_TARGET_ATTACHMENTS: A list of attachments.
+ *
+ * Defines the value of the targetid for all EMPopup target types.
+ **/
enum _em_popup_target_t {
EM_POPUP_TARGET_SELECT,
EM_POPUP_TARGET_URI,
EM_POPUP_TARGET_PART,
EM_POPUP_TARGET_FOLDER,
+ EM_POPUP_TARGET_ATTACHMENTS,
};
-/* Flags that describe a TARGET_SELECT */
-enum {
+/**
+ * enum _em_popup_target_select_t - EMPopupTargetSelect qualifiers.
+ *
+ * @EM_POPUP_SELECT_ONE: Only one item is selected.
+ * @EM_POPUP_SELECT_MANY: One ore more items are selected.
+ * @EM_POPUP_SELECT_MARK_READ: Message(s) are unseen and can be
+ * marked seen.
+ * @EM_POPUP_SELECT_MARK_UNREAD: Message(s) are seen and can be
+ * marked unseen.
+ * @EM_POPUP_SELECT_DELETE: Message(s) are undeleted and can
+ * be marked deleted.
+ * @EM_POPUP_SELECT_UNDELETE: Message(s) are deleted and can be
+ * undeleted.
+ * @EM_POPUP_SELECT_MAILING_LIST: If one message is selected, and it
+ * contains a message list tag.
+ * @EM_POPUP_SELECT_EDIT: The message can be opened for editing (the
+ * folder is a sent folder).
+ * @EM_POPUP_SELECT_MARK_IMPORTANT: Message(s) are not marked
+ * important.
+ * @EM_POPUP_SELECT_MARK_UNIMPORTANT: Message(s) are marked
+ * important.
+ * @EM_POPUP_SELECT_FLAG_FOLLOWUP: Message(s) are not flagged for
+ * followup.
+ * @EM_POPUP_SELECT_FLAG_COMPLETED: Message(s) are not flagged completed.
+ * @EM_POPUP_SELECT_FLAG_CLEAR: Message(s) are flagged for followup.
+ * @EM_POPUP_SELECT_ADD_SENDER: The message contains sender addresses
+ * which might be added to the addressbook. i.e. it isn't a message in
+ * the Sent or Drafts folders.
+ * @EM_POPUP_SELECT_MARK_JUNK: Message(s) are not marked as junk.
+ * @EM_POPUP_SELECT_MARK_NOJUNK: Message(s) are marked as junk.
+ * @EM_POPUP_SELECT_FOLDER: A folder is set on the selection.
+ * @EM_POPUP_SELECT_LAST: The last bit used, can be used to add
+ * additional types from derived application code.
+ *
+ **/
+enum _em_popup_target_select_t {
EM_POPUP_SELECT_ONE = 1<<1,
EM_POPUP_SELECT_MANY = 1<<2,
EM_POPUP_SELECT_MARK_READ = 1<<3,
@@ -91,24 +107,47 @@ enum {
EM_POPUP_SELECT_MARK_JUNK = 1<<15,
EM_POPUP_SELECT_MARK_NOJUNK = 1<<16,
EM_POPUP_SELECT_FOLDER = 1<<17, /* do we have any folder at all? */
- EM_POPUP_SELECT_LAST = 1<<18 /* reserve 2 slots */
+ EM_POPUP_SELECT_LAST = 1<<18, /* reserve 2 slots */
};
-/* Flags that describe a TARGET_URI */
-enum {
+/**
+ * enum _em_popup_target_uri_t - EMPopupTargetURI qualifiers.
+ *
+ * @EM_POPUP_URI_HTTP: This is a HTTP or HTTPS url.
+ * @EM_POPUP_URI_MAILTO: This is a MAILTO url.
+ * @EM_POPUP_URI_NOT_MAILTO: This is not a MAILTO url.
+ *
+ **/
+enum _em_popup_target_uri_t {
EM_POPUP_URI_HTTP = 1<<0,
EM_POPUP_URI_MAILTO = 1<<1,
EM_POPUP_URI_NOT_MAILTO = 1<<2,
};
-/* Flags that describe TARGET_PART */
-enum {
+/**
+ * enum _em_popup_target_part_t - EMPopupTargetPart qualifiers.
+ *
+ * @EM_POPUP_PART_MESSAGE: This is a message type.
+ * @EM_POPUP_PART_IMAGE: This is an image type.
+ *
+ **/
+enum _em_popup_target_part_t {
EM_POPUP_PART_MESSAGE = 1<<0,
EM_POPUP_PART_IMAGE = 1<<1,
};
-/* Flags that describe TARGET_FOLDER */
-enum {
+/**
+ * enum _em_popup_target_folder_t - EMPopupTargetFolder qualifiers.
+ *
+ * @EM_POPUP_FOLDER_FOLDER: This is a normal folder.
+ * @EM_POPUP_FOLDER_STORE: This is a store.
+ * @EM_POPUP_FOLDER_INFERIORS: This folder may have child folders.
+ * @EM_POPUP_FOLDER_DELETE: This folder can be deleted or renamed.
+ * @EM_POPUP_FOLDER_SELECT: This folder exists and can be selected or
+ * opened.
+ *
+ **/
+enum _em_popup_target_folder_t {
EM_POPUP_FOLDER_FOLDER = 1<<0, /* normal folder */
EM_POPUP_FOLDER_STORE = 1<<1, /* root/nonselectable folder, i.e. store */
EM_POPUP_FOLDER_INFERIORS = 1<<2, /* folder can have children */
@@ -116,57 +155,137 @@ enum {
EM_POPUP_FOLDER_SELECT = 1<<4, /* folder can be selected/opened */
};
-struct _EMPopupTarget {
- enum _em_popup_target_t type;
- guint32 mask; /* depends on type, see above */
- struct _GtkWidget *widget; /* used if you need a parent toplevel, if available */
- union {
- char *uri;
- struct {
- struct _CamelFolder *folder;
- char *folder_uri;
- GPtrArray *uids;
- } select;
- struct {
- char *mime_type;
- struct _CamelMimePart *part;
- } part;
- struct {
- char *folder_uri;
- } folder;
- } data;
+/**
+ * enum _em_popup_target_attachments_t - EMPopupTargetAttachments qualifiers.
+ *
+ * @EM_POPUP_ATTACHMENTS_ONE: There is one and only one attachment selected.
+ * @EM_POPUP_ATTACHMENTS_MANY: There is one or more attachments selected.
+ *
+ **/
+enum _em_popup_target_attachments_t {
+ EM_POPUP_ATTACHMENTS_ONE = 1<<0, /* only 1 selected */
+ EM_POPUP_ATTACHMENTS_MANY = 1<<1, /* one or more selected */
+};
+
+typedef struct _EMPopupTargetSelect EMPopupTargetSelect;
+typedef struct _EMPopupTargetURI EMPopupTargetURI;
+typedef struct _EMPopupTargetPart EMPopupTargetPart;
+typedef struct _EMPopupTargetFolder EMPopupTargetFolder;
+typedef struct _EMPopupTargetAttachments EMPopupTargetAttachments;
+
+/**
+ * struct _EMPopupTargetURI - An inline URI.
+ *
+ * @target: Superclass.
+ * @uri: The encoded URI to which this target applies.
+ *
+ * Used to represent popup-menu context on any URI object.
+ **/
+struct _EMPopupTargetURI {
+ EPopupTarget target;
+ char *uri;
+};
+
+/**
+ * struct _EMPopupTargetSelect - A list of messages.
+ *
+ * @target: Superclass.
+ * @folder: The CamelFolder of the selected messages.
+ * @uri: The encoded URI represending this folder.
+ * @uids: An array of UID strings of messages within @folder.
+ *
+ * Used to represent a selection of messages as context for a popup
+ * menu. All items may be NULL if the current view has no active
+ * folder selected.
+ **/
+struct _EMPopupTargetSelect {
+ EPopupTarget target;
+ struct _CamelFolder *folder;
+ char *uri;
+ GPtrArray *uids;
+};
+
+/**
+ * struct _EMPopupTargetPart - A Camel object.
+ *
+ * @target: Superclass.
+ * @mime_type: MIME type of the part. This may be a calculated type
+ * not matching the @part's MIME type.
+ * @part: A CamelMimePart representing a message or attachment.
+ *
+ * Used to represent a message part as context for a popup menu. This
+ * is used for both attachments and inline-images.
+ **/
+struct _EMPopupTargetPart {
+ EPopupTarget target;
+ char *mime_type;
+ struct _CamelMimePart *part;
+};
+
+/**
+ * struct _EMPopupTargetFolder - A folder uri.
+ *
+ * @target: Superclass.
+ * @uri: A folder URI.
+ *
+ * This target is used to represent folder context.
+ **/
+struct _EMPopupTargetFolder {
+ EPopupTarget target;
+ char *uri;
+};
+
+/**
+ * struct _EMPopupTargetAttachments - A list of composer attachments.
+ *
+ * @target: Superclass.
+ * @attachments: A GSList list of EMsgComposer attachments.
+ *
+ * This target is used to represent a selected list of attachments in
+ * the message composer attachment area.
+ **/
+struct _EMPopupTargetAttachments {
+ EPopupTarget target;
+ GSList *attachments;
};
+typedef struct _EPopupItem EMPopupItem;
+
/* The object */
struct _EMPopup {
- GObject object;
+ EPopup popup;
struct _EMPopupPrivate *priv;
-
- char *menuid;
};
struct _EMPopupClass {
- GObjectClass object_class;
+ EPopupClass popup_class;
};
GType em_popup_get_type(void);
-/* Static class methods */
-EMPopupFactory *em_popup_static_add_factory(const char *menuid, EMPopupFactoryFunc func, void *data);
-void em_popup_static_remove_factory(EMPopupFactory *f);
-
EMPopup *em_popup_new(const char *menuid);
-void em_popup_add_items(EMPopup *, GSList *items, GDestroyNotify freefunc);
-void em_popup_add_static_items(EMPopup *emp, EMPopupTarget *target);
-struct _GtkMenu *em_popup_create_menu(EMPopup *, guint32 hide_mask, guint32 disable_mask);
-struct _GtkMenu *em_popup_create_menu_once(EMPopup *emp, EMPopupTarget *, guint32 hide_mask, guint32 disable_mask);
-
-EMPopupTarget *em_popup_target_new_uri(const char *uri);
-EMPopupTarget *em_popup_target_new_select(struct _CamelFolder *folder, const char *folder_uri, GPtrArray *uids);
-EMPopupTarget *em_popup_target_new_part(struct _CamelMimePart *part, const char *mime_type);
-EMPopupTarget *em_popup_target_new_folder(const char *uri, guint32 info_flags, guint32 popup_flags);
-void em_popup_target_free(EMPopupTarget *target);
+
+EMPopupTargetURI *em_popup_target_new_uri(EMPopup *emp, const char *uri);
+EMPopupTargetSelect *em_popup_target_new_select(EMPopup *emp, struct _CamelFolder *folder, const char *folder_uri, GPtrArray *uids);
+EMPopupTargetPart *em_popup_target_new_part(EMPopup *emp, struct _CamelMimePart *part, const char *mime_type);
+EMPopupTargetFolder *em_popup_target_new_folder(EMPopup *emp, const char *uri, guint32 info_flags, guint32 popup_flags);
+EMPopupTargetAttachments *em_popup_target_new_attachments(EMPopup *emp, GSList *attachments);
+
+/* ********************************************************************** */
+
+typedef struct _EMPopupHook EMPopupHook;
+typedef struct _EMPopupHookClass EMPopupHookClass;
+
+struct _EMPopupHook {
+ EPopupHook hook;
+};
+
+struct _EMPopupHookClass {
+ EPopupHookClass hook_class;
+};
+
+GType em_popup_hook_get_type(void);
#ifdef __cplusplus
}