aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer-attachment-bar.c
diff options
context:
space:
mode:
Diffstat (limited to 'composer/e-msg-composer-attachment-bar.c')
-rw-r--r--composer/e-msg-composer-attachment-bar.c67
1 files changed, 29 insertions, 38 deletions
diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c
index e359ffd042..05a1b549f3 100644
--- a/composer/e-msg-composer-attachment-bar.c
+++ b/composer/e-msg-composer-attachment-bar.c
@@ -44,12 +44,12 @@
#include <gal/util/e-iconv.h>
-#include "camel/camel-data-wrapper.h"
-#include "camel/camel-stream-fs.h"
-#include "camel/camel-stream-null.h"
-#include "camel/camel-stream-filter.h"
-#include "camel/camel-mime-filter-bestenc.h"
-#include "camel/camel-mime-part.h"
+#include <camel/camel-data-wrapper.h>
+#include <camel/camel-stream-fs.h>
+#include <camel/camel-stream-null.h>
+#include <camel/camel-stream-filter.h>
+#include <camel/camel-mime-filter-bestenc.h>
+#include <camel/camel-mime-part.h>
#include "e-util/e-gui-utils.h"
@@ -529,30 +529,29 @@ destroy (GtkObject *object)
static void
-popup_menu_placement_callback(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data)
+popup_menu_placement_callback (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data)
{
EMsgComposerAttachmentBar *bar;
GnomeIconList *icon_list;
GList *selection;
GnomeCanvasPixbuf *image;
-
+
bar = E_MSG_COMPOSER_ATTACHMENT_BAR (user_data);
icon_list = GNOME_ICON_LIST (user_data);
-
+
gdk_window_get_origin (((GtkWidget*) bar)->window, x, y);
-
+
selection = gnome_icon_list_get_selection (icon_list);
if (selection == NULL)
return;
-
+
image = gnome_icon_list_get_icon_pixbuf_item (icon_list, (gint)selection->data);
if (image == NULL)
return;
-
+
/* Put menu to the center of icon. */
- *x += (gint)(image->item.x1 + image->item.x2)/2;
- *y += (gint)(image->item.y1 + image->item.y2)/2;
-
+ *x += (int)(image->item.x1 + image->item.x2) / 2;
+ *y += (int)(image->item.y1 + image->item.y2) / 2;
}
static gboolean
@@ -561,16 +560,16 @@ popup_menu_event (GtkWidget *widget)
EMsgComposerAttachmentBar *bar = E_MSG_COMPOSER_ATTACHMENT_BAR (widget);
GnomeIconList *icon_list = GNOME_ICON_LIST (widget);
GList *selection = gnome_icon_list_get_selection (icon_list);
- GtkMenu *menu;
-
- if (selection==NULL)
+ GtkWidget *menu;
+
+ if (selection == NULL)
menu = get_context_menu (bar);
else
menu = get_icon_context_menu (bar);
-
+
gnome_popup_menu_do_popup (menu, popup_menu_placement_callback,
- (gpointer)widget, NULL, (gpointer)widget, NULL);
-
+ widget, NULL, widget, NULL);
+
return TRUE;
}
@@ -746,29 +745,22 @@ attach_to_multipart (CamelMultipart *multipart,
if (!CAMEL_IS_MULTIPART (content)) {
if (header_content_type_is (content_type, "text", "*")) {
CamelMimePartEncodingType encoding;
- CamelStreamFilter *filtered_stream;
+ CamelStreamFilter *filter_stream;
CamelMimeFilterBestenc *bestenc;
CamelStream *stream;
const char *charset;
char *type;
- /* assume that if a charset is set, that the content is in UTF-8
- * or else already has rawtext set to TRUE */
- if (!(charset = header_content_type_param (content_type, "charset"))) {
- /* Let camel know that this text part was read in raw and thus is not in
- * UTF-8 format so that when it writes this part out, it doesn't try to
- * convert it from UTF-8 into the @default_charset charset. */
- content->rawtext = TRUE;
- }
+ charset = header_content_type_param (content_type, "charset");
stream = camel_stream_null_new ();
- filtered_stream = camel_stream_filter_new_with_stream (stream);
+ filter_stream = camel_stream_filter_new_with_stream (stream);
bestenc = camel_mime_filter_bestenc_new (CAMEL_BESTENC_GET_ENCODING);
- camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (bestenc));
- camel_object_unref (CAMEL_OBJECT (stream));
+ camel_stream_filter_add (filter_stream, CAMEL_MIME_FILTER (bestenc));
+ camel_object_unref (stream);
- camel_data_wrapper_write_to_stream (content, CAMEL_STREAM (filtered_stream));
- camel_object_unref (CAMEL_OBJECT (filtered_stream));
+ camel_data_wrapper_write_to_stream (content, CAMEL_STREAM (filter_stream));
+ camel_object_unref (filter_stream);
encoding = camel_mime_filter_bestenc_get_best_encoding (bestenc, CAMEL_BESTENC_8BIT);
camel_mime_part_set_encoding (attachment->body, encoding);
@@ -794,10 +786,9 @@ attach_to_multipart (CamelMultipart *multipart,
g_free (type);
}
- camel_object_unref (CAMEL_OBJECT (bestenc));
+ camel_object_unref (bestenc);
} else if (!CAMEL_IS_MIME_MESSAGE (content)) {
- camel_mime_part_set_encoding (attachment->body,
- CAMEL_MIME_PART_ENCODING_BASE64);
+ camel_mime_part_set_encoding (attachment->body, CAMEL_MIME_PART_ENCODING_BASE64);
}
}