diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2014-03-26 22:39:56 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2014-03-27 08:24:34 +0800 |
commit | f7688facc941a569bcf7d6fa78bb28f90a24a007 (patch) | |
tree | 0a5f71c7ef0b7849e58b1cccf967a1b0d8c8fcb9 /mail | |
parent | 613f58f7764b4802f7fd098ae295281ffb5443a3 (diff) | |
download | gsoc2013-evolution-f7688facc941a569bcf7d6fa78bb28f90a24a007.tar gsoc2013-evolution-f7688facc941a569bcf7d6fa78bb28f90a24a007.tar.gz gsoc2013-evolution-f7688facc941a569bcf7d6fa78bb28f90a24a007.tar.bz2 gsoc2013-evolution-f7688facc941a569bcf7d6fa78bb28f90a24a007.tar.lz gsoc2013-evolution-f7688facc941a569bcf7d6fa78bb28f90a24a007.tar.xz gsoc2013-evolution-f7688facc941a569bcf7d6fa78bb28f90a24a007.tar.zst gsoc2013-evolution-f7688facc941a569bcf7d6fa78bb28f90a24a007.zip |
EMFolderSelector: Add a "folder-selected" signal.
This makes EMFolderSelector a little more "subclassable".
Diffstat (limited to 'mail')
-rw-r--r-- | mail/em-folder-selector.c | 43 | ||||
-rw-r--r-- | mail/em-folder-selector.h | 5 |
2 files changed, 41 insertions, 7 deletions
diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c index 9761871fcf..5f9c0e5505 100644 --- a/mail/em-folder-selector.c +++ b/mail/em-folder-selector.c @@ -67,6 +67,13 @@ enum { PROP_MODEL }; +enum { + FOLDER_SELECTED, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL]; + /* Forward Declarations */ static void em_folder_selector_alert_sink_init (EAlertSinkInterface *interface); @@ -108,13 +115,8 @@ folder_selector_selected_cb (EMFolderTree *emft, CamelFolderInfoFlags flags, EMFolderSelector *selector) { - if (selector->priv->name_entry != NULL) { - folder_selector_create_name_changed ( - selector->priv->name_entry, selector); - } else { - gtk_dialog_set_response_sensitive ( - GTK_DIALOG (selector), GTK_RESPONSE_OK, TRUE); - } + g_signal_emit ( + selector, signals[FOLDER_SELECTED], 0, store, folder_name); } static void @@ -379,6 +381,21 @@ folder_selector_response (GtkDialog *dialog, } static void +folder_selector_folder_selected (EMFolderSelector *selector, + CamelStore *store, + const gchar *folder_name) +{ + if (selector->priv->name_entry != NULL) { + folder_selector_create_name_changed ( + selector->priv->name_entry, selector); + } else { + gtk_dialog_set_response_sensitive ( + GTK_DIALOG (selector), GTK_RESPONSE_OK, + (store != NULL) && (folder_name != NULL)); + } +} + +static void folder_selector_submit_alert (EAlertSink *alert_sink, EAlert *alert) { @@ -424,6 +441,8 @@ em_folder_selector_class_init (EMFolderSelectorClass *class) dialog_class = GTK_DIALOG_CLASS (class); dialog_class->response = folder_selector_response; + class->folder_selected = folder_selector_folder_selected; + g_object_class_install_property ( object_class, PROP_CAN_CREATE, @@ -470,6 +489,16 @@ em_folder_selector_class_init (EMFolderSelectorClass *class) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); + + signals[FOLDER_SELECTED] = g_signal_new ( + "folder-selected", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMFolderSelectorClass, folder_selected), + NULL, NULL, NULL, + G_TYPE_NONE, 2, + CAMEL_TYPE_STORE, + G_TYPE_STRING); } static void diff --git a/mail/em-folder-selector.h b/mail/em-folder-selector.h index c5f37e2867..81e82cbef6 100644 --- a/mail/em-folder-selector.h +++ b/mail/em-folder-selector.h @@ -58,6 +58,11 @@ struct _EMFolderSelector { struct _EMFolderSelectorClass { GtkDialogClass parent_class; + + /* Signals */ + void (*folder_selected) (EMFolderSelector *selector, + CamelStore *store, + const gchar *folder_name); }; GType em_folder_selector_get_type (void); |