aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucian Langa <lucilanga@gnome.org>2008-07-28 03:15:42 +0800
committerLucian Langa <lucilanga@src.gnome.org>2008-07-28 03:15:42 +0800
commit60f7e7bf1c9c8bc848591d4574e59ca2b356885a (patch)
tree66e1ed3bf72d80f4747358c3af6a4fe65ff1c91d
parent40547a996b1100b0f51897acda2a7d22dc6db2cb (diff)
downloadgsoc2013-evolution-60f7e7bf1c9c8bc848591d4574e59ca2b356885a.tar
gsoc2013-evolution-60f7e7bf1c9c8bc848591d4574e59ca2b356885a.tar.gz
gsoc2013-evolution-60f7e7bf1c9c8bc848591d4574e59ca2b356885a.tar.bz2
gsoc2013-evolution-60f7e7bf1c9c8bc848591d4574e59ca2b356885a.tar.lz
gsoc2013-evolution-60f7e7bf1c9c8bc848591d4574e59ca2b356885a.tar.xz
gsoc2013-evolution-60f7e7bf1c9c8bc848591d4574e59ca2b356885a.tar.zst
gsoc2013-evolution-60f7e7bf1c9c8bc848591d4574e59ca2b356885a.zip
** See bug #544969: Added the hook for folder custom icon.
2008-07-27 Lucian Langa <lucilanga@gnome.org> * mail/em-event.h (struct _EMEventTargetCustomIcon): * mail/em-event.c (em_event_target_new_custom_icon): * mail/em-folder-tree.c (render_pixbuf): ** See bug #544969: Added the hook for folder custom icon. svn path=/trunk/; revision=35842
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/em-event.c17
-rw-r--r--mail/em-event.h15
-rw-r--r--mail/em-folder-tree.c11
4 files changed, 50 insertions, 1 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 56744d90b9..215e370dfa 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,11 @@
+2008-07-27 Lucian Langa <lucilanga@gnome.org>
+
+ * mail/em-event.h (struct _EMEventTargetCustomIcon):
+ * mail/em-event.c (em_event_target_new_custom_icon):
+ * mail/em-folder-tree.c (render_pixbuf):
+ ** See bug #544969: Added the hook for folder
+ custom icon.
+
2008-07-28 Srinivasa Ragavan <sragavan@novell.com>
** Fix for bug #543411
diff --git a/mail/em-event.c b/mail/em-event.c
index ec72d4ccc5..2ce8d8afc0 100644
--- a/mail/em-event.c
+++ b/mail/em-event.c
@@ -189,6 +189,18 @@ em_event_target_new_send_receive(EMEvent *eme, GtkWidget *table, gpointer data,
return t;
}
+EMEventTargetCustomIcon *
+em_event_target_new_custom_icon(EMEvent *eme, GtkCellRenderer *renderer, const char *folder_name, guint32 flags)
+{
+ EMEventTargetCustomIcon *t = e_event_target_new(&eme->popup, EM_EVENT_TARGET_CUSTOM_ICON, sizeof(*t));
+
+ t->renderer = renderer;
+ t->folder_name = folder_name;
+ t->target.mask = ~flags;
+
+ return t;
+}
+
/* ********************************************************************** */
static void *emeh_parent_class;
@@ -215,11 +227,16 @@ static const EEventHookTargetMask emeh_send_receive_masks[] = {
{ NULL }
};
+static const EEventHookTargetMask emeh_custom_icon_masks[] = {
+ { "customicon", EM_EVENT_CUSTOM_ICON },
+ { NULL }
+};
static const EEventHookTargetMap emeh_targets[] = {
{ "folder", EM_EVENT_TARGET_FOLDER, emeh_folder_masks },
{ "message", EM_EVENT_TARGET_MESSAGE, emeh_message_masks },
{ "composer", EM_EVENT_TARGET_COMPOSER, emeh_composer_masks},
{ "sendreceive", EM_EVENT_TARGET_SEND_RECEIVE, emeh_send_receive_masks},
+ { "customicon", EM_EVENT_TARGET_CUSTOM_ICON, emeh_custom_icon_masks},
{ NULL }
};
diff --git a/mail/em-event.h b/mail/em-event.h
index d8e93f1b34..8725868e2f 100644
--- a/mail/em-event.h
+++ b/mail/em-event.h
@@ -46,6 +46,7 @@ enum _em_event_target_t {
EM_EVENT_TARGET_MESSAGE,
EM_EVENT_TARGET_COMPOSER,
EM_EVENT_TARGET_SEND_RECEIVE,
+ EM_EVENT_TARGET_CUSTOM_ICON,
};
/* Flags that describe TARGET_FOLDER */
@@ -68,6 +69,11 @@ enum {
EM_EVENT_SEND_RECEIVE = 1<< 0,
};
+/* Flags that describe TARGET_CUSTOM_ICON*/
+enum {
+ EM_EVENT_CUSTOM_ICON = 1<< 0,
+};
+
typedef struct _EMEventTargetFolder EMEventTargetFolder;
struct _EMEventTargetFolder {
@@ -105,6 +111,14 @@ struct _EMEventTargetSendReceive {
int row;
};
+typedef struct _EMEventTargetCustomIcon EMEventTargetCustomIcon;
+
+struct _EMEventTargetCustomIcon {
+ EEventTarget target;
+
+ GtkCellRenderer *renderer;
+ char *folder_name;
+};
typedef struct _EEventItem EMEventItem;
@@ -127,6 +141,7 @@ EMEventTargetFolder *em_event_target_new_folder(EMEvent *emp, const char *uri, g
EMEventTargetComposer *em_event_target_new_composer(EMEvent *emp, const struct _EMsgComposer *composer, guint32 flags);
EMEventTargetMessage *em_event_target_new_message(EMEvent *emp, struct _CamelFolder *folder, struct _CamelMimeMessage *message, const char *uid, guint32 flags);
EMEventTargetSendReceive * em_event_target_new_send_receive(EMEvent *eme, struct _GtkWidget *table, gpointer data, int row, guint32 flags);
+EMEventTargetCustomIcon * em_event_target_new_custom_icon(EMEvent *eme, GtkCellRenderer *renderer, const char *uri, guint32 flags);
/* ********************************************************************** */
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 0c0f5e14b0..8a44373338 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -72,6 +72,7 @@
#include "em-folder-selector.h"
#include "em-folder-selection.h"
#include "em-folder-properties.h"
+#include "em-event.h"
#define d(x)
@@ -285,6 +286,8 @@ render_pixbuf (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
GdkPixbuf *pixbuf = NULL;
gboolean is_store;
guint32 flags;
+ EMEventTargetCustomIcon *target;
+ const char *folder_name;
if (!initialised) {
folder_icons[FOLDER_ICON_NORMAL] = e_icon_factory_get_icon ("folder", E_ICON_SIZE_MENU);
@@ -326,8 +329,14 @@ render_pixbuf (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
pixbuf = folder_icons[FOLDER_ICON_SHARED_BY_ME];
else if (flags & CAMEL_FOLDER_VIRTUAL)
pixbuf = folder_icons[FOLDER_ICON_VIRTUAL];
- else
+ else {
pixbuf = folder_icons[FOLDER_ICON_NORMAL];
+ g_object_set (renderer, "pixbuf", pixbuf, "visible", !is_store, NULL);
+ gtk_tree_model_get (model, iter, COL_STRING_FULL_NAME, &folder_name, -1);
+ target = em_event_target_new_custom_icon (em_event_peek(), renderer, folder_name, EM_EVENT_CUSTOM_ICON);
+ e_event_emit ((EEvent *)em_event_peek (), "folder.customicon", (EEventTarget *) target);
+ return;
+ }
}
}