diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 5 | ||||
-rw-r--r-- | src/notificationwindow.c | 6 | ||||
-rw-r--r-- | src/notificationwindow.h | 2 | ||||
-rw-r--r-- | src/plugin.c | 29 | ||||
-rw-r--r-- | src/plugin.h | 10 |
5 files changed, 46 insertions, 6 deletions
@@ -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__ */ |