aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--plugin/test/test.c5
-rw-r--r--src/main.c5
-rw-r--r--src/notificationwindow.c6
-rw-r--r--src/notificationwindow.h2
-rw-r--r--src/plugin.c29
-rw-r--r--src/plugin.h10
7 files changed, 57 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 3903144f..eb103be5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2013-02-13
+ * src/plugin.[ch]
+ src/notificationwindow.[ch]
+ src/main.c
+ plugin/test/test.c: added plug-in API for notification window.
+
+2013-02-13
+
* src/inc.c
src/notificationwindow.[ch]: notification_window_open():
changed from notification_window_create().
diff --git a/plugin/test/test.c b/plugin/test/test.c
index a7e63ebe..945a53fe 100644
--- a/plugin/test/test.c
+++ b/plugin/test/test.c
@@ -28,7 +28,7 @@
static SylPluginInfo info = {
"Test Plugin",
- "3.2.0",
+ "3.4.0",
"Hiroyuki Yamamoto",
"Test plug-in for Sylpheed plug-in system"
};
@@ -146,6 +146,9 @@ static void init_done_cb(GObject *obj, gpointer data)
syl_plugin_update_check_set_jump_url("http://localhost/index.html");
syl_plugin_update_check_set_check_plugin_url("http://localhost/plugin_version.txt");
syl_plugin_update_check_set_jump_plugin_url("http://localhost/plugin.html");
+
+ syl_plugin_notification_window_open("Sylpheed app init done", "Normal text\n<b>Bold</b>\n<s>Strikethrough</s>", 5);
+
g_print("test: %p: app init done\n", obj);
}
diff --git a/src/main.c b/src/main.c
index 741201e9..7579794a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -81,6 +81,7 @@
#include "socket.h"
#include "stock_pixmap.h"
#include "trayicon.h"
+#include "notificationwindow.h"
#include "plugin.h"
#include "plugin_manager.h"
#include "foldersel.h"
@@ -1368,6 +1369,10 @@ static void plugin_init(void)
ADD_SYM(send_message_set_reply_flag);
ADD_SYM(send_message_set_forward_flags);
+ ADD_SYM(notification_window_open);
+ ADD_SYM(notification_window_set_message);
+ ADD_SYM(notification_window_close);
+
syl_plugin_signal_connect("plugin-load", G_CALLBACK(load_cb), NULL);
/* loading plug-ins from user plug-in directory */
diff --git a/src/notificationwindow.c b/src/notificationwindow.c
index 51c7d4ae..e3069aea 100644
--- a/src/notificationwindow.c
+++ b/src/notificationwindow.c
@@ -39,7 +39,7 @@
#define FADE_REFRESH_RATE 50
#define FADE_SPEED 5
-struct _NotificationWindow
+typedef struct _NotificationWindow
{
GtkWidget *window;
@@ -56,7 +56,7 @@ struct _NotificationWindow
gint fade_count;
gint notify_event_count;
guint timeout;
-};
+} NotificationWindow;
static NotificationWindow notify_window;
@@ -161,6 +161,8 @@ gint notification_window_open(const gchar *message, const gchar *submessage,
if (y < 0) y = 0;
gtk_window_move(GTK_WINDOW(window), x, y);
+ if (timeout == 0)
+ timeout = 1;
notify_window.notify_tag = g_timeout_add(timeout * 1000,
notify_timeout_cb, NULL);
diff --git a/src/notificationwindow.h b/src/notificationwindow.h
index c2c2c53d..a6ad2e46 100644
--- a/src/notificationwindow.h
+++ b/src/notificationwindow.h
@@ -23,8 +23,6 @@
#include <glib.h>
#include <gtk/gtk.h>
-typedef struct _NotificationWindow NotificationWindow;
-
gint notification_window_open (const gchar *message,
const gchar *submessage,
guint timeout);
diff --git a/src/plugin.c b/src/plugin.c
index be1636f5..d78893fc 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2013 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1373,3 +1373,30 @@ gint syl_plugin_send_message_set_forward_flags(const gchar *forward_targets)
GETFUNC("send_message_set_forward_flags");
return SAFE_CALL_ARG1_RET_VAL(func, forward_targets, -1);
}
+
+gint syl_plugin_notification_window_open(const gchar *message,
+ const gchar *submessage,
+ guint timeout)
+{
+ gint (*func)(const gchar *, const gchar *, guint);
+
+ GETFUNC("notification_window_open");
+ return SAFE_CALL_ARG3_RET_VAL(func, message, submessage, timeout, -1);
+}
+
+void syl_plugin_notification_window_set_message(const gchar *message,
+ const gchar *submessage)
+{
+ void (*func)(const gchar *, const gchar *);
+
+ GETFUNC("notification_window_set_message");
+ SAFE_CALL_ARG2(func, message, submessage);
+}
+
+void syl_plugin_notification_window_close(void)
+{
+ void (*func)(void);
+
+ GETFUNC("notification_window_close");
+ SAFE_CALL(func);
+}
diff --git a/src/plugin.h b/src/plugin.h
index fc8b6dd3..bf751431 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2013 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -331,4 +331,12 @@ gint syl_plugin_send_message_set_reply_flag (const gchar *reply_target,
const gchar *msgid);
gint syl_plugin_send_message_set_forward_flags (const gchar *forward_targets);
+/* Notification window */
+gint syl_plugin_notification_window_open (const gchar *message,
+ const gchar *submessage,
+ guint timeout);
+void syl_plugin_notification_window_set_message (const gchar *message,
+ const gchar *submessage);
+void syl_plugin_notification_window_close (void);
+
#endif /* __PLUGIN_H__ */