Revision 2886

View differences:

src/compose.c
3444 3444
{
3445 3445
	gchar tmp[MAXPATHLEN + 1];
3446 3446
	gint ok = 0;
3447
	gboolean ack = TRUE;
3447 3448

  
3448 3449
	if (compose->lock_count > 0)
3449 3450
		return 1;
......
3490 3491
		g_warning(_("can't get recipient list."));
3491 3492
		g_unlink(tmp);
3492 3493
		compose_unlock(compose);
3494
		return 1;
3495
	}
3496

  
3497
	syl_plugin_signal_emit("compose-send", compose, compose->mode, 0,
3498
			       tmp, compose->to_list, &ack);
3499
	if (ack == FALSE) {
3500
		g_unlink(tmp);
3501
		compose_unlock(compose);
3493 3502
		return -1;
3494 3503
	}
3495 3504

  
......
7204 7213
	Compose *compose = (Compose *)data;
7205 7214
	FolderItem *queue;
7206 7215
	gchar tmp[MAXPATHLEN + 1];
7216
	gboolean ack = TRUE;
7207 7217

  
7208 7218
	if (compose_check_entries(compose) == FALSE)
7209 7219
		return;
......
7236 7246
		}
7237 7247
	}
7238 7248

  
7249
	if (!compose->to_list && !compose->newsgroup_list) {
7250
		g_warning("can't get recipient list.");
7251
		g_unlink(tmp);
7252
		return;
7253
	}
7254

  
7255
	syl_plugin_signal_emit("compose-send", compose, compose->mode, 1,
7256
			       tmp, compose->to_list, &ack);
7257
	if (ack == FALSE) {
7258
		g_unlink(tmp);
7259
		return;
7260
	}
7261

  
7239 7262
	if (compose_queue(compose, tmp) < 0) {
7240 7263
		alertpanel_error(_("Can't queue the message."));
7264
		g_unlink(tmp);
7241 7265
		return;
7242 7266
	}
7243 7267

  
src/plugin.c
36 36
	COMPOSE_CREATED,
37 37
	COMPOSE_DESTROY,
38 38
	TEXTVIEW_MENU_POPUP,
39
	COMPOSE_SEND,
39 40
	LAST_SIGNAL
40 41
};
41 42

  
......
172 173
			     G_TYPE_STRING,
173 174
			     G_TYPE_STRING,
174 175
			     G_TYPE_POINTER);
176
	plugin_signals[COMPOSE_SEND] =
177
		g_signal_new("compose-send",
178
			     G_TYPE_FROM_CLASS(gobject_class),
179
			     G_SIGNAL_RUN_LAST,
180
			     G_STRUCT_OFFSET(SylPluginClass, compose_send),
181
			     NULL, NULL,
182
			     syl_plugin_marshal_BOOLEAN__POINTER_INT_INT_STRING_POINTER,
183
			     G_TYPE_BOOLEAN,
184
			     5,
185
			     G_TYPE_POINTER,
186
			     G_TYPE_INT,
187
			     G_TYPE_INT,
188
			     G_TYPE_STRING,
189
			     G_TYPE_POINTER);
175 190
}
176 191

  
177 192
void syl_plugin_signal_connect(const gchar *name, GCallback callback,
src/plugin.h
45 45
typedef void (*SylPluginUnloadFunc)	(void);
46 46
typedef void (*SylPluginCallbackFunc)	(void);
47 47

  
48
#define SYL_PLUGIN_INTERFACE_VERSION	0x0107
48
#define SYL_PLUGIN_INTERFACE_VERSION	0x0108
49 49

  
50 50
struct _SylPlugin
51 51
{
......
71 71
					 const gchar	*uri,
72 72
					 const gchar	*selected_text,
73 73
					 MsgInfo	*msginfo);
74

  
75
	gboolean (* compose_send)	(GObject	*obj,
76
					 gpointer	 compose,
77
					 gint		 compose_mode,
78
					 gint		 send_mode,
79
					 const gchar	*msg_file,
80
					 GSList		*to_list);
74 81
};
75 82

  
76 83
struct _SylPluginInfo
src/plugin-marshal.list
1 1
VOID:POINTER
2 2
VOID:POINTER,POINTER,STRING,STRING,POINTER
3
BOOLEAN:POINTER,INT,INT,STRING,POINTER
plugin/test/test.c
51 51

  
52 52
static void compose_created_cb(GObject *obj, gpointer compose);
53 53
static void compose_destroy_cb(GObject *obj, gpointer compose);
54
static gboolean compose_send_cb(GObject *obj, gpointer compose,
55
				gint compose_mode, gint send_mode,
56
				const gchar *msg_file, GSList *to_list);
54 57

  
55 58
static void create_window(void);
56 59
static void create_folderview_sub_widget(void);
......
100 103
				  G_CALLBACK(compose_created_cb), NULL);
101 104
	syl_plugin_signal_connect("compose-destroy",
102 105
				  G_CALLBACK(compose_destroy_cb), NULL);
106
	syl_plugin_signal_connect("compose-send",
107
				  G_CALLBACK(compose_send_cb), NULL);
103 108

  
104 109
	syl_plugin_add_factory_item("<SummaryView>", "/---", NULL, NULL);
105 110
	syl_plugin_add_factory_item("<SummaryView>", "/Test Plug-in menu",
......
219 224
	g_print("test: %p: compose will be destroyed (%p)\n", obj, compose);
220 225
}
221 226

  
227
static gboolean compose_send_cb(GObject *obj, gpointer compose,
228
				gint compose_mode, gint send_mode,
229
				const gchar *msg_file, GSList *to_list)
230
{
231
	g_print("test: %p: composed message will be sent (%p)\n", obj, compose);
232
	g_print("test: compose_mode: %d, send_mode: %d, file: %s\n",
233
		compose_mode, send_mode, msg_file);
234

  
235
	return TRUE; /* return FALSE to cancel sending */
236
}
237

  
222 238
static void button_clicked(GtkWidget *widget, gpointer data)
223 239
{
224 240
	g_print("button_clicked\n");
PLUGIN.txt
276 276
  'Click this button' is displayed. When it is clicked, a message is displayed
277 277
- Capture the following events and show messages: application initialization
278 278
  and exiting, folder view context menu popup, creating and destroying compose
279
  window
279
  window, sending messages
280 280
- Capture the text view context menu popup event and add a menu item
281 281

  
282 282
Attachment Tool Plug-in
ChangeLog
1
2011-06-08
2

  
3
	* src/compose.c
4
	  src/plugin.[ch]
5
	  src/plugin-marshal.list
6
	  plugin/test/test.c: added a new plug-in API: "compose-send".
7

  
1 8
2011-06-06
2 9

  
3 10
	* src/compose.c: compose_generate_msgid(): don't use mailbox part

Also available in: Unified diff