aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog13
-rw-r--r--mail/Makefile.am2
-rw-r--r--mail/folder-browser.c41
-rw-r--r--mail/mail-callbacks.c39
-rw-r--r--mail/mail-callbacks.h3
-rw-r--r--mail/message-tag-editor.c151
-rw-r--r--mail/message-tag-editor.h74
7 files changed, 304 insertions, 19 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 771a3628b5..b6bf98a894 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,16 @@
+2002-02-08 Jeffrey Stedfast <fejj@ximian.com>
+
+ * message-tag-editor.[c,h]: Base class for a message tag editor.
+
+ * folder-browser.c (on_right_click): Setup the hide/enable masks
+ for "Flag for Follow-up"
+
+ * mail-callbacks.c (confirm_expunge): Instead of hiding deleted
+ messages and then expunging, disable the use of the message-list
+ completely during the expunge operation.
+ (expunged_folder): Re-enable the use of the message-list widget
+ here.
+
2002-02-07 Radek Doulik <rodo@ximian.com>
* mail-callbacks.c (mail_generate_reply): call set_body later to
diff --git a/mail/Makefile.am b/mail/Makefile.am
index cfe5da505c..ae237d2b90 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -106,6 +106,8 @@ evolution_mail_SOURCES = \
main.c \
message-list.c \
message-list.h \
+ message-tag-editor.c \
+ message-tag-editor.h \
subscribe-dialog.c \
subscribe-dialog.h \
mail.h
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 92ada2f612..a2ca2b2a0b 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -1431,7 +1431,9 @@ enum {
IS_MAILING_LIST = 1<<6,
CAN_RESEND = 1<<7,
CAN_MARK_IMPORTANT = 1<<8,
- CAN_MARK_UNIMPORTANT = 1<<9
+ CAN_MARK_UNIMPORTANT = 1<<9,
+ CAN_FLAG_FOR_FOLLOWUP = 1<<10,
+ CAN_FLAG_COMPLETED = 1<<11
};
#define MLIST_VFOLDER (3)
@@ -1466,7 +1468,15 @@ static EPopupMenu context_menu[] = {
{ N_("Reply to _List"), NULL, GTK_SIGNAL_FUNC (reply_to_list), NULL, 0 },
{ N_("Reply to _All"), NULL, GTK_SIGNAL_FUNC (reply_to_all), NULL, 0 },
{ N_("_Forward"), NULL, GTK_SIGNAL_FUNC (forward), NULL, 0 },
- { "", NULL, (NULL), NULL, 0 },
+
+ E_POPUP_SEPARATOR,
+
+ { N_("Flag for Follow-up"), NULL, GTK_SIGNAL_FUNC (flag_for_followup),NULL, CAN_FLAG_FOR_FOLLOWUP },
+ { N_("Flag Completed"), NULL, GTK_SIGNAL_FUNC (flag_completed), NULL, CAN_FLAG_COMPLETED },
+ { N_("Clear Flag"), NULL, GTK_SIGNAL_FUNC (flag_clear), NULL, CAN_FLAG_COMPLETED },
+
+ /* separator here? */
+
{ N_("Mar_k as Read"), NULL, GTK_SIGNAL_FUNC (mark_as_seen), NULL, CAN_MARK_READ },
{ N_("Mark as U_nread"), NULL, GTK_SIGNAL_FUNC (mark_as_unseen), NULL, CAN_MARK_UNREAD },
{ N_("Mark as _Important"), NULL, GTK_SIGNAL_FUNC (mark_as_important), NULL, CAN_MARK_IMPORTANT },
@@ -1511,6 +1521,12 @@ context_menu_position_func (GtkMenu *menu, gint *x, gint *y,
*y += ty + th / 2;
}
+static gboolean
+followup_tag_complete (const char *tag)
+{
+ return FALSE;
+}
+
/* handle context menu over message-list */
static int
on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, FolderBrowser *fb)
@@ -1561,6 +1577,10 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
gboolean have_unseen = FALSE;
gboolean have_important = FALSE;
gboolean have_unimportant = FALSE;
+ gboolean have_flag_for_followup = FALSE;
+ gboolean have_flag_completed = FALSE;
+ gboolean have_unflagged = FALSE;
+ const char *tag;
for (i = 0; i < uids->len; i++) {
info = camel_folder_get_message_info (fb->folder, uids->pdata[i]);
@@ -1582,6 +1602,13 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
else
have_unimportant = TRUE;
+ if ((tag = camel_tag_get (&info->user_tags, "follow-up"))) {
+ have_flag_for_followup = TRUE;
+ if (followup_tag_complete (tag))
+ have_flag_completed = TRUE;
+ } else
+ have_unflagged = TRUE;
+
camel_folder_free_message_info (fb->folder, info);
if (have_seen && have_unseen && have_deleted && have_undeleted)
@@ -1603,6 +1630,11 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
if (!have_important)
enable_mask |= CAN_MARK_UNIMPORTANT;
+ if (!have_unflagged)
+ enable_mask |= CAN_FLAG_FOR_FOLLOWUP;
+ if (!(have_flag_for_followup && have_flag_completed))
+ enable_mask |= CAN_FLAG_COMPLETED;
+
/*
* Hide items that wont get used.
*/
@@ -1626,6 +1658,11 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
else
hide_mask |= CAN_MARK_UNIMPORTANT;
}
+
+ if (!have_unflagged)
+ enable_mask |= CAN_FLAG_FOR_FOLLOWUP;
+ if (!(have_flag_for_followup && have_flag_completed))
+ enable_mask |= CAN_FLAG_COMPLETED;
}
/* free uids */
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index f2b7dd5064..2dcbec039c 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -1808,6 +1808,24 @@ toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path)
}
void
+flag_for_followup (BonoboUIComponent *uih, void *user_data, const char *path)
+{
+ ;
+}
+
+void
+flag_completed (BonoboUIComponent *uih, void *user_data, const char *path)
+{
+ ;
+}
+
+void
+flag_clear (BonoboUIComponent *uih, void *user_data, const char *path)
+{
+ ;
+}
+
+void
zoom_in (BonoboUIComponent *uih, void *user_data, const char *path)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
@@ -2230,24 +2248,16 @@ previous_flagged_msg (GtkWidget *button, gpointer user_data)
CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED, TRUE);
}
-struct _expunged_folder_data {
- FolderBrowser *fb;
- gboolean hidedeleted;
-};
-
static void
expunged_folder (CamelFolder *f, void *data)
{
- FolderBrowser *fb = ((struct _expunged_folder_data *) data)->fb;
- gboolean hidedeleted = ((struct _expunged_folder_data *) data)->hidedeleted;
+ FolderBrowser *fb = data;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
fb->expunging = NULL;
- message_list_set_hidedeleted (fb->message_list, hidedeleted);
-
- g_free (data);
+ gtk_widget_set_sensitive (GTK_WIDGET (fb->message_list), TRUE);
}
static gboolean
@@ -2300,15 +2310,10 @@ expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path)
return;
if (fb->folder && (fb->expunging == NULL || fb->folder != fb->expunging) && confirm_expunge (fb)) {
- struct _expunged_folder_data *data;
CamelMessageInfo *info;
- data = g_malloc (sizeof (*data));
- data->fb = fb;
- data->hidedeleted = fb->message_list->hidedeleted;
-
/* hide the deleted messages so user can't click on them while we expunge */
- message_list_set_hidedeleted (fb->message_list, TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (fb->message_list), FALSE);
/* Only blank the mail display if the message being
viewed is one of those to be expunged */
@@ -2320,7 +2325,7 @@ expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path)
}
fb->expunging = fb->folder;
- mail_expunge_folder (fb->folder, expunged_folder, data);
+ mail_expunge_folder (fb->folder, expunged_folder, fb);
}
}
diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h
index 389def266f..d4be330565 100644
--- a/mail/mail-callbacks.h
+++ b/mail/mail-callbacks.h
@@ -96,6 +96,9 @@ void mark_as_unseen (BonoboUIComponent *uih, void *user_data, const c
void mark_as_important (BonoboUIComponent *uih, void *user_data, const char *path);
void mark_as_unimportant (BonoboUIComponent *uih, void *user_data, const char *path);
void toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path);
+void flag_for_followup (BonoboUIComponent *uih, void *user_data, const char *path);
+void flag_completed (BonoboUIComponent *uih, void *user_data, const char *path);
+void flag_clear (BonoboUIComponent *uih, void *user_data, const char *path);
void zoom_in (BonoboUIComponent *uih, void *user_data, const char *path);
void zoom_out (BonoboUIComponent *uih, void *user_data, const char *path);
diff --git a/mail/message-tag-editor.c b/mail/message-tag-editor.c
new file mode 100644
index 0000000000..01934eaec9
--- /dev/null
+++ b/mail/message-tag-editor.c
@@ -0,0 +1,151 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors: Jeffrey Stedfast <fejj@ximian.com>
+ *
+ * Copyright 2002 Ximain, Inc. (www.ximian.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <libgnomeui/gnome-stock.h>
+#include "message-tag-editor.h"
+
+
+static void message_tag_editor_class_init (MessageTagEditorClass *class);
+static void message_tag_editor_init (MessageTagEditor *editor);
+static void message_tag_editor_finalise (GtkObject *obj);
+
+static const char *tag_get_name (MessageTagEditor *editor);
+static const char *tag_get_value (MessageTagEditor *editor);
+static void tag_set_value (MessageTagEditor *editor, const char *value);
+
+static GnomeDialogClass *parent_class;
+
+enum {
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+GtkType
+message_tag_editor_get_type (void)
+{
+ static GtkType type = 0;
+
+ if (!type) {
+ GtkTypeInfo type_info = {
+ "MessageTagEditor",
+ sizeof (MessageTagEditor),
+ sizeof (MessageTagEditorClass),
+ (GtkClassInitFunc) message_tag_editor_class_init,
+ (GtkObjectInitFunc) message_tag_editor_init,
+ (GtkArgSetFunc) NULL,
+ (GtkArgGetFunc) NULL
+ };
+
+ type = gtk_type_unique (gnome_dialog_get_type (), &type_info);
+ }
+
+ return type;
+}
+
+static void
+message_tag_editor_class_init (MessageTagEditorClass *klass)
+{
+ GtkObjectClass *object_class;
+
+ object_class = (GtkObjectClass *) klass;
+ parent_class = gtk_type_class (gnome_dialog_get_type ());
+
+ object_class->finalize = message_tag_editor_finalise;
+
+ klass->get_name = tag_get_name;
+ klass->get_value = tag_get_value;
+ klass->set_value = tag_set_value;
+}
+
+static void
+message_tag_editor_init (MessageTagEditor *editor)
+{
+ gtk_window_set_policy (GTK_WINDOW (editor), FALSE, TRUE, FALSE);
+
+ gnome_dialog_append_buttons (GNOME_DIALOG (editor),
+ GNOME_STOCK_BUTTON_OK,
+ GNOME_STOCK_BUTTON_CANCEL,
+ NULL);
+
+ gnome_dialog_set_default (GNOME_DIALOG (editor), 0);
+}
+
+
+static void
+message_tag_editor_finalise (GtkObject *obj)
+{
+ MessageTagEditor *editor = (MessageTagEditor *) obj;
+
+ ((GtkObjectClass *)(parent_class))->finalize (obj);
+}
+
+
+static const char *
+tag_get_name (MessageTagEditor *editor)
+{
+ return NULL;
+}
+
+const char *
+message_tag_editor_get_name (MessageTagEditor *editor)
+{
+ g_return_val_if_fail (IS_MESSAGE_TAG_EDITOR (editor), NULL);
+
+ return ((MessageTagEditorClass *)((GtkObject *) editor)->klass)->get_name (editor);
+}
+
+
+static const char *
+tag_get_value (MessageTagEditor *editor)
+{
+ return NULL;
+}
+
+const char *
+message_tag_editor_get_value (MessageTagEditor *editor)
+{
+ g_return_val_if_fail (IS_MESSAGE_TAG_EDITOR (editor), NULL);
+
+ return ((MessageTagEditorClass *)((GtkObject *) editor)->klass)->get_value (editor);
+}
+
+
+static void
+tag_set_value (MessageTagEditor *editor, const char *value)
+{
+ /* no-op */
+ ;
+}
+
+void
+message_tag_editor_set_value (MessageTagEditor *editor, const char *value)
+{
+ g_return_if_fail (IS_MESSAGE_TAG_EDITOR (editor));
+
+ ((MessageTagEditorClass *)((GtkObject *) editor)->klass)->set_value (editor, value);
+}
diff --git a/mail/message-tag-editor.h b/mail/message-tag-editor.h
new file mode 100644
index 0000000000..25b845ba41
--- /dev/null
+++ b/mail/message-tag-editor.h
@@ -0,0 +1,74 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors: Jeffrey Stedfast <fejj@ximian.com>
+ *
+ * Copyright 2002 Ximain, Inc. (www.ximian.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#ifndef __MESSAGE_TAG_EDITOR_H__
+#define __MESSAGE_TAG_EDITOR_H__
+
+#include <gtk/gtkwidget.h>
+#include <libgnomeui/gnome-dialog.h>
+#include <camel/camel-folder.h>
+#include <camel/camel-folder-summary.h>
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+#define MESSAGE_TAG_EDITOR(obj) GTK_CHECK_CAST (obj, message_tag_editor_get_type (), MessageTagEditor)
+#define MESSAGE_TAG_EDITOR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, message_tag_editor_get_type (), MessageTagEditorClass)
+#define IS_MESSAGE_TAG_EDITOR(obj) GTK_CHECK_TYPE (obj, message_tag_editor_get_type ())
+
+typedef struct _MessageTagEditor MessageTagEditor;
+typedef struct _MessageTagEditorClass MessageTagEditorClass;
+
+struct _MessageTagEditor {
+ GnomeDialog parent;
+
+};
+
+struct _MessageTagEditorClass {
+ GnomeDialogClass parent_class;
+
+ /* virtual methods */
+ const char * (*get_name) (MessageTagEditor *editor);
+
+ const char * (*get_value) (MessageTagEditor *editor);
+ void (*set_value) (MessageTagEditor *editor, const char *value);
+
+ /* signals */
+};
+
+
+GtkType message_tag_editor_get_type (void);
+
+/* methods */
+const char *message_tag_editor_get_name (MessageTagEditor *editor);
+const char *message_tag_editor_get_value (MessageTagEditor *editor);
+void message_tag_editor_set_value (MessageTagEditor *editor, const char *value);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __MESSAGE_TAG_EDITOR_H__ */