Revision 3217

View differences:

src/plugin.c
1 1
/*
2 2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2012 Hiroyuki Yamamoto
3
 * Copyright (C) 1999-2013 Hiroyuki Yamamoto
4 4
 *
5 5
 * This program is free software; you can redistribute it and/or modify
6 6
 * it under the terms of the GNU General Public License as published by
......
1373 1373
	GETFUNC("send_message_set_forward_flags");
1374 1374
	return SAFE_CALL_ARG1_RET_VAL(func, forward_targets, -1);
1375 1375
}
1376

  
1377
gint syl_plugin_notification_window_open(const gchar *message,
1378
					 const gchar *submessage,
1379
					 guint timeout)
1380
{
1381
	gint (*func)(const gchar *, const gchar *, guint);
1382

  
1383
	GETFUNC("notification_window_open");
1384
	return SAFE_CALL_ARG3_RET_VAL(func, message, submessage, timeout, -1);
1385
}
1386

  
1387
void syl_plugin_notification_window_set_message(const gchar *message,
1388
						const gchar *submessage)
1389
{
1390
	void (*func)(const gchar *, const gchar *);
1391

  
1392
	GETFUNC("notification_window_set_message");
1393
	SAFE_CALL_ARG2(func, message, submessage);
1394
}
1395

  
1396
void syl_plugin_notification_window_close(void)
1397
{
1398
	void (*func)(void);
1399

  
1400
	GETFUNC("notification_window_close");
1401
	SAFE_CALL(func);
1402
}
src/plugin.h
1 1
/*
2 2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2012 Hiroyuki Yamamoto
3
 * Copyright (C) 1999-2013 Hiroyuki Yamamoto
4 4
 *
5 5
 * This program is free software; you can redistribute it and/or modify
6 6
 * it under the terms of the GNU General Public License as published by
......
331 331
						 const gchar	*msgid);
332 332
gint syl_plugin_send_message_set_forward_flags	(const gchar	*forward_targets);
333 333

  
334
/* Notification window */
335
gint syl_plugin_notification_window_open	(const gchar	*message,
336
						 const gchar	*submessage,
337
						 guint		 timeout);
338
void syl_plugin_notification_window_set_message	(const gchar	*message,
339
						 const gchar	*submessage);
340
void syl_plugin_notification_window_close	(void);
341

  
334 342
#endif /* __PLUGIN_H__ */
src/notificationwindow.c
39 39
#define FADE_REFRESH_RATE			50
40 40
#define FADE_SPEED				5
41 41

  
42
struct _NotificationWindow
42
typedef struct _NotificationWindow
43 43
{
44 44
	GtkWidget *window;
45 45

  
......
56 56
	gint fade_count;
57 57
	gint notify_event_count;
58 58
	guint timeout;
59
};
59
} NotificationWindow;
60 60

  
61 61
static NotificationWindow notify_window;
62 62

  
......
161 161
	if (y < 0) y = 0;
162 162
	gtk_window_move(GTK_WINDOW(window), x, y);
163 163

  
164
	if (timeout == 0)
165
		timeout = 1;
164 166
	notify_window.notify_tag = g_timeout_add(timeout * 1000,
165 167
						 notify_timeout_cb, NULL);
166 168

  
src/notificationwindow.h
23 23
#include <glib.h>
24 24
#include <gtk/gtk.h>
25 25

  
26
typedef struct _NotificationWindow	NotificationWindow;
27

  
28 26
gint notification_window_open		(const gchar		*message,
29 27
					 const gchar		*submessage,
30 28
					 guint			 timeout);
src/main.c
81 81
#include "socket.h"
82 82
#include "stock_pixmap.h"
83 83
#include "trayicon.h"
84
#include "notificationwindow.h"
84 85
#include "plugin.h"
85 86
#include "plugin_manager.h"
86 87
#include "foldersel.h"
......
1368 1369
	ADD_SYM(send_message_set_reply_flag);
1369 1370
	ADD_SYM(send_message_set_forward_flags);
1370 1371

  
1372
	ADD_SYM(notification_window_open);
1373
	ADD_SYM(notification_window_set_message);
1374
	ADD_SYM(notification_window_close);
1375

  
1371 1376
	syl_plugin_signal_connect("plugin-load", G_CALLBACK(load_cb), NULL);
1372 1377

  
1373 1378
	/* loading plug-ins from user plug-in directory */
plugin/test/test.c
28 28

  
29 29
static SylPluginInfo info = {
30 30
	"Test Plugin",
31
	"3.2.0",
31
	"3.4.0",
32 32
	"Hiroyuki Yamamoto",
33 33
	"Test plug-in for Sylpheed plug-in system"
34 34
};
......
146 146
	syl_plugin_update_check_set_jump_url("http://localhost/index.html");
147 147
	syl_plugin_update_check_set_check_plugin_url("http://localhost/plugin_version.txt");
148 148
	syl_plugin_update_check_set_jump_plugin_url("http://localhost/plugin.html");
149

  
150
	syl_plugin_notification_window_open("Sylpheed app init done", "Normal text\n<b>Bold</b>\n<s>Strikethrough</s>", 5);
151

  
149 152
	g_print("test: %p: app init done\n", obj);
150 153
}
151 154

  
ChangeLog
1 1
2013-02-13
2 2

  
3
	* src/plugin.[ch]
4
	  src/notificationwindow.[ch]
5
	  src/main.c
6
	  plugin/test/test.c: added plug-in API for notification window.
7

  
8
2013-02-13
9

  
3 10
	* src/inc.c
4 11
	  src/notificationwindow.[ch]: notification_window_open():
5 12
	  changed from notification_window_create().

Also available in: Unified diff