[gtk+/parser: 1/66] testgtk: Make it possible to stop the progressbar from updating
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/parser: 1/66] testgtk: Make it possible to stop the progressbar from updating
- Date: Mon, 11 Apr 2011 22:29:14 +0000 (UTC)
commit d915afbcb987bc1a5a14eff97fabb6436a9cac45
Author: Benjamin Otte <otte redhat com>
Date: Thu Mar 31 15:09:07 2011 +0200
testgtk: Make it possible to stop the progressbar from updating
This way, I can check that my invalidation fixes actually work.
tests/testgtk.c | 39 ++++++++++++++++++++++++++++++++++-----
1 files changed, 34 insertions(+), 5 deletions(-)
---
diff --git a/tests/testgtk.c b/tests/testgtk.c
index bfe4b77..74f7ddd 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -8233,8 +8233,11 @@ static void
destroy_progress (GtkWidget *widget,
ProgressData **pdata)
{
- g_source_remove ((*pdata)->timer);
- (*pdata)->timer = 0;
+ if ((*pdata)->timer)
+ {
+ g_source_remove ((*pdata)->timer);
+ (*pdata)->timer = 0;
+ }
(*pdata)->window = NULL;
g_free (*pdata);
*pdata = NULL;
@@ -8292,6 +8295,24 @@ toggle_activity_mode (GtkWidget *widget, ProgressData *pdata)
}
static void
+toggle_running (GtkWidget *widget, ProgressData *pdata)
+{
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ {
+ if (pdata->timer == 0)
+ pdata->timer = g_timeout_add (100, (GSourceFunc)progress_timeout, pdata);
+ }
+ else
+ {
+ if (pdata->timer != 0)
+ {
+ g_source_remove (pdata->timer);
+ pdata->timer = 0;
+ }
+ }
+}
+
+static void
entry_changed (GtkWidget *widget, ProgressData *pdata)
{
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (pdata->pbar),
@@ -8369,7 +8390,6 @@ create_progress_bar (GtkWidget *widget)
PANGO_ELLIPSIZE_MIDDLE);
gtk_container_add (GTK_CONTAINER (align), pdata->pbar);
- pdata->timer = g_timeout_add (100, (GSourceFunc)progress_timeout, pdata);
align = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_box_pack_start (GTK_BOX (vbox2), align, FALSE, FALSE, 5);
@@ -8405,16 +8425,25 @@ create_progress_bar (GtkWidget *widget)
5, 5);
gtk_box_pack_start (GTK_BOX (hbox), pdata->omenu1, TRUE, TRUE, 0);
+ check = gtk_check_button_new_with_label ("Running");
+ g_signal_connect (check, "toggled",
+ G_CALLBACK (toggle_running),
+ pdata);
+ gtk_table_attach (GTK_TABLE (tab), check, 0, 2, 1, 2,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
+ 5, 5);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
+
check = gtk_check_button_new_with_label ("Show text");
g_signal_connect (check, "clicked",
G_CALLBACK (toggle_show_text),
pdata);
- gtk_table_attach (GTK_TABLE (tab), check, 0, 1, 1, 2,
+ gtk_table_attach (GTK_TABLE (tab), check, 0, 1, 2, 3,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_table_attach (GTK_TABLE (tab), hbox, 1, 2, 1, 2,
+ gtk_table_attach (GTK_TABLE (tab), hbox, 1, 2, 2, 3,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]