[anjal] read/unread del/junk buttons now operate on the thread.
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: svn-commits-list gnome org
- Subject: [anjal] read/unread del/junk buttons now operate on the thread.
- Date: Mon, 30 Mar 2009 12:55:23 -0400 (EDT)
commit 9d6caf6b0146c5a9a284745db354778b1c377e95
Author: Srinivasa Ragavan <sragavan novell com>
Date: Mon Mar 30 22:20:26 2009 +0530
read/unread del/junk buttons now operate on the thread.
---
src/mail-folder-view.c | 92 +++++++++++++++++++++++++++--------------------
1 files changed, 53 insertions(+), 39 deletions(-)
diff --git a/src/mail-folder-view.c b/src/mail-folder-view.c
index f43f441..58c08e0 100644
--- a/src/mail-folder-view.c
+++ b/src/mail-folder-view.c
@@ -886,44 +886,6 @@ mfv_tree_resize (GtkWidget *w, GtkAllocation *req, GtkTreeViewColumn *col)
gtk_tree_view_column_set_fixed_width (col, req->width - 24);
}
-static CamelMessageInfo *
-mfv_get_info (GObject *obj, char *path)
-{
- GtkTreeIter iter;
- MailFolderView *mfv = g_object_get_data(obj, "mfv");
- return em_tree_store_get_info_from_path_string (mfv->model, path);
-
-}
-static gboolean
-mfv_msg_delete (GtkCellRenderer *cell, GdkEvent *event,GtkWidget *widget,const gchar *path,const GdkRectangle *background_area,const GdkRectangle *cell_area,GtkCellRendererState flags)
-{
- CamelMessageInfo *info = mfv_get_info (cell, path);
-
- camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED );
- return TRUE;
-}
-
-static gboolean
-mfv_msg_unread (GtkCellRenderer *cell, GdkEvent *event,GtkWidget *widget,const gchar *path,const GdkRectangle *background_area,const GdkRectangle *cell_area,GtkCellRendererState flags)
-{
- CamelMessageInfo *info = mfv_get_info (cell, path);
-
- if (camel_message_info_flags(info) & CAMEL_MESSAGE_SEEN)
- camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, 0);
- else
- camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
-
- return TRUE;
-}
-
-static gboolean
-mfv_msg_junk (GtkCellRenderer *cell, GdkEvent *event,GtkWidget *widget,const gchar *path,const GdkRectangle *background_area,const GdkRectangle *cell_area,GtkCellRendererState flags)
-{
- CamelMessageInfo *info = mfv_get_info (cell, path);
-
- camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_NOTJUNK|CAMEL_MESSAGE_JUNK_LEARN, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN);
- return TRUE;
-}
static void
mfv_selection_mark (MailFolderView *mfv, guint32 mask, guint32 set)
@@ -972,6 +934,55 @@ mfv_read (MailFolderView *mfv, gboolean read)
mfv_selection_mark (mfv, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, 0);
}
+static CamelMessageInfo *
+mfv_get_info (GObject *obj, char *path)
+{
+ GtkTreeIter iter;
+ MailFolderView *mfv = g_object_get_data(obj, "mfv");
+ return em_tree_store_get_info_from_path_string (mfv->model, path);
+
+}
+static gboolean
+mfv_msg_delete (GtkCellRenderer *cell, GdkEvent *event,GtkWidget *widget,const gchar *path,const GdkRectangle *background_area,const GdkRectangle *cell_area,GtkCellRendererState flags)
+{
+ MailFolderView *mfv = g_object_get_data(cell, "mfv");
+
+ mfv_selection_mark (mfv, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED );
+ return TRUE;
+}
+
+static gboolean
+mfv_msg_unread (GtkCellRenderer *cell, GdkEvent *event,GtkWidget *widget,const gchar *path,const GdkRectangle *background_area,const GdkRectangle *cell_area,GtkCellRendererState flags)
+{
+ MailFolderView *mfv = g_object_get_data(cell, "mfv");
+ CustomCellRendererTogglePixbuf *toggle = (CustomCellRendererTogglePixbuf *)cell;
+ gboolean active = toggle->active;
+
+ if (active)
+ mfv_selection_mark (mfv, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
+ else
+ mfv_selection_mark (mfv, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, 0);
+ /*
+ if (camel_message_info_flags(info) & CAMEL_MESSAGE_SEEN)
+ camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, 0);
+ else
+ camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
+ */
+ return TRUE;
+}
+
+static gboolean
+mfv_msg_junk (GtkCellRenderer *cell, GdkEvent *event,GtkWidget *widget,const gchar *path,const GdkRectangle *background_area,const GdkRectangle *cell_area,GtkCellRendererState flags)
+{
+ CamelMessageInfo *info = mfv_get_info (cell, path);
+ MailFolderView *mfv = g_object_get_data(cell, "mfv");
+
+ mfv_selection_mark (mfv, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_NOTJUNK|CAMEL_MESSAGE_JUNK_LEARN, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN);
+ // camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_NOTJUNK|CAMEL_MESSAGE_JUNK_LEARN, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN);
+ return TRUE;
+}
+
+
static gboolean
mfv_key_pressed (GtkWidget *w, GdkEventKey *event, MailFolderView *mfv)
{
@@ -1064,6 +1075,7 @@ mail_folder_view_construct (MailFolderView *shell)
/* Pack a renderer for unread indication */
cell = custom_cell_renderer_toggle_pixbuf_new (gdk_pixbuf_new_from_file(unread_image, NULL), gdk_pixbuf_new_from_file(unread_image, NULL));
+ g_object_set_data (cell, "mfv", shell);
g_object_set_data (cell, "activate_func", mfv_msg_unread);
if (shell->priv->light)
g_object_set_data (cell, "data", GINT_TO_POINTER (COL_FLAGS));
@@ -1203,6 +1215,7 @@ mail_folder_view_construct (MailFolderView *shell)
/* Cell rendere for Delete */
cell = custom_cell_renderer_toggle_pixbuf_new (e_icon_factory_get_icon ("stock_delete", E_ICON_SIZE_MENU), e_icon_factory_get_icon ("stock_delete", E_ICON_SIZE_MENU));
+ g_object_set_data (cell, "mfv", shell);
custom_cell_renderer_vbox_append (vbox, cell);
g_object_set_data (cell, "data", "stock_delete");
g_object_set_data (cell, "sel-highlight", GINT_TO_POINTER(1));
@@ -1218,7 +1231,8 @@ mail_folder_view_construct (MailFolderView *shell)
}
/* Cell rendere for Junk */
- cell = custom_cell_renderer_toggle_pixbuf_new (e_icon_factory_get_icon ("mail-mark-junk", E_ICON_SIZE_MENU), e_icon_factory_get_icon ("mail-mark-junk", E_ICON_SIZE_MENU));
+ cell = custom_cell_renderer_toggle_pixbuf_new (e_icon_factory_get_icon ("mail-mark-junk", E_ICON_SIZE_MENU), e_icon_factory_get_icon ("mail-mark-junk", E_ICON_SIZE_MENU));
+ g_object_set_data (cell, "mfv", shell);
custom_cell_renderer_vbox_append (vbox, cell);
g_object_set_data (cell, "sel-highlight", GINT_TO_POINTER(1));
g_object_set_data (cell, "data", "mail-mark-junk");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]