[evolution/wip/webkit-composer: 158/262] EEditor: Add a read-only "busy" property.
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit-composer: 158/262] EEditor: Add a read-only "busy" property.
- Date: Thu, 16 Jan 2014 10:01:09 +0000 (UTC)
commit 856619ffbe8896ae8baadade2920e5480dd48567
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Feb 7 16:20:34 2013 -0500
EEditor: Add a read-only "busy" property.
This is only TRUE while an activity is in progress.
Useful for temporarily disabling parts of the user interface.
.../evolution-util/evolution-util-sections.txt | 1 +
e-util/e-editor-private.h | 2 +
e-util/e-editor.c | 55 ++++++++++++++++++++
e-util/e-editor.h | 1 +
4 files changed, 59 insertions(+), 0 deletions(-)
---
diff --git a/doc/reference/evolution-util/evolution-util-sections.txt
b/doc/reference/evolution-util/evolution-util-sections.txt
index 36d60b7..85313c2 100644
--- a/doc/reference/evolution-util/evolution-util-sections.txt
+++ b/doc/reference/evolution-util/evolution-util-sections.txt
@@ -1571,6 +1571,7 @@ e_dialog_combo_box_get
<TITLE>EEditor</TITLE>
EEditor
e_editor_new
+e_editor_is_busy
e_editor_get_editor_widget
e_editor_get_builder
e_editor_get_ui_manager
diff --git a/e-util/e-editor-private.h b/e-util/e-editor-private.h
index 0ac4334..575c347 100644
--- a/e-util/e-editor-private.h
+++ b/e-util/e-editor-private.h
@@ -94,6 +94,8 @@ struct _EEditorPrivate {
WebKitDOMNode *table_cell;
gint editor_layout_row;
+
+ gboolean busy;
};
void editor_actions_init (EEditor *editor);
diff --git a/e-util/e-editor.c b/e-util/e-editor.c
index b0f0594..a19b794 100644
--- a/e-util/e-editor.c
+++ b/e-util/e-editor.c
@@ -65,6 +65,7 @@
enum {
PROP_0,
+ PROP_BUSY,
PROP_FILENAME
};
@@ -549,6 +550,23 @@ editor_parent_changed (GtkWidget *widget,
}
static void
+editor_notify_activity_cb (EActivityBar *activity_bar,
+ GParamSpec *pspec,
+ EEditor *editor)
+{
+ gboolean busy;
+
+ busy = (e_activity_bar_get_activity (activity_bar) != NULL);
+
+ if (busy == editor->priv->busy)
+ return;
+
+ editor->priv->busy = busy;
+
+ g_object_notify (G_OBJECT (editor), "busy");
+}
+
+static void
editor_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -573,6 +591,12 @@ editor_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_BUSY:
+ g_value_set_boolean (
+ value, e_editor_is_busy (
+ E_EDITOR (object)));
+ return;
+
case PROP_FILENAME:
g_value_set_string (
value, e_editor_get_filename (
@@ -618,6 +642,10 @@ editor_constructed (GObject *object)
priv->activity_bar = g_object_ref (widget);
/* EActivityBar controls its own visibility. */
+ g_signal_connect (
+ widget, "notify::activity",
+ G_CALLBACK (editor_notify_activity_cb), editor);
+
/* Construct the alert bar for errors. */
widget = e_alert_bar_new ();
@@ -807,6 +835,17 @@ e_editor_class_init (EEditorClass *class)
g_object_class_install_property (
object_class,
+ PROP_BUSY,
+ g_param_spec_boolean (
+ "busy",
+ "Busy",
+ "Whether an activity is in progress",
+ FALSE,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
PROP_FILENAME,
g_param_spec_string (
"filename",
@@ -896,6 +935,22 @@ e_editor_new (void)
}
/**
+ * e_editor_is_busy:
+ * @editor: an #EEditor
+ *
+ * Returns %TRUE only while an #EActivity is in progress.
+ *
+ * Returns: whether @editor is busy
+ **/
+gboolean
+e_editor_is_busy (EEditor *editor)
+{
+ g_return_val_if_fail (E_IS_EDITOR (editor), FALSE);
+
+ return editor->priv->busy;
+}
+
+/**
* e_editor_get_editor_widget:
* @editor: an #EEditor
*
diff --git a/e-util/e-editor.h b/e-util/e-editor.h
index 9a01d1b..77c635f 100644
--- a/e-util/e-editor.h
+++ b/e-util/e-editor.h
@@ -69,6 +69,7 @@ struct _EEditorClass {
GType e_editor_get_type (void) G_GNUC_CONST;
GtkWidget * e_editor_new (void);
+gboolean e_editor_is_busy (EEditor *editor);
EEditorWidget * e_editor_get_editor_widget (EEditor *editor);
GtkBuilder * e_editor_get_builder (EEditor *editor);
GtkUIManager * e_editor_get_ui_manager (EEditor *editor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]