aboutsummaryrefslogtreecommitdiffstats
path: root/executive-summary/component
diff options
context:
space:
mode:
Diffstat (limited to 'executive-summary/component')
-rw-r--r--executive-summary/component/e-summary-factory.c1
-rw-r--r--executive-summary/component/e-summary-url.c10
-rw-r--r--executive-summary/component/e-summary.c39
-rw-r--r--executive-summary/component/e-summary.h2
4 files changed, 37 insertions, 15 deletions
diff --git a/executive-summary/component/e-summary-factory.c b/executive-summary/component/e-summary-factory.c
index 48c35f9035..5d32b3ee6b 100644
--- a/executive-summary/component/e-summary-factory.c
+++ b/executive-summary/component/e-summary-factory.c
@@ -202,6 +202,5 @@ e_summary_factory_new_control (const char *uri,
control_list = g_list_prepend (control_list, control);
- e_summary_rebuild_page (E_SUMMARY (esummary));
return control;
}
diff --git a/executive-summary/component/e-summary-url.c b/executive-summary/component/e-summary-url.c
index dd3f6deb4e..ae218cf7c8 100644
--- a/executive-summary/component/e-summary-url.c
+++ b/executive-summary/component/e-summary-url.c
@@ -427,7 +427,7 @@ e_summary_url_click (GtkWidget *widget,
break;
e_summary_remove_window (esummary, window);
- e_summary_rebuild_page (esummary);
+ e_summary_queue_rebuild (esummary);
break;
case PROTOCOL_CONFIGURE:
@@ -489,7 +489,7 @@ e_summary_url_click (GtkWidget *widget,
break;
e_summary_window_move_left (esummary, window);
- e_summary_rebuild_page (esummary);
+ e_summary_queue_rebuild (esummary);
break;
case PROTOCOL_RIGHT:
@@ -499,7 +499,7 @@ e_summary_url_click (GtkWidget *widget,
break;
e_summary_window_move_right (esummary, window);
- e_summary_rebuild_page (esummary);
+ e_summary_queue_rebuild (esummary);
break;
case PROTOCOL_UP:
@@ -509,7 +509,7 @@ e_summary_url_click (GtkWidget *widget,
break;
e_summary_window_move_up (esummary, window);
- e_summary_rebuild_page (esummary);
+ e_summary_queue_rebuild (esummary);
break;
case PROTOCOL_DOWN:
@@ -519,7 +519,7 @@ e_summary_url_click (GtkWidget *widget,
break;
e_summary_window_move_down (esummary, window);
- e_summary_rebuild_page (esummary);
+ e_summary_queue_rebuild (esummary);
break;
case PROTOCOL_NONE:
diff --git a/executive-summary/component/e-summary.c b/executive-summary/component/e-summary.c
index 925f4501fe..cf085bfb1f 100644
--- a/executive-summary/component/e-summary.c
+++ b/executive-summary/component/e-summary.c
@@ -220,7 +220,7 @@ e_summary_init (ESummary *esummary)
gtk_container_add (GTK_CONTAINER (priv->html_scroller), priv->html);
gtk_widget_show_all (priv->html_scroller);
- e_summary_rebuild_page (esummary);
+ e_summary_queue_rebuild (esummary);
/* Pack stuff */
gtk_box_pack_start (GTK_BOX (esummary), priv->html_scroller,
@@ -481,7 +481,7 @@ e_summary_display_window (ESummary *esummary,
footer, strlen (footer));
}
-int
+static int
e_summary_rebuild_page (ESummary *esummary)
{
ESummaryPrivate *priv;
@@ -495,11 +495,19 @@ e_summary_rebuild_page (ESummary *esummary)
priv = esummary->private;
+ if (priv->idle == 0) {
+ g_warning ("esummary->private->idle == 0! This means that "
+ "e_summary_rebuild_page was called by itself and "
+ "not queued. You should use e_summary_queue_rebuild "
+ "instead.");
+ return FALSE;
+ }
+
/* If there is a selection, don't redraw the page so that the selection
isn't cleared */
if (GTK_HTML (priv->html)->in_selection == TRUE ||
html_engine_is_selection_active (GTK_HTML (priv->html)->engine) == TRUE)
- return TRUE;
+ return FALSE;
gtk_layout_freeze (GTK_LAYOUT (priv->html));
e_summary_start_load (esummary);
@@ -559,6 +567,21 @@ e_summary_rebuild_page (ESummary *esummary)
return FALSE;
}
+/* This is the function that should be called instead of
+ e_summary_queue_rebuild. This prevents multiple
+ rebuilds happening together. */
+void
+e_summary_queue_rebuild (ESummary *esummary)
+{
+ ESummaryPrivate *priv;
+
+ priv = esummary->private;
+ if (priv->idle != 0)
+ return;
+
+ priv->idle = g_idle_add (e_summary_rebuild_page, esummary);
+}
+
static void
html_event (BonoboListener *listener,
char *event_name,
@@ -573,7 +596,7 @@ html_event (BonoboListener *listener,
return;
}
- e_summary_rebuild_page (window->esummary);
+ e_summary_queue_rebuild (window->esummary);
}
static void
@@ -586,7 +609,7 @@ prop_changed_cb (BonoboPropertyListener *listener,
if (window->title != NULL)
g_free (window->title);
window->title = g_strdup (BONOBO_ARG_GET_STRING (arg));
- e_summary_rebuild_page (window->esummary);
+ e_summary_queue_rebuild (window->esummary);
return;
}
@@ -594,7 +617,7 @@ prop_changed_cb (BonoboPropertyListener *listener,
if (window->icon != NULL)
g_free (window->icon);
window->icon = g_strdup (BONOBO_ARG_GET_STRING (arg));
- e_summary_rebuild_page (window->esummary);
+ e_summary_queue_rebuild (window->esummary);
return;
}
}
@@ -726,7 +749,7 @@ e_summary_embed_service_from_id (ESummary *esummary,
bonobo_object_unref (BONOBO_OBJECT (client));
window = e_summary_add_service (esummary, component, obj_id);
- e_summary_rebuild_page (esummary);
+ e_summary_queue_rebuild (esummary);
return window;
}
@@ -1104,7 +1127,7 @@ e_summary_reconfigure (ESummary *esummary)
prefs = esummary->prefs;
e_summary_load_page (esummary);
- e_summary_rebuild_page (esummary);
+ e_summary_queue_rebuild (esummary);
}
static void
diff --git a/executive-summary/component/e-summary.h b/executive-summary/component/e-summary.h
index 90c1412f95..8d80b70939 100644
--- a/executive-summary/component/e-summary.h
+++ b/executive-summary/component/e-summary.h
@@ -81,7 +81,7 @@ struct _ESummaryClass {
GtkType e_summary_get_type (void);
GtkWidget *e_summary_new (const GNOME_Evolution_Shell shell);
-int e_summary_rebuild_page (ESummary *esummary);
+void e_summary_queue_rebuild (ESummary *esummary);
void e_summary_window_free (ESummaryWindow *window);
void e_summary_remove_window (ESummary *esummary,