From a0b99778009d62407484f288884f5942ef85b2d5 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 10 Jul 2012 11:09:58 -0400 Subject: EMailConfigServicePage: Inherit from EMailConfigActivityPage. Removes e_mail_config_service_page_new_activity(). Use e_mail_config_activity_page_new_activity() instead. --- mail/e-mail-config-auth-check.c | 3 +- mail/e-mail-config-service-page.c | 118 ++------------------------------------ mail/e-mail-config-service-page.h | 9 +-- 3 files changed, 10 insertions(+), 120 deletions(-) (limited to 'mail') diff --git a/mail/e-mail-config-auth-check.c b/mail/e-mail-config-auth-check.c index 21e6633b76..990ce612e3 100644 --- a/mail/e-mail-config-auth-check.c +++ b/mail/e-mail-config-auth-check.c @@ -168,7 +168,8 @@ mail_config_auth_check_update (EMailConfigAuthCheck *auth_check) camel_service_set_settings (service, settings); - activity = e_mail_config_service_page_new_activity (page); + activity = e_mail_config_activity_page_new_activity ( + E_MAIL_CONFIG_ACTIVITY_PAGE (page)); cancellable = e_activity_get_cancellable (activity); gtk_widget_set_sensitive (GTK_WIDGET (auth_check), FALSE); diff --git a/mail/e-mail-config-service-page.c b/mail/e-mail-config-service-page.c index 6109623ddc..a90128147d 100644 --- a/mail/e-mail-config-service-page.c +++ b/mail/e-mail-config-service-page.c @@ -24,11 +24,6 @@ #include #include -#include -#include -#include -#include - #include #include @@ -60,8 +55,6 @@ struct _EMailConfigServicePagePrivate { GtkWidget *type_label; GtkWidget *desc_label; GtkWidget *notebook; - GtkWidget *activity_bar; - GtkWidget *alert_bar; /* Combo box list store */ GtkListStore *list_store; @@ -93,20 +86,15 @@ enum { }; /* Forward Declarations */ -static void e_mail_config_service_page_alert_sink_init - (EAlertSinkInterface *interface); static void e_mail_config_service_page_interface_init (EMailConfigPageInterface *interface); G_DEFINE_ABSTRACT_TYPE_WITH_CODE ( EMailConfigServicePage, e_mail_config_service_page, - GTK_TYPE_BOX, + E_TYPE_MAIL_CONFIG_ACTIVITY_PAGE, G_IMPLEMENT_INTERFACE ( E_TYPE_EXTENSIBLE, NULL) - G_IMPLEMENT_INTERFACE ( - E_TYPE_ALERT_SINK, - e_mail_config_service_page_alert_sink_init) G_IMPLEMENT_INTERFACE ( E_TYPE_MAIL_CONFIG_PAGE, e_mail_config_service_page_interface_init)) @@ -443,37 +431,11 @@ mail_config_service_page_constructed (GObject *object) page = E_MAIL_CONFIG_SERVICE_PAGE (object); - mail_config_service_page_init_backends (page); -} + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (e_mail_config_service_page_parent_class)-> + constructed (object); -static void -mail_config_service_page_submit_alert (EAlertSink *alert_sink, - EAlert *alert) -{ - EMailConfigServicePagePrivate *priv; - EAlertBar *alert_bar; - GtkWidget *dialog; - gpointer parent; - - priv = E_MAIL_CONFIG_SERVICE_PAGE_GET_PRIVATE (alert_sink); - - parent = gtk_widget_get_toplevel (GTK_WIDGET (alert_sink)); - parent = gtk_widget_is_toplevel (parent) ? parent : NULL; - - switch (e_alert_get_message_type (alert)) { - case GTK_MESSAGE_INFO: - case GTK_MESSAGE_WARNING: - case GTK_MESSAGE_ERROR: - alert_bar = E_ALERT_BAR (priv->alert_bar); - e_alert_bar_add_alert (alert_bar, alert); - break; - - default: - dialog = e_alert_dialog_new (parent, alert); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - break; - } + mail_config_service_page_init_backends (page); } static void @@ -597,12 +559,6 @@ e_mail_config_service_page_class_init (EMailConfigServicePageClass *class) G_PARAM_STATIC_STRINGS)); } -static void -e_mail_config_service_page_alert_sink_init (EAlertSinkInterface *interface) -{ - interface->submit_alert = mail_config_service_page_submit_alert; -} - static void e_mail_config_service_page_interface_init (EMailConfigPageInterface *interface) { @@ -619,7 +575,6 @@ e_mail_config_service_page_init (EMailConfigServicePage *page) PangoAttribute *attr; PangoAttrList *attr_list; GtkLabel *label; - GtkWidget *frame; GtkWidget *widget; GtkWidget *container; GtkTreeModel *tree_model; @@ -645,9 +600,6 @@ e_mail_config_service_page_init (EMailConfigServicePage *page) gtk_box_set_spacing (GTK_BOX (page), 12); - gtk_orientable_set_orientation ( - GTK_ORIENTABLE (page), GTK_ORIENTATION_VERTICAL); - page->priv = E_MAIL_CONFIG_SERVICE_PAGE_GET_PRIVATE (page); page->priv->candidates = candidates; page->priv->hidden_candidates = hidden_candidates; @@ -743,40 +695,6 @@ e_mail_config_service_page_init (EMailConfigServicePage *page) page->priv->notebook = widget; /* not referenced */ gtk_widget_show (widget); - widget = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN); - gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); - /* Visibility is bound to the EActivityBar. */ - - frame = widget; - - widget = e_activity_bar_new (); - gtk_container_add (GTK_CONTAINER (frame), widget); - page->priv->activity_bar = widget; /* not referenced */ - /* EActivityBar controls its own visibility. */ - - g_object_bind_property ( - widget, "visible", - frame, "visible", - G_BINDING_SYNC_CREATE); - - widget = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN); - gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); - /* Visibility is bound to the EAlertBar. */ - - frame = widget; - - widget = e_alert_bar_new (); - gtk_container_add (GTK_CONTAINER (frame), widget); - page->priv->alert_bar = widget; /* not referenced */ - /* EAlertBar controls its own visibility. */ - - g_object_bind_property ( - widget, "visible", - frame, "visible", - G_BINDING_SYNC_CREATE); - /* Keep the notebook's active page number synchronized with our * own "active-backend" property. Avoid G_BINDING_SYNC_CREATE * since we haven't added any notebook pages. */ @@ -976,32 +894,6 @@ e_mail_config_service_page_lookup_backend (EMailConfigServicePage *page, return NULL; } -EActivity * -e_mail_config_service_page_new_activity (EMailConfigServicePage *page) -{ - EActivity *activity; - EActivityBar *activity_bar; - GCancellable *cancellable; - - g_return_val_if_fail (E_IS_MAIL_CONFIG_SERVICE_PAGE (page), NULL); - - /* Clear any previous alerts. */ - e_alert_bar_clear (E_ALERT_BAR (page->priv->alert_bar)); - - activity = e_activity_new (); - - e_activity_set_alert_sink (activity, E_ALERT_SINK (page)); - - cancellable = camel_operation_new (); - e_activity_set_cancellable (activity, cancellable); - g_object_unref (cancellable); - - activity_bar = E_ACTIVITY_BAR (page->priv->activity_bar); - e_activity_bar_set_activity (activity_bar, activity); - - return activity; -} - void e_mail_config_service_page_auto_configure (EMailConfigServicePage *page, EMailAutoconfig *autoconfig) diff --git a/mail/e-mail-config-service-page.h b/mail/e-mail-config-service-page.h index 513356fd26..43623ab805 100644 --- a/mail/e-mail-config-service-page.h +++ b/mail/e-mail-config-service-page.h @@ -23,11 +23,10 @@ #ifndef E_MAIL_CONFIG_SERVICE_PAGE_H #define E_MAIL_CONFIG_SERVICE_PAGE_H -#include #include -#include #include +#include #include /* Standard GObject macros */ @@ -56,12 +55,12 @@ typedef struct _EMailConfigServicePageClass EMailConfigServicePageClass; typedef struct _EMailConfigServicePagePrivate EMailConfigServicePagePrivate; struct _EMailConfigServicePage { - GtkBox parent; + EMailConfigActivityPage parent; EMailConfigServicePagePrivate *priv; }; struct _EMailConfigServicePageClass { - GtkBoxClass parent_class; + EMailConfigActivityPageClass parent_class; const gchar *extension_name; CamelProviderType provider_type; @@ -93,8 +92,6 @@ EMailConfigServiceBackend * e_mail_config_service_page_lookup_backend (EMailConfigServicePage *page, const gchar *backend_name); -EActivity * e_mail_config_service_page_new_activity - (EMailConfigServicePage *page); void e_mail_config_service_page_auto_configure (EMailConfigServicePage *page, EMailAutoconfig *autoconfig); -- cgit v1.2.3