From 1c5e07140eac1ee51cb0b6bd0949ed3cb6b2e04b Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 18 Jan 2012 07:52:40 +0000 Subject: added new plug-in signals for preferences dialogs (#30) git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3014 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 14 ++++++++- src/plugin-marshal.list | 2 ++ src/plugin.c | 74 +++++++++++++++++++++++++++++++++++++++++++++- src/plugin.h | 21 ++++++++++++- src/plugin_manager.c | 4 ++- src/prefs_account_dialog.c | 6 +++- src/prefs_common_dialog.c | 3 ++ src/prefs_filter.c | 5 +++- src/prefs_filter_edit.c | 6 +++- src/prefs_template.c | 5 +++- 10 files changed, 132 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index e3ae5b41..25e62cf9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2012-01-18 + + * src/plugin.[ch] + src/plugin-marshal.list + src/prefs_template.c + src/prefs_common_dialog.c + src/prefs_filter_edit.c + src/prefs_account_dialog.c + src/prefs_filter.c + src/plugin_manager.c: added new plug-in signals for preferences + dialogs (#30). + 2012-01-11 * src/messageview.c: add .eml extension like summary_save_as(). @@ -9,7 +21,7 @@ * src/inc.c src/plugin.[ch] src/plugin-marshal.list - plugin/test/test.c: added new plug-in signals: + plugin/test/test.c: added new plug-in signals (#10): "inc-mail-start": notify start of receiving "inc-mail-finished": notify end of receiving and number of new messages diff --git a/src/plugin-marshal.list b/src/plugin-marshal.list index 7ae8571e..2c692c47 100644 --- a/src/plugin-marshal.list +++ b/src/plugin-marshal.list @@ -1,5 +1,7 @@ VOID:POINTER +VOID:POINTER,POINTER VOID:POINTER,POINTER,STRING,STRING,POINTER BOOLEAN:POINTER,INT,INT,STRING,POINTER VOID:POINTER,POINTER,BOOLEAN VOID:INT +VOID:POINTER,STRING,STRING,POINTER diff --git a/src/plugin.c b/src/plugin.c index c3be1255..212a736d 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-2011 Hiroyuki Yamamoto + * Copyright (C) 1999-2012 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 @@ -40,6 +40,12 @@ enum { MESSAGEVIEW_SHOW, INC_MAIL_START, INC_MAIL_FINISHED, + PREFS_COMMON_OPEN, + PREFS_ACCOUNT_OPEN, + PREFS_FILTER_OPEN, + PREFS_FILTER_EDIT_OPEN, + PREFS_TEMPLATE_OPEN, + PLUGIN_MANAGER_OPEN, LAST_SIGNAL }; @@ -202,6 +208,7 @@ static void syl_plugin_class_init(SylPluginClass *klass) G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_BOOLEAN); + plugin_signals[INC_MAIL_START] = g_signal_new("inc-mail-start", G_TYPE_FROM_CLASS(gobject_class), @@ -222,6 +229,71 @@ static void syl_plugin_class_init(SylPluginClass *klass) G_TYPE_NONE, 1, G_TYPE_INT); + + plugin_signals[PREFS_COMMON_OPEN] = + g_signal_new("prefs-common-open", + G_TYPE_FROM_CLASS(gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(SylPluginClass, prefs_common_open), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, + 1, + G_TYPE_POINTER); + plugin_signals[PREFS_ACCOUNT_OPEN] = + g_signal_new("prefs-account-open", + G_TYPE_FROM_CLASS(gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(SylPluginClass, prefs_account_open), + NULL, NULL, + syl_plugin_marshal_VOID__POINTER_POINTER, + G_TYPE_NONE, + 2, + G_TYPE_POINTER, + G_TYPE_POINTER); + plugin_signals[PREFS_FILTER_OPEN] = + g_signal_new("prefs-filter-open", + G_TYPE_FROM_CLASS(gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(SylPluginClass, prefs_filter_open), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, + 1, + G_TYPE_POINTER); + plugin_signals[PREFS_FILTER_EDIT_OPEN] = + g_signal_new("prefs-filter-edit-open", + G_TYPE_FROM_CLASS(gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(SylPluginClass, prefs_filter_edit_open), + NULL, NULL, + syl_plugin_marshal_VOID__POINTER_STRING_STRING_POINTER, + G_TYPE_NONE, + 4, + G_TYPE_POINTER, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_POINTER); + plugin_signals[PREFS_TEMPLATE_OPEN] = + g_signal_new("prefs-template-open", + G_TYPE_FROM_CLASS(gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(SylPluginClass, prefs_template_open), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, + 1, + G_TYPE_POINTER); + plugin_signals[PLUGIN_MANAGER_OPEN] = + g_signal_new("plugin-manager-open", + G_TYPE_FROM_CLASS(gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(SylPluginClass, plugin_manager_open), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, + 1, + G_TYPE_POINTER); } void syl_plugin_signal_connect(const gchar *name, GCallback callback, diff --git a/src/plugin.h b/src/plugin.h index c9bd3830..fc8b6dd3 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-2011 Hiroyuki Yamamoto + * Copyright (C) 1999-2012 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 @@ -27,6 +27,7 @@ #include "procmsg.h" #include "folder.h" +#include "filter.h" /* SylPlugin object */ @@ -88,6 +89,24 @@ struct _SylPluginClass PrefsAccount *account); void (* inc_mail_finished) (GObject *obj, gint new_messages); + + /* Prefs dialogs */ + void (* prefs_common_open) (GObject *obj, + GtkWidget *window); + void (* prefs_account_open) (GObject *obj, + PrefsAccount *account, + GtkWidget *window); + void (* prefs_filter_open) (GObject *obj, + GtkWidget *window); + void (* prefs_filter_edit_open) (GObject *obj, + FilterRule *rule, + const gchar *header, + const gchar *key, + GtkWidget *window); + void (* prefs_template_open) (GObject *obj, + GtkWidget *window); + void (* plugin_manager_open) (GObject *obj, + GtkWidget *window); }; struct _SylPluginInfo diff --git a/src/plugin_manager.c b/src/plugin_manager.c index 71f14bdc..793fa5b1 100644 --- a/src/plugin_manager.c +++ b/src/plugin_manager.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2009 Hiroyuki Yamamoto + * Copyright (C) 1999-2012 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 @@ -98,6 +98,8 @@ void plugin_manager_open(void) gtk_widget_show(pm_window.window); manage_window_focus_in(pm_window.window, NULL, NULL); + + syl_plugin_signal_emit("plugin-manager-open", pm_window.window); } #ifdef USE_UPDATE_CHECK_PLUGIN diff --git a/src/prefs_account_dialog.c b/src/prefs_account_dialog.c index c560afc9..faf77734 100644 --- a/src/prefs_account_dialog.c +++ b/src/prefs_account_dialog.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2010 Hiroyuki Yamamoto + * Copyright (C) 1999-2012 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 @@ -52,6 +52,7 @@ #include "alertpanel.h" #include "smtp.h" #include "imap.h" +#include "plugin.h" static gboolean cancelled; static gboolean new_account; @@ -550,7 +551,10 @@ PrefsAccount *prefs_account_open(PrefsAccount *ac_prefs) } gtk_widget_show(dialog.window); + syl_plugin_signal_emit("prefs-account-open", new_account ? NULL : ac_prefs, dialog.window); + gtk_main(); + gtk_widget_hide(dialog.window); inc_unlock(); diff --git a/src/prefs_common_dialog.c b/src/prefs_common_dialog.c index 965321b2..6ddb6fb8 100644 --- a/src/prefs_common_dialog.c +++ b/src/prefs_common_dialog.c @@ -56,6 +56,7 @@ #include "alertpanel.h" #include "folder.h" #include "socket.h" +#include "plugin.h" static PrefsDialog dialog; @@ -742,6 +743,8 @@ void prefs_common_open(void) prefs_common_colorlabel_set_dialog(); gtk_widget_show(dialog.window); + + syl_plugin_signal_emit("prefs-common-open", dialog.window); } static void prefs_common_create(void) diff --git a/src/prefs_filter.c b/src/prefs_filter.c index 4185bcbb..4e8a6eaf 100644 --- a/src/prefs_filter.c +++ b/src/prefs_filter.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2008 Hiroyuki Yamamoto + * Copyright (C) 1999-2012 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 @@ -50,6 +50,7 @@ #include "gtkutils.h" #include "alertpanel.h" #include "xml.h" +#include "plugin.h" static struct FilterRuleListWindow { GtkWidget *window; @@ -143,6 +144,8 @@ void prefs_filter_open(MsgInfo *msginfo, const gchar *header, const gchar *key) gtk_widget_show(rule_list_window.window); manage_window_focus_in(rule_list_window.window, NULL, NULL); + syl_plugin_signal_emit("prefs-filter-open", rule_list_window.window); + if (msginfo) { FilterRule *rule; diff --git a/src/prefs_filter_edit.c b/src/prefs_filter_edit.c index ce00fde3..64da3a99 100644 --- a/src/prefs_filter_edit.c +++ b/src/prefs_filter_edit.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2008 Hiroyuki Yamamoto + * Copyright (C) 1999-2012 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 @@ -49,6 +49,7 @@ #include "stock_pixmap.h" #include "alertpanel.h" #include "folder.h" +#include "plugin.h" static struct FilterRuleEditWindow { GtkWidget *window; @@ -171,6 +172,9 @@ FilterRule *prefs_filter_edit_open(FilterRule *rule, const gchar *header, GTK_EVENTS_FLUSH(); gtk_widget_show(rule_edit_window.window); + syl_plugin_signal_emit("prefs-filter-edit-open", rule, header, key, + rule_edit_window.window); + rule_edit_window.new_rule = NULL; rule_edit_window.edit_finished = FALSE; while (rule_edit_window.edit_finished == FALSE) diff --git a/src/prefs_template.c b/src/prefs_template.c index 147ce29f..fb535744 100644 --- a/src/prefs_template.c +++ b/src/prefs_template.c @@ -1,7 +1,7 @@ /* * Sylpheed templates subsystem * Copyright (C) 2001 Alexander Barinov - * Copyright (C) 2001-2010 Hiroyuki Yamamoto + * Copyright (C) 2001-2012 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 @@ -41,6 +41,7 @@ #include "mainwindow.h" #include "addr_compl.h" #include "quote_fmt.h" +#include "plugin.h" static struct Templates { GtkWidget *window; @@ -98,6 +99,8 @@ void prefs_template_open(void) prefs_template_window_setup(); gtk_widget_show(templates.window); + + syl_plugin_signal_emit("prefs-template-open", templates.window); } #define ADD_ENTRY(entry, str, row) \ -- cgit v1.2.3