[gtk+/refactor: 1/10] tests: use accessor functions to access GtkToogleButton
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/refactor: 1/10] tests: use accessor functions to access GtkToogleButton
- Date: Tue, 19 Oct 2010 17:19:49 +0000 (UTC)
commit c2760a350ee20d0fa89f2b8b2761402528f0e243
Author: Javier Jardón <jjardon gnome org>
Date: Tue Oct 19 18:46:40 2010 +0200
tests: use accessor functions to access GtkToogleButton
tests/prop-editor.c | 9 +++++----
tests/testgtk.c | 30 +++++++++++++++++-------------
tests/testselection.c | 2 +-
3 files changed, 23 insertions(+), 18 deletions(-)
---
diff --git a/tests/prop-editor.c b/tests/prop-editor.c
index 0a9a3f8..31c1393 100644
--- a/tests/prop-editor.c
+++ b/tests/prop-editor.c
@@ -364,11 +364,12 @@ bool_modified (GtkToggleButton *tb, gpointer data)
GtkWidget *widget = GTK_WIDGET (p->obj);
GtkWidget *parent = gtk_widget_get_parent (widget);
- gtk_container_child_set (GTK_CONTAINER (parent),
- widget, p->spec->name, (int) tb->active, NULL);
+ gtk_container_child_set (GTK_CONTAINER (parent), widget,
+ p->spec->name, (int) gtk_toggle_button_get_active (tb),
+ NULL);
}
else
- g_object_set (p->obj, p->spec->name, (int) tb->active, NULL);
+ g_object_set (p->obj, p->spec->name, (int) gtk_toggle_button_get_active (tb), NULL);
}
static void
@@ -381,7 +382,7 @@ bool_changed (GObject *object, GParamSpec *pspec, gpointer data)
g_value_init (&val, G_TYPE_BOOLEAN);
get_property_value (object, pspec, &val);
- if (g_value_get_boolean (&val) != tb->active)
+ if (g_value_get_boolean (&val) != gtk_toggle_button_get_active (tb))
{
block_controller (G_OBJECT (tb));
gtk_toggle_button_set_active (tb, g_value_get_boolean (&val));
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 49a227e..c8e4358 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -1773,7 +1773,8 @@ static void
sensitivity_toggled (GtkWidget *toggle,
GtkWidget *widget)
{
- gtk_widget_set_sensitive (widget, GTK_TOGGLE_BUTTON (toggle)->active);
+ gtk_widget_set_sensitive (widget,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
}
static GtkWidget*
@@ -1826,7 +1827,7 @@ selectable_toggled (GtkWidget *toggle,
GtkWidget *widget)
{
set_selectable_recursive (widget,
- GTK_TOGGLE_BUTTON (toggle)->active);
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
}
static GtkWidget*
@@ -2555,7 +2556,7 @@ static void
uposition_stop_configure (GtkToggleButton *toggle,
GObject *window)
{
- if (toggle->active)
+ if (gtk_toggle_button_get_active (toggle))
g_signal_handlers_block_by_func (window, G_CALLBACK (uposition_configure), NULL);
else
g_signal_handlers_unblock_by_func (window, G_CALLBACK (uposition_configure), NULL);
@@ -3862,14 +3863,15 @@ entry_toggle_frame (GtkWidget *checkbutton,
GtkWidget *entry)
{
gtk_entry_set_has_frame (GTK_ENTRY(entry),
- GTK_TOGGLE_BUTTON(checkbutton)->active);
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton)));
}
static void
entry_toggle_sensitive (GtkWidget *checkbutton,
GtkWidget *entry)
{
- gtk_widget_set_sensitive (entry, GTK_TOGGLE_BUTTON(checkbutton)->active);
+ gtk_widget_set_sensitive (entry,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(checkbutton)));
}
static gboolean
@@ -3905,7 +3907,7 @@ static void
entry_toggle_progress (GtkWidget *checkbutton,
GtkWidget *entry)
{
- if (GTK_TOGGLE_BUTTON (checkbutton)->active)
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton)))
{
guint timeout = gdk_threads_add_timeout (100,
entry_progress_timeout,
@@ -3928,7 +3930,7 @@ entry_toggle_pulse (GtkWidget *checkbutton,
GtkWidget *entry)
{
g_object_set_data (G_OBJECT (entry), "progress-pulse",
- GUINT_TO_POINTER ((guint) GTK_TOGGLE_BUTTON (checkbutton)->active));
+ GUINT_TO_POINTER ((guint) gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton))));
}
static void
@@ -4119,7 +4121,7 @@ event_box_toggle_visible_window (GtkWidget *checkbutton,
GtkEventBox *event_box)
{
gtk_event_box_set_visible_window (event_box,
- GTK_TOGGLE_BUTTON(checkbutton)->active);
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton)));
}
static void
@@ -4127,7 +4129,7 @@ event_box_toggle_above_child (GtkWidget *checkbutton,
GtkEventBox *event_box)
{
gtk_event_box_set_above_child (event_box,
- GTK_TOGGLE_BUTTON(checkbutton)->active);
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton)));
}
static void
@@ -4406,13 +4408,15 @@ static GtkWidget *spinner1;
static void
toggle_snap (GtkWidget *widget, GtkSpinButton *spin)
{
- gtk_spin_button_set_snap_to_ticks (spin, GTK_TOGGLE_BUTTON (widget)->active);
+ gtk_spin_button_set_snap_to_ticks (spin,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
}
static void
toggle_numeric (GtkWidget *widget, GtkSpinButton *spin)
{
- gtk_spin_button_set_numeric (spin, GTK_TOGGLE_BUTTON (widget)->active);
+ gtk_spin_button_set_numeric (spin,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
}
static void
@@ -6239,7 +6243,7 @@ static void
notebook_popup (GtkToggleButton *button,
GtkNotebook *notebook)
{
- if (button->active)
+ if (gtk_toggle_button_get_active (button))
gtk_notebook_popup_enable (notebook);
else
gtk_notebook_popup_disable (notebook);
@@ -7700,7 +7704,7 @@ resizable_callback (GtkWidget *widget,
gpointer data)
{
g_object_set (g_object_get_data (data, "target"),
- "resizable", GTK_TOGGLE_BUTTON (widget)->active,
+ "resizable", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)),
NULL);
}
diff --git a/tests/testselection.c b/tests/testselection.c
index ff7a99c..088225e 100644
--- a/tests/testselection.c
+++ b/tests/testselection.c
@@ -140,7 +140,7 @@ init_atoms (void)
void
selection_toggled (GtkWidget *widget)
{
- if (GTK_TOGGLE_BUTTON(widget)->active)
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
{
have_selection = gtk_selection_owner_set (selection_widget,
GDK_SELECTION_PRIMARY,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]