diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-07-28 01:28:14 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-07-28 03:27:13 +0800 |
commit | c71f615a7f1d4f4c5df1d8a0a11af8f2319bdf20 (patch) | |
tree | c29391b134f2e5664a9bddc479a2aa5f82392098 /e-util/e-web-view.c | |
parent | 26e659aa334cfd17d30697af9efe7656ea5d4ba8 (diff) | |
download | gsoc2013-evolution-c71f615a7f1d4f4c5df1d8a0a11af8f2319bdf20.tar gsoc2013-evolution-c71f615a7f1d4f4c5df1d8a0a11af8f2319bdf20.tar.gz gsoc2013-evolution-c71f615a7f1d4f4c5df1d8a0a11af8f2319bdf20.tar.bz2 gsoc2013-evolution-c71f615a7f1d4f4c5df1d8a0a11af8f2319bdf20.tar.lz gsoc2013-evolution-c71f615a7f1d4f4c5df1d8a0a11af8f2319bdf20.tar.xz gsoc2013-evolution-c71f615a7f1d4f4c5df1d8a0a11af8f2319bdf20.tar.zst gsoc2013-evolution-c71f615a7f1d4f4c5df1d8a0a11af8f2319bdf20.zip |
Add e_web_view_new_activity().
Returns a new EActivity for an EWebView-related asynchronous operation,
and emits a "new-activity" signal. By default the EActivity comes loaded
with a GCancellable and sets the EWebView itself as the alert sink (which
means alerts are displayed directly in the content area). The signal
emission allows the EActivity to be further customized and/or tracked by
the application.
Diffstat (limited to 'e-util/e-web-view.c')
-rw-r--r-- | e-util/e-web-view.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/e-util/e-web-view.c b/e-util/e-web-view.c index 7ad17b6b1f..de190c5eea 100644 --- a/e-util/e-web-view.c +++ b/e-util/e-web-view.c @@ -97,6 +97,7 @@ enum { }; enum { + NEW_ACTIVITY, POPUP_EVENT, STATUS_MESSAGE, STOP_LOADING, @@ -1535,6 +1536,16 @@ e_web_view_class_init (EWebViewClass *class) NULL, G_PARAM_READWRITE)); + signals[NEW_ACTIVITY] = g_signal_new ( + "new-activity", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EWebViewClass, new_activity), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + E_TYPE_ACTIVITY); + signals[POPUP_EVENT] = g_signal_new ( "popup-event", G_TYPE_FROM_CLASS (class), @@ -2507,6 +2518,42 @@ e_web_view_show_popup_menu (EWebView *web_view) 0, gtk_get_current_event_time ()); } +/** + * e_web_view_new_activity: + * @web_view: an #EWebView + * + * Returns a new #EActivity for an #EWebView-related asynchronous operation, + * and emits the #EWebView::new-activity signal. By default the #EActivity + * comes loaded with a #GCancellable and sets the @web_view itself as the + * #EActivity:alert-sink (which means alerts are displayed directly in the + * content area). The signal emission allows the #EActivity to be further + * customized and/or tracked by the application. + * + * Returns: an #EActivity + **/ +EActivity * +e_web_view_new_activity (EWebView *web_view) +{ + EActivity *activity; + EAlertSink *alert_sink; + GCancellable *cancellable; + + g_return_val_if_fail (E_IS_WEB_VIEW (web_view), NULL); + + activity = e_activity_new (); + + alert_sink = E_ALERT_SINK (web_view); + e_activity_set_alert_sink (activity, alert_sink); + + cancellable = g_cancellable_new (); + e_activity_set_cancellable (activity, cancellable); + g_object_unref (cancellable); + + g_signal_emit (web_view, signals[NEW_ACTIVITY], 0, activity); + + return activity; +} + void e_web_view_status_message (EWebView *web_view, const gchar *status_message) |