aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-web-view.c47
-rw-r--r--e-util/e-web-view.h4
2 files changed, 51 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)
diff --git a/e-util/e-web-view.h b/e-util/e-web-view.h
index 5071e3681d..7897257e87 100644
--- a/e-util/e-web-view.h
+++ b/e-util/e-web-view.h
@@ -32,6 +32,7 @@
#define E_WEB_VIEW_H
#include <webkit/webkit.h>
+#include <e-util/e-activity.h>
/* Standard GObject macros */
#define E_TYPE_WEB_VIEW \
@@ -89,6 +90,8 @@ struct _EWebViewClass {
PangoFontDescription **variable_width);
/* Signals */
+ void (*new_activity) (EWebView *web_view,
+ EActivity *activity);
gboolean (*popup_event) (EWebView *web_view,
const gchar *uri);
void (*status_message) (EWebView *web_view,
@@ -179,6 +182,7 @@ void e_web_view_zoom_out (EWebView *web_view);
GtkUIManager * e_web_view_get_ui_manager (EWebView *web_view);
GtkWidget * e_web_view_get_popup_menu (EWebView *web_view);
void e_web_view_show_popup_menu (EWebView *web_view);
+EActivity * e_web_view_new_activity (EWebView *web_view);
void e_web_view_status_message (EWebView *web_view,
const gchar *status_message);
void e_web_view_stop_loading (EWebView *web_view);