aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-attachment.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-06-23 02:29:28 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-06-23 02:29:28 +0800
commitdf33c633ee19e9420f7d8f660cac71d71bea90c3 (patch)
tree04a168b76fce4e192b772dac2aa3c62c189ead2a /widgets/misc/e-attachment.c
parent94a9b040083f0a2d3b9d75b58ec641fe021e1a98 (diff)
downloadgsoc2013-evolution-df33c633ee19e9420f7d8f660cac71d71bea90c3.tar.gz
gsoc2013-evolution-df33c633ee19e9420f7d8f660cac71d71bea90c3.tar.zst
gsoc2013-evolution-df33c633ee19e9420f7d8f660cac71d71bea90c3.zip
Use an appropriate icon when dragging attachments.
Diffstat (limited to 'widgets/misc/e-attachment.c')
-rw-r--r--widgets/misc/e-attachment.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index ba4e4004b3..1872de6b77 100644
--- a/widgets/misc/e-attachment.c
+++ b/widgets/misc/e-attachment.c
@@ -56,6 +56,7 @@
struct _EAttachmentPrivate {
GFile *file;
+ GIcon *icon;
GFileInfo *file_info;
GCancellable *cancellable;
CamelMimePart *mime_part;
@@ -85,6 +86,7 @@ enum {
PROP_ENCRYPTED,
PROP_FILE,
PROP_FILE_INFO,
+ PROP_ICON,
PROP_LOADING,
PROP_MIME_PART,
PROP_PERCENT,
@@ -357,7 +359,11 @@ attachment_update_icon_column (EAttachment *attachment)
E_ATTACHMENT_STORE_COLUMN_ICON, icon,
-1);
- g_object_unref (icon);
+ /* Cache the icon to reuse for things like drag-n-drop. */
+ if (attachment->priv->icon != NULL)
+ g_object_unref (attachment->priv->icon);
+ attachment->priv->icon = icon;
+ g_object_notify (G_OBJECT (attachment), "icon");
}
static void
@@ -601,6 +607,12 @@ attachment_get_property (GObject *object,
E_ATTACHMENT (object)));
return;
+ case PROP_ICON:
+ g_value_set_object (
+ value, e_attachment_get_icon (
+ E_ATTACHMENT (object)));
+ return;
+
case PROP_SHOWN:
g_value_set_boolean (
value, e_attachment_get_shown (
@@ -659,6 +671,11 @@ attachment_dispose (GObject *object)
priv->file = NULL;
}
+ if (priv->icon != NULL) {
+ g_object_unref (priv->icon);
+ priv->icon = NULL;
+ }
+
if (priv->file_info != NULL) {
g_object_unref (priv->file_info);
priv->file_info = NULL;
@@ -773,6 +790,16 @@ attachment_class_init (EAttachmentClass *class)
g_object_class_install_property (
object_class,
+ PROP_ICON,
+ g_param_spec_object (
+ "icon",
+ "Icon",
+ NULL,
+ G_TYPE_ICON,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (
+ object_class,
PROP_LOADING,
g_param_spec_boolean (
"loading",
@@ -1178,6 +1205,14 @@ e_attachment_get_file_info (EAttachment *attachment)
return attachment->priv->file_info;
}
+GIcon *
+e_attachment_get_icon (EAttachment *attachment)
+{
+ g_return_val_if_fail (E_IS_ATTACHMENT (attachment), NULL);
+
+ return attachment->priv->icon;
+}
+
gboolean
e_attachment_get_loading (EAttachment *attachment)
{