evolution-3.6.4/em-format/e-mail-formatter-attachment-bar.c

No issues found

Incomplete coverage

Tool Failure ID Location Function Message Data
clang-analyzer no-output-found e-mail-formatter-attachment-bar.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
clang-analyzer no-output-found e-mail-formatter-attachment-bar.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
Failure running clang-analyzer ('no-output-found')
Message
Unable to locate XML output from invoke-clang-analyzer
Failure running clang-analyzer ('no-output-found')
Message
Unable to locate XML output from invoke-clang-analyzer
  1 /*
  2  * e-mail-formatter-attachment-bar.c
  3  *
  4  * This program is free software; you can redistribute it and/or
  5  * modify it under the terms of the GNU Lesser General Public
  6  * License as published by the Free Software Foundation; either
  7  * version 2 of the License, or (at your option) version 3.
  8  *
  9  * This program is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 12  * Lesser General Public License for more details.
 13  *
 14  * You should have received a copy of the GNU Lesser General Public
 15  * License along with the program; if not, see <http://www.gnu.org/licenses/>
 16  *
 17  */
 18 
 19 #ifdef HAVE_CONFIG_H
 20 #include <config.h>
 21 #endif
 22 #include "e-mail-format-extensions.h"
 23 #include "e-mail-part-attachment-bar.h"
 24 #include <misc/e-attachment-bar.h>
 25 
 26 #include <glib/gi18n-lib.h>
 27 
 28 #include <em-format/e-mail-formatter-extension.h>
 29 #include <em-format/e-mail-formatter.h>
 30 
 31 typedef struct _EMailFormatterAttachmentBar {
 32 	GObject parent;
 33 } EMailFormatterAttachmentBar;
 34 
 35 typedef struct _EMailFormatterAttachmentBarClass {
 36 	GObjectClass parent_class;
 37 } EMailFormatterAttachmentBarClass;
 38 
 39 static void e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface);
 40 static void e_mail_formatter_mail_extension_interface_init (EMailExtensionInterface *iface);
 41 
 42 G_DEFINE_TYPE_EXTENDED (
 43 	EMailFormatterAttachmentBar,
 44 	e_mail_formatter_attachment_bar,
 45 	G_TYPE_OBJECT,
 46 	0,
 47 	G_IMPLEMENT_INTERFACE (
 48 		E_TYPE_MAIL_EXTENSION,
 49 		e_mail_formatter_mail_extension_interface_init)
 50 	G_IMPLEMENT_INTERFACE (
 51 		E_TYPE_MAIL_FORMATTER_EXTENSION,
 52 		e_mail_formatter_formatter_extension_interface_init));
 53 
 54 static const gchar *formatter_mime_types[] = { "application/vnd.evolution.widget.attachment-bar", NULL };
 55 
 56 static gboolean
 57 emfe_attachment_bar_format (EMailFormatterExtension *extension,
 58                             EMailFormatter *formatter,
 59                             EMailFormatterContext *context,
 60                             EMailPart *part,
 61                             CamelStream *stream,
 62                             GCancellable *cancellable)
 63 {
 64 	gchar *str;
 65 
 66 	if ((context->mode != E_MAIL_FORMATTER_MODE_NORMAL) &&
 67 	    (context->mode != E_MAIL_FORMATTER_MODE_RAW) &&
 68 	    (context->mode != E_MAIL_FORMATTER_MODE_ALL_HEADERS))
 69 		return FALSE;
 70 
 71 	str = g_strdup_printf (
 72 		"<object type=\"application/vnd.evolution.widget.attachment-bar\" "
 73 		"height=\"0\" width=\"100%%\" data=\"%s\" id=\"%s\"></object>",
 74 		part->id, part->id);
 75 
 76 	camel_stream_write_string (stream, str, cancellable, NULL);
 77 
 78 	g_free (str);
 79 	return TRUE;
 80 }
 81 
 82 static void
 83 unset_bar_from_store_data (GObject *store,
 84                            EAttachmentBar *bar)
 85 {
 86 	/*
 87 	if (E_IS_ATTACHMENT_STORE (store))
 88 		g_object_set_data (store, "attachment-bar", NULL);
 89 	*/
 90 }
 91 
 92 static GtkWidget *
 93 emfe_attachment_bar_get_widget (EMailFormatterExtension *extension,
 94                                 EMailPartList *context,
 95                                 EMailPart *part,
 96                                 GHashTable *params)
 97 {
 98 	EMailPartAttachmentBar *empab;
 99 	GtkWidget *widget;
100 
101 	g_return_val_if_fail (E_MAIL_PART_IS (part, EMailPartAttachmentBar), NULL);
102 
103 	empab = (EMailPartAttachmentBar *) part;
104 	widget = e_attachment_bar_new (empab->store);
105 	g_object_set_data (G_OBJECT (empab->store), "attachment-bar", widget);
106 	g_object_weak_ref (
107 		G_OBJECT (widget),
108 		(GWeakNotify) unset_bar_from_store_data, empab->store);
109 
110 	return widget;
111 }
112 
113 static const gchar *
114 emfe_attachment_bar_get_display_name (EMailFormatterExtension *extension)
115 {
116 	return NULL;
117 }
118 
119 static const gchar *
120 emfe_attachment_bar_get_description (EMailFormatterExtension *extension)
121 {
122 	return NULL;
123 }
124 
125 static const gchar **
126 emfe_attachment_bar_mime_types (EMailExtension *extension)
127 {
128 	return formatter_mime_types;
129 }
130 
131 static void
132 e_mail_formatter_attachment_bar_class_init (EMailFormatterAttachmentBarClass *class)
133 {
134 }
135 
136 static void
137 e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface)
138 {
139 	iface->format = emfe_attachment_bar_format;
140 	iface->get_widget = emfe_attachment_bar_get_widget;
141 	iface->get_display_name = emfe_attachment_bar_get_display_name;
142 	iface->get_description = emfe_attachment_bar_get_description;
143 }
144 
145 static void
146 e_mail_formatter_mail_extension_interface_init (EMailExtensionInterface *iface)
147 {
148 	iface->mime_types = emfe_attachment_bar_mime_types;
149 }
150 
151 static void
152 e_mail_formatter_attachment_bar_init (EMailFormatterAttachmentBar *extension)
153 {
154 
155 }