diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2008-10-25 07:02:33 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2008-10-25 07:02:33 +0800 |
commit | e7a31c5035a0afeed6c1675e30487c1e2bdc139f (patch) | |
tree | eb1e733a6fe69773498725efa64304a9234270bc /mail | |
parent | 95cae9b166587d19db3aadde6a21cc12c30da6e6 (diff) | |
download | gsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.tar.gz gsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.tar.zst gsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.zip |
Commit recent work so I can merge from trunk.
svn path=/branches/kill-bonobo/; revision=36684
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-shell-content.c | 12 | ||||
-rw-r--r-- | mail/e-mail-shell-content.h | 22 | ||||
-rw-r--r-- | mail/e-mail-shell-sidebar.c | 100 | ||||
-rw-r--r-- | mail/e-mail-shell-sidebar.h | 10 | ||||
-rw-r--r-- | mail/e-mail-shell-view-actions.c | 15 | ||||
-rw-r--r-- | mail/e-mail-shell-view-private.c | 20 | ||||
-rw-r--r-- | mail/e-mail-shell-view.c | 59 | ||||
-rw-r--r-- | mail/em-folder-selector.c | 135 | ||||
-rw-r--r-- | mail/em-folder-selector.h | 40 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 22 | ||||
-rw-r--r-- | mail/em-folder-tree.h | 1 | ||||
-rw-r--r-- | mail/em-folder-utils.c | 2 |
12 files changed, 350 insertions, 88 deletions
diff --git a/mail/e-mail-shell-content.c b/mail/e-mail-shell-content.c index 84651d0b1c..144d70d671 100644 --- a/mail/e-mail-shell-content.c +++ b/mail/e-mail-shell-content.c @@ -184,6 +184,17 @@ mail_shell_content_constructed (GObject *object) gconf_bridge_bind_property_delayed (bridge, key, object, "position"); } +static guint32 +mail_shell_content_check_state (EShellContent *shell_content) +{ + EMailShellContent *mail_shell_content; + guint32 state = 0; + + mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content); + + return state; +} + static void mail_shell_content_class_init (EMailShellContentClass *class) { @@ -202,6 +213,7 @@ mail_shell_content_class_init (EMailShellContentClass *class) shell_content_class = E_SHELL_CONTENT_CLASS (class); shell_content_class->new_search_context = em_search_context_new; + shell_content_class->check_state = mail_shell_content_check_state; g_object_class_install_property ( object_class, diff --git a/mail/e-mail-shell-content.h b/mail/e-mail-shell-content.h index dddaf589d7..09ab5c8fda 100644 --- a/mail/e-mail-shell-content.h +++ b/mail/e-mail-shell-content.h @@ -50,6 +50,28 @@ typedef struct _EMailShellContent EMailShellContent; typedef struct _EMailShellContentClass EMailShellContentClass; typedef struct _EMailShellContentPrivate EMailShellContentPrivate; +enum { + E_MAIL_SHELL_CONTENT_SELECTION_SINGLE = 1 << 0, + E_MAIL_SHELL_CONTENT_SELECTION_MULTIPLE = 1 << 1, + E_MAIL_SHELL_CONTENT_SELECTION_CAN_ADD_SENDER = 1 << 2, + E_MAIL_SHELL_CONTENT_SELECTION_CAN_DELETE = 1 << 3, + E_MAIL_SHELL_CONTENT_SELECTION_CAN_EDIT = 1 << 4, + E_MAIL_SHELL_CONTENT_SELECTION_CAN_UNDELETE = 1 << 5, + E_MAIL_SHELL_CONTENT_SELECTION_FLAG_CLEAR = 1 << 6, + E_MAIL_SHELL_CONTENT_SELECTION_FLAG_COMPLETED = 1 << 7, + E_MAIL_SHELL_CONTENT_SELECTION_FLAG_FOLLOWUP = 1 << 8, + E_MAIL_SHELL_CONTENT_SELECTION_HAS_IMPORTANT = 1 << 9, + E_MAIL_SHELL_CONTENT_SELECTION_HAS_JUNK = 1 << 10, + E_MAIL_SHELL_CONTENT_SELECTION_HAS_NOT_JUNK = 1 << 11, + E_MAIL_SHELL_CONTENT_SELECTION_HAS_READ = 1 << 12, + E_MAIL_SHELL_CONTENT_SELECTION_HAS_UNIMPORTANT = 1 << 13, + E_MAIL_SHELL_CONTENT_SELECTION_HAS_UNREAD = 1 << 14, + E_MAIL_SHELL_CONTENT_SELECTION_HAS_URI_CALLTO = 1 << 15, + E_MAIL_SHELL_CONTENT_SELECTION_HAS_URI_HTTP = 1 << 16, + E_MAIL_SHELL_CONTENT_SELECTION_HAS_URI_MAILTO = 1 << 17, + E_MAIL_SHELL_CONTENT_SELECTION_IS_MAILING_LIST = 1 << 18 +}; + struct _EMailShellContent { EShellContent parent; EMailShellContentPrivate *priv; diff --git a/mail/e-mail-shell-sidebar.c b/mail/e-mail-shell-sidebar.c index 9c8aa9ed1b..e0b09e7665 100644 --- a/mail/e-mail-shell-sidebar.c +++ b/mail/e-mail-shell-sidebar.c @@ -21,8 +21,6 @@ #include "e-mail-shell-sidebar.h" -#include "mail/em-folder-tree.h" - #define E_MAIL_SHELL_SIDEBAR_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_MAIL_SHELL_SIDEBAR, EMailShellSidebarPrivate)) @@ -32,7 +30,8 @@ struct _EMailShellSidebarPrivate { }; enum { - PROP_0 + PROP_0, + PROP_FOLDER_TREE }; static gpointer parent_class; @@ -43,6 +42,14 @@ mail_shell_sidebar_get_property (GObject *object, GValue *value, GParamSpec *pspec) { + switch (property_id) { + case PROP_FOLDER_TREE: + g_value_set_object ( + value, e_mail_shell_sidebar_get_folder_tree ( + E_MAIL_SHELL_SIDEBAR (object))); + return; + } + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } @@ -115,10 +122,75 @@ mail_shell_sidebar_constructed (GObject *object) gtk_widget_show (widget); } +static guint32 +mail_shell_sidebar_check_state (EShellSidebar *shell_sidebar) +{ + EMailShellSidebar *mail_shell_sidebar; + EShellModule *shell_module; + EShellView *shell_view; + EMFolderTree *folder_tree; + GtkTreeSelection *selection; + GtkTreeView *tree_view; + GtkTreeModel *model; + GtkTreeIter iter; + CamelFolder *folder; + CamelStore *local_store; + CamelStore *store; + gchar *full_name; + gchar *uri; + gboolean is_virtual = FALSE; + gboolean can_delete = TRUE; + gboolean is_outbox = FALSE; + gboolean is_store; + guint32 folder_flags = 0; + guint32 state = 0; + + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_module = e_shell_view_get_shell_module (shell_view); + local_store = e_mail_shell_module_get_local_store (shell_module); + + mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar); + folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); + tree_view = GTK_TREE_VIEW (folder_tree); + + selection = gtk_tree_view_get_selection (tree_view); + if (!emft_selection_get_selected (selection, &model, &iter)) + return 0; + + gtk_tree_model_get ( + model, &iter, + COL_POINTER_CAMEL_STORE, &store, + COL_STRING_FULL_NAME, &full_name, + COL_BOOL_IS_STORE, &is_store, + COL_UINT_FLAGS, &folder_flags, + COL_STRING_URI, &uri, NULL); + + if (!is_store) { + if (strcmp (full_name, CAMEL_VJUNK_NAME) == 0) + is_virtual = TRUE; + + if (strcmp (full_name, CAMEL_VTRASH_NAME) == 0) + is_virtual = TRUE; + + folder = em_folder_tree_get_selected_folder (folder_tree); + is_outbox = em_utils_folder_is_outbox (folder, NULL); + } + + if (is_virtual) + state |= E_BOOK_SHELL_SIDEBAR_ALLOWS_CHILDREN; + if (is_outbox) + state |= E_BOOK_SHELL_SIDEBAR_FOLDER_IS_OUTBOX; + if (is_store) + state |= E_BOOK_SHELL_SIDEBAR_FOLDER_IS_STORE; + + return state; +} + static void mail_shell_sidebar_class_init (EMailShellSidebarClass *class) { GObjectClass *object_class; + EShellSidebarClass *shell_sidebar_class; parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EMailShellSidebarPrivate)); @@ -128,6 +200,19 @@ mail_shell_sidebar_class_init (EMailShellSidebarClass *class) object_class->dispose = mail_shell_sidebar_dispose; object_class->finalize = mail_shell_sidebar_finalize; object_class->constructed = mail_shell_sidebar_constructed; + + shell_sidebar_class = E_SHELL_SIDEBAR_CLASS (class); + shell_sidebar_class->check_state = mail_shell_sidebar_check_state; + + g_object_class_install_property ( + object_class, + PROP_FOLDER_TREE, + g_param_spec_object ( + "folder-tree", + NULL, + NULL, + EM_TYPE_FOLDER_TREE, + G_PARAM_READABLE)); } static void @@ -175,3 +260,12 @@ e_mail_shell_sidebar_new (EShellView *shell_view) E_TYPE_MAIL_SHELL_SIDEBAR, "shell-view", shell_view, NULL); } + +EMFolderTree * +e_mail_shell_sidebar_get_folder_tree (EMailShellSidebar *mail_shell_sidebar) +{ + g_return_val_if_fail ( + E_IS_MAIL_SHELL_SIDEBAR (mail_shell_sidebar), NULL); + + return mail_shell_sidebar->priv->folder_tree; +} diff --git a/mail/e-mail-shell-sidebar.h b/mail/e-mail-shell-sidebar.h index ff35b96c0d..8c4e2404b3 100644 --- a/mail/e-mail-shell-sidebar.h +++ b/mail/e-mail-shell-sidebar.h @@ -24,6 +24,7 @@ #include <shell/e-shell-sidebar.h> #include <shell/e-shell-view.h> +#include <mail/em-folder-tree.h> /* Standard GObject macros */ #define E_TYPE_MAIL_SHELL_SIDEBAR \ @@ -50,6 +51,13 @@ typedef struct _EMailShellSidebar EMailShellSidebar; typedef struct _EMailShellSidebarClass EMailShellSidebarClass; typedef struct _EMailShellSidebarPrivate EMailShellSidebarPrivate; +enum { + E_BOOK_SHELL_SIDEBAR_FOLDER_ALLOWS_CHILDREN = 1 << 0, + E_BOOK_SHELL_SIDEBAR_FOLDER_CAN_DELETE = 1 << 1, + E_BOOK_SHELL_SIDEBAR_FOLDER_IS_OUTBOX = 1 << 2, + E_BOOK_SHELL_SIDEBAR_FOLDER_IS_STORE = 1 << 3 +}; + struct _EMailShellSidebar { EShellSidebar parent; EMailShellSidebarPrivate *priv; @@ -61,6 +69,8 @@ struct _EMailShellSidebarClass { GType e_mail_shell_sidebar_get_type (void); GtkWidget * e_mail_shell_sidebar_new (EShellView *shell_view); +EMFolderTree * e_mail_shell_sidebar_get_folder_tree + (EMailShellSidebar *mail_shell_sidebar); G_END_DECLS diff --git a/mail/e-mail-shell-view-actions.c b/mail/e-mail-shell-view-actions.c index c78c562143..59edcce943 100644 --- a/mail/e-mail-shell-view-actions.c +++ b/mail/e-mail-shell-view-actions.c @@ -166,6 +166,14 @@ action_mail_flag_for_followup_cb (GtkAction *action, } static void +action_mail_flush_outbox_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void action_mail_folder_copy_cb (GtkAction *action, EMailShellView *mail_shell_view) { @@ -891,6 +899,13 @@ static GtkActionEntry mail_entries[] = { N_("Flag the selected messages for follow-up"), G_CALLBACK (action_mail_flag_for_followup_cb) }, + { "mail-flush-outbox", + "mail-send", + N_("Fl_ush Outbox"), + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_mail_flush_outbox_cb) }, + { "mail-folder-copy", "folder-copy", N_("_Copy Folder To..."), diff --git a/mail/e-mail-shell-view-private.c b/mail/e-mail-shell-view-private.c index ebbde76d03..9287ed777e 100644 --- a/mail/e-mail-shell-view-private.c +++ b/mail/e-mail-shell-view-private.c @@ -24,6 +24,16 @@ #include <widgets/menus/gal-view-factory-etable.h> static void +mail_shell_view_folder_tree_popup_event_cb (EShellView *shell_view, + GdkEventButton *event) +{ + const gchar *widget_path; + + widget_path = "/mail-folder-popup"; + e_shell_view_show_popup_menu (shell_view, widget_path, event); +} + +static void mail_shell_view_load_view_collection (EShellViewClass *shell_view_class) { GalViewCollection *collection; @@ -93,9 +103,11 @@ void e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) { EMailShellViewPrivate *priv = mail_shell_view->priv; + EMailShellSidebar *mail_shell_sidebar; EShellView *shell_view; EShellContent *shell_content; EShellSidebar *shell_sidebar; + EMFolderTree *folder_tree; shell_view = E_SHELL_VIEW (mail_shell_view); shell_content = e_shell_view_get_shell_content (shell_view); @@ -105,6 +117,14 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) priv->mail_shell_content = g_object_ref (shell_content); priv->mail_shell_sidebar = g_object_ref (shell_content); + mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar); + folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); + + g_signal_connect_swapped ( + folder_tree, "popup-event", + G_CALLBACK (mail_shell_view_folder_tree_popup_event_cb), + mail_shell_view); + e_mail_shell_view_actions_init (mail_shell_view); } diff --git a/mail/e-mail-shell-view.c b/mail/e-mail-shell-view.c index 1097b280fe..9059bbb9e6 100644 --- a/mail/e-mail-shell-view.c +++ b/mail/e-mail-shell-view.c @@ -67,7 +67,64 @@ mail_shell_view_constructed (GObject *object) static void mail_shell_view_update_actions (EShellView *shell_view) { - /* FIXME */ + EMailShellViewPrivate *priv; + EMailShellSidebar *mail_shell_sidebar; + EShellWindow *shell_window; + EMFolderTree *folder_tree; + GtkAction *action; + CamelURL *camel_url; + gchar *uri; + gboolean sensitive; + gboolean visible; + + priv = E_MAIL_SHELL_VIEW_GET_PRIVATE (shell_view); + + shell_window = e_shell_view_get_shell_window (shell_view); + + mail_shell_sidebar = priv->mail_shell_sidebar; + folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); + + uri = em_folder_tree_get_selected_uri (folder_tree); + camel_url = camel_url_new (uri, NULL); + g_free (uri); + + action = ACTION (MAIL_EMPTY_TRASH); + visible = is_trash; + gtk_action_set_visible (action, visible); + + action = ACTION (MAIL_FLUSH_OUTBOX); + visible = is_outbox; + gtk_action_set_visible (action, visible); + + action = ACTION (MAIL_FOLDER_COPY); + sensitive = is_folder && is_selected; + gtk_action_set_sensitive (action, sensitive); + + action = ACTION (MAIL_FOLDER_DELETE); + sensitive = is_folder && can_delete; + gtk_action_set_sensitive (action, sensitive); + + action = ACTION (MAIL_FOLDER_MOVE); + sensitive = is_folder && can_delete; + gtk_action_set_sensitive (action, sensitive); + + action = ACTION (MAIL_FOLDER_NEW); + sensitive = inferiors; + gtk_action_set_sensitive (action, sensitive); + + action = ACTION (MAIL_FOLDER_PROPERTIES); + sensitive = is_folder && is_selected; + gtk_action_set_sensitive (action, sensitive); + + action = ACTION (MAIL_FOLDER_REFRESH); + sensitive = is_folder && is_selected; + visible = nonstatic; + gtk_action_set_sensitive (action, sensitive); + gtk_action_set_visible (action, visible); + + action = ACTION (MAIL_FOLDER_RENAME); + sensitive = is_folder && can_delete; + gtk_action_set_sensitive (action, sensitive); } static void diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c index ff935674e2..ee7a515716 100644 --- a/mail/em-folder-selector.c +++ b/mail/em-folder-selector.c @@ -21,14 +21,8 @@ * */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #include <string.h> - #include <glib/gi18n.h> - #include <e-util/e-util.h> #include <misc/e-gui-utils.h> @@ -42,87 +36,84 @@ #define d(x) - extern CamelSession *session; +static gpointer parent_class; +static void +folder_selector_finalize (GObject *object) +{ + EMFolderSelector *emfs = EM_FOLDER_SELECTOR (object); -static void em_folder_selector_class_init (EMFolderSelectorClass *klass); -static void em_folder_selector_init (EMFolderSelector *emfs); -static void em_folder_selector_destroy (GtkObject *obj); -static void em_folder_selector_finalize (GObject *obj); - - -static GtkDialogClass *parent_class = NULL; + g_free (emfs->selected_path); + g_free (emfs->selected_uri); + g_free (emfs->created_uri); + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (parent_class)->finalize (object); +} -GType -em_folder_selector_get_type (void) +static void +folder_selector_destroy (GtkObject *object) { - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (EMFolderSelectorClass), - NULL, /* base_class_init */ - NULL, /* base_class_finalize */ - (GClassInitFunc) em_folder_selector_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EMFolderSelector), - 0, /* n_preallocs */ - (GInstanceInitFunc) em_folder_selector_init, - }; + EMFolderSelector *emfs = EM_FOLDER_SELECTOR (object); + EMFolderTreeModel *model; - type = g_type_register_static (GTK_TYPE_DIALOG, "EMFolderSelector", &info, 0); + if (emfs->created_id != 0) { + model = em_folder_tree_get_model (emfs->emft); + g_signal_handler_disconnect (model, emfs->created_id); + emfs->created_id = 0; } - return type; + /* Chain up to parent's destroy() method. */ + GTK_OBJECT_CLASS (parent_class)->destroy (object); } static void -em_folder_selector_class_init (EMFolderSelectorClass *klass) +folder_selector_class_init (EMFolderSelectorClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); + GObjectClass *object_class; + GtkObjectClass *gtk_object_class; - parent_class = g_type_class_ref (GTK_TYPE_DIALOG); + parent_class = g_type_class_peek_parent (class); - object_class->finalize = em_folder_selector_finalize; - gtk_object_class->destroy = em_folder_selector_destroy; + object_class = G_OBJECT_CLASS (class); + object_class->finalize = folder_selector_finalize; + + gtk_object_class = GTK_OBJECT_CLASS (class); + gtk_object_class->destroy = folder_selector_destroy; } static void -em_folder_selector_init (EMFolderSelector *emfs) +folder_selector_init (EMFolderSelector *emfs) { emfs->selected_path = NULL; emfs->selected_uri = NULL; } -static void -em_folder_selector_destroy (GtkObject *obj) +GType +em_folder_selector_get_type (void) { - EMFolderSelector *emfs = (EMFolderSelector *) obj; - EMFolderTreeModel *model; - - if (emfs->created_id != 0) { - model = em_folder_tree_get_model (emfs->emft); - g_signal_handler_disconnect (model, emfs->created_id); - emfs->created_id = 0; - } - - GTK_OBJECT_CLASS (parent_class)->destroy (obj); -} + static GType type = 0; -static void -em_folder_selector_finalize (GObject *obj) -{ - EMFolderSelector *emfs = (EMFolderSelector *) obj; + if (G_UNLIKELY (type == 0)) { + static const GTypeInfo type_info = { + sizeof (EMFolderSelectorClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) folder_selector_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EMFolderSelector), + 0, /* n_preallocs */ + (GInstanceInitFunc) folder_selector_init, + NULL /* value_table */ + }; - g_free (emfs->selected_path); - g_free (emfs->selected_uri); - g_free (emfs->created_uri); + type = g_type_register_static ( + GTK_TYPE_DIALOG, "EMFolderSelector", &type_info, 0); + } - G_OBJECT_CLASS (parent_class)->finalize (obj); + return type; } static void @@ -172,7 +163,7 @@ folder_activated_cb (EMFolderTree *emft, const char *path, const char *uri, EMFo void em_folder_selector_construct (EMFolderSelector *emfs, EMFolderTree *emft, guint32 flags, const char *title, const char *text, const char *oklabel) { - GtkWidget *label; + GtkWidget *widget; gtk_window_set_modal (GTK_WINDOW (emfs), FALSE); gtk_window_set_default_size (GTK_WINDOW (emfs), 350, 300); @@ -194,19 +185,29 @@ em_folder_selector_construct (EMFolderSelector *emfs, EMFolderTree *emft, guint3 gtk_dialog_set_response_sensitive (GTK_DIALOG (emfs), GTK_RESPONSE_OK, FALSE); gtk_dialog_set_default_response (GTK_DIALOG (emfs), GTK_RESPONSE_OK); + widget = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy ( + GTK_SCROLLED_WINDOW (widget), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type ( + GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN); + gtk_box_pack_end ( + GTK_BOX (GTK_DIALOG (emfs)->vbox), widget, TRUE, TRUE, 6); + gtk_widget_show (widget); + emfs->emft = emft; - gtk_widget_show ((GtkWidget *) emft); + gtk_container_add (GTK_CONTAINER (widget), GTK_WIDGET (emft)); + gtk_widget_show (GTK_WIDGET (emft)); g_signal_connect (emfs->emft, "folder-selected", G_CALLBACK (folder_selected_cb), emfs); g_signal_connect (emfs->emft, "folder-activated", G_CALLBACK (folder_activated_cb), emfs); - gtk_box_pack_end (GTK_BOX (GTK_DIALOG (emfs)->vbox), (GtkWidget *)emft, TRUE, TRUE, 6); if (text != NULL) { - label = gtk_label_new (text); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - gtk_widget_show (label); + widget = gtk_label_new (text); + gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_LEFT); + gtk_widget_show (widget); - gtk_box_pack_end (GTK_BOX (GTK_DIALOG (emfs)->vbox), label, FALSE, TRUE, 6); + gtk_box_pack_end (GTK_BOX (GTK_DIALOG (emfs)->vbox), widget, FALSE, TRUE, 6); } gtk_widget_grab_focus ((GtkWidget *) emfs->emft); diff --git a/mail/em-folder-selector.h b/mail/em-folder-selector.h index 06b1bc4520..a97831ec95 100644 --- a/mail/em-folder-selector.h +++ b/mail/em-folder-selector.h @@ -26,20 +26,30 @@ #include <gtk/gtk.h> -#ifdef cplusplus -extern "C" { -#pragma } -#endif /* cplusplus */ - -#define EM_TYPE_FOLDER_SELECTOR (em_folder_selector_get_type ()) -#define EM_FOLDER_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EM_TYPE_FOLDER_SELECTOR, EMFolderSelector)) -#define EM_FOLDER_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EM_TYPE_FOLDER_SELECTOR, EMFolderSelectorClass)) -#define EM_IS_FOLDER_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EM_TYPE_FOLDER_SELECTOR)) -#define EM_IS_FOLDER_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EM_TYPE_FOLDER_SELECTOR)) - -typedef struct _EMFolderSelector EMFolderSelector; +/* Standard GObject macros */ +#define EM_TYPE_FOLDER_SELECTOR \ + (em_folder_selector_get_type ()) +#define EM_FOLDER_SELECTOR(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), EM_TYPE_FOLDER_SELECTOR, EMFolderSelector)) +#define EM_FOLDER_SELECTOR_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), EM_TYPE_FOLDER_SELECTOR, EMFolderSelectorClass)) +#define EM_IS_FOLDER_SELECTOR(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), EM_TYPE_FOLDER_SELECTOR)) +#define EM_IS_FOLDER_SELECTOR_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), EM_TYPE_FOLDER_SELECTOR)) +#define EM_FOLDER_SELECTOR_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), EM_TYPE_FOLDER_SELECTOR, EMFolderSelectorClass)) + +G_BEGIN_DECLS + +typedef struct _EMFolderSelector EMFolderSelector; +typedef struct _EMFolderSelectorClass EMFolderSelectorClass; typedef struct _EMFolderSelectorPrivate EMFolderSelectorPrivate; -typedef struct _EMFolderSelectorClass EMFolderSelectorClass; struct _EMFolderSelector { GtkDialog parent; @@ -87,8 +97,6 @@ const char *em_folder_selector_get_selected_path (EMFolderSelector *emfs); GList *em_folder_selector_get_selected_uris (EMFolderSelector *emfs); GList *em_folder_selector_get_selected_paths (EMFolderSelector *emfs); -#ifdef cplusplus -} -#endif /* cplusplus */ +G_END_DECLS #endif /* EM_FOLDER_SELECTOR_H */ diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 20564302f6..b2d95cd71b 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -118,6 +118,7 @@ struct _EMFolderTreePrivate { enum { FOLDER_ACTIVATED, /* aka double-clicked or user hit enter */ FOLDER_SELECTED, + POPUP_EVENT, LAST_SIGNAL }; @@ -177,6 +178,13 @@ struct _emft_selection_data { static gpointer parent_class = NULL; static void +folder_tree_emit_popup_event (EMFolderTree *emft, + GdkEvent *event) +{ + g_signal_emit (emft, signals[POPUP_EVENT], 0, event); +} + +static void emft_free_select_uri (struct _selected_uri *u) { g_free (u->uri); @@ -284,6 +292,16 @@ folder_tree_class_init (EMFolderTreeClass *class) G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); + + signals[POPUP_EVENT] = g_signal_new ( + "popup-event", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (EMFolderTreeClass, popup_event), + NULL, NULL, + g_cclosure_marshal_VOID__BOXED, + G_TYPE_NONE, 1, + GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); } static void @@ -2229,6 +2247,9 @@ emft_popup (EMFolderTree *emft, GdkEvent *event) info_flags |= CAMEL_FOLDER_TYPE_OUTBOX; } + folder_tree_emit_popup_event (emft, event); + +#if 0 /* KILL-BONOBO */ /** @HookPoint-EMPopup: Folder Tree Context Menu * @Id: org.gnome.evolution.mail.foldertree.popup * @Class: org.gnome.evolution.mail.popup:1.0 @@ -2257,6 +2278,7 @@ emft_popup (EMFolderTree *emft, GdkEvent *event) } else { gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button.button, event->button.time); } +#endif g_free (full_name); g_free (uri); diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h index 1a838baea6..f0dfe72d10 100644 --- a/mail/em-folder-tree.h +++ b/mail/em-folder-tree.h @@ -79,6 +79,7 @@ struct _EMFolderTreeClass { const gchar *full_name, const gchar *uri, guint32 flags); + void (*popup_event) (EMFolderTree *emft); }; GType em_folder_tree_get_type (void); diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index 9726f6c552..aa9e6aa402 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -690,7 +690,7 @@ em_folder_utils_create_folder (CamelFolderInfo *folderinfo, EMFolderTree *emft) model = e_mail_shell_module_get_folder_tree_model (mail_shell_module); folder_tree = (EMFolderTree *) em_folder_tree_new_with_model (model); - dialog = em_folder_selector_create_new (folder_tree, 0, _("Create folder"), _("Specify where to create the folder:")); + dialog = em_folder_selector_create_new (folder_tree, 0, _("Create Folder"), _("Specify where to create the folder:")); if (folderinfo != NULL) em_folder_selector_set_selected ((EMFolderSelector *) dialog, folderinfo->uri); g_signal_connect (dialog, "response", G_CALLBACK (emfu_popup_new_folder_response), emft); |