Commit 4c2a74b7 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Reduce new_text_length appropriately when we run into the size limit for

Wed May  2 20:36:38 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkentry.c (gtk_entry_real_insert_text): Reduce
	new_text_length appropriately when we run into the
	size limit for the entry. (#53445, reported by Jeff Franks)

	* tests/testgtk.c (create_entry): Remove most of the
	property toggle buttons. Replace with a "Props" button
	that brings up a property editor.

	* tests/prop-editor.[ch] test/testtreeview.c tests/Makefile.am:
	Split the property editor code out for reuse, improve.
parent a5d1bc41
Wed May 2 20:36:38 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_real_insert_text): Reduce
new_text_length appropriately when we run into the
size limit for the entry. (#53445, reported by Jeff Franks)
* tests/testgtk.c (create_entry): Remove most of the
property toggle buttons. Replace with a "Props" button
that brings up a property editor.
* tests/prop-editor.[ch] test/testtreeview.c tests/Makefile.am:
Split the property editor code out for reuse, improve.
Wed May 2 17:26:22 2001 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c gdk/x11/gdkwindow-x11.c: Always
......
Wed May 2 20:36:38 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_real_insert_text): Reduce
new_text_length appropriately when we run into the
size limit for the entry. (#53445, reported by Jeff Franks)
* tests/testgtk.c (create_entry): Remove most of the
property toggle buttons. Replace with a "Props" button
that brings up a property editor.
* tests/prop-editor.[ch] test/testtreeview.c tests/Makefile.am:
Split the property editor code out for reuse, improve.
Wed May 2 17:26:22 2001 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c gdk/x11/gdkwindow-x11.c: Always
......
Wed May 2 20:36:38 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_real_insert_text): Reduce
new_text_length appropriately when we run into the
size limit for the entry. (#53445, reported by Jeff Franks)
* tests/testgtk.c (create_entry): Remove most of the
property toggle buttons. Replace with a "Props" button
that brings up a property editor.
* tests/prop-editor.[ch] test/testtreeview.c tests/Makefile.am:
Split the property editor code out for reuse, improve.
Wed May 2 17:26:22 2001 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c gdk/x11/gdkwindow-x11.c: Always
......
Wed May 2 20:36:38 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_real_insert_text): Reduce
new_text_length appropriately when we run into the
size limit for the entry. (#53445, reported by Jeff Franks)
* tests/testgtk.c (create_entry): Remove most of the
property toggle buttons. Replace with a "Props" button
that brings up a property editor.
* tests/prop-editor.[ch] test/testtreeview.c tests/Makefile.am:
Split the property editor code out for reuse, improve.
Wed May 2 17:26:22 2001 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c gdk/x11/gdkwindow-x11.c: Always
......
Wed May 2 20:36:38 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_real_insert_text): Reduce
new_text_length appropriately when we run into the
size limit for the entry. (#53445, reported by Jeff Franks)
* tests/testgtk.c (create_entry): Remove most of the
property toggle buttons. Replace with a "Props" button
that brings up a property editor.
* tests/prop-editor.[ch] test/testtreeview.c tests/Makefile.am:
Split the property editor code out for reuse, improve.
Wed May 2 17:26:22 2001 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c gdk/x11/gdkwindow-x11.c: Always
......
Wed May 2 20:36:38 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_real_insert_text): Reduce
new_text_length appropriately when we run into the
size limit for the entry. (#53445, reported by Jeff Franks)
* tests/testgtk.c (create_entry): Remove most of the
property toggle buttons. Replace with a "Props" button
that brings up a property editor.
* tests/prop-editor.[ch] test/testtreeview.c tests/Makefile.am:
Split the property editor code out for reuse, improve.
Wed May 2 17:26:22 2001 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c gdk/x11/gdkwindow-x11.c: Always
......
Wed May 2 20:36:38 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_real_insert_text): Reduce
new_text_length appropriately when we run into the
size limit for the entry. (#53445, reported by Jeff Franks)
* tests/testgtk.c (create_entry): Remove most of the
property toggle buttons. Replace with a "Props" button
that brings up a property editor.
* tests/prop-editor.[ch] test/testtreeview.c tests/Makefile.am:
Split the property editor code out for reuse, improve.
Wed May 2 17:26:22 2001 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkevents-x11.c gdk/x11/gdkwindow-x11.c: Always
......
......@@ -754,7 +754,7 @@ gtk_entry_set_property (GObject *object,
break;
case PROP_INVISIBLE_CHAR:
gtk_entry_set_invisible_char (entry, g_value_get_int (value));
gtk_entry_set_invisible_char (entry, g_value_get_uint (value));
break;
case PROP_ACTIVATES_DEFAULT:
......@@ -796,7 +796,7 @@ gtk_entry_get_property (GObject *object,
g_value_set_boolean (value, entry->visible);
break;
case PROP_INVISIBLE_CHAR:
g_value_set_int (value, entry->invisible_char);
g_value_set_uint (value, entry->invisible_char);
break;
case PROP_ACTIVATES_DEFAULT:
g_value_set_boolean (value, entry->activates_default);
......@@ -1752,6 +1752,7 @@ gtk_entry_real_insert_text (GtkEntry *entry,
{
gdk_beep ();
n_chars = entry->text_max_length - entry->text_length;
new_text_length = g_utf8_offset_to_pointer (new_text, n_chars) - new_text;
}
if (new_text_length + entry->n_bytes + 1 > entry->text_size)
......
......@@ -85,7 +85,16 @@ testtreesort_LDADD = $(LDADDS)
testtext_LDADD = $(LDADDS)
treestoretest_LDADD = $(LDADDS)
testgtk_SOURCES = \
prop-editor.c \
testgtk.c
testtreeview_SOURCES = \
prop-editor.c \
testtreeview.c
EXTRA_DIST += @STRIP_BEGIN@ \
prop-editor.h \
testgtk.1 \
testgtkrc \
testgtkrc2 \
......
......@@ -47,6 +47,8 @@
#define sleep(n) _sleep(n)
#endif
#include "prop-editor.h"
#include "circles.xbm"
#include "test.xpm"
......@@ -3517,14 +3519,6 @@ entry_toggle_frame (GtkWidget *checkbutton,
GTK_TOGGLE_BUTTON(checkbutton)->active);
}
static void
entry_toggle_editable (GtkWidget *checkbutton,
GtkWidget *entry)
{
gtk_entry_set_editable(GTK_ENTRY(entry),
GTK_TOGGLE_BUTTON(checkbutton)->active);
}
static void
entry_toggle_sensitive (GtkWidget *checkbutton,
GtkWidget *entry)
......@@ -3533,30 +3527,12 @@ entry_toggle_sensitive (GtkWidget *checkbutton,
}
static void
entry_toggle_visibility (GtkWidget *checkbutton,
GtkWidget *entry)
{
gtk_entry_set_visibility (GTK_ENTRY (entry),
GTK_TOGGLE_BUTTON (checkbutton)->active);
}
static void
entry_toggle_invisible_char (GtkWidget *checkbutton,
GtkWidget *entry)
entry_props_clicked (GtkWidget *button,
GObject *entry)
{
if (GTK_TOGGLE_BUTTON (checkbutton)->active)
gtk_entry_set_invisible_char (GTK_ENTRY (entry), 0);
else
gtk_entry_set_invisible_char (GTK_ENTRY (entry), '*');
}
GtkWidget *window = create_prop_editor (entry);
static void
entry_toggle_activate_default (GtkWidget *checkbutton,
GtkWidget *entry)
{
gtk_entry_set_activates_default (GTK_ENTRY (entry),
GTK_TOGGLE_BUTTON (checkbutton)->active);
gtk_window_set_title (GTK_WINDOW (window), "Entry Properties");
}
static void
......@@ -3565,10 +3541,9 @@ create_entry (void)
static GtkWidget *window = NULL;
GtkWidget *box1;
GtkWidget *box2;
GtkWidget *editable_check;
GtkWidget *hbox;
GtkWidget *has_frame_check;
GtkWidget *sensitive_check;
GtkWidget *invisible_char_check;
GtkWidget *activate_check;
GtkWidget *entry, *cb;
GtkWidget *button;
GtkWidget *separator;
......@@ -3599,19 +3574,25 @@ create_entry (void)
box1 = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box1);
gtk_widget_show (box1);
box2 = gtk_vbox_new (FALSE, 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2);
hbox = gtk_hbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (box2), hbox, TRUE, TRUE, 0);
entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (entry), "hello world السلام عليكم");
gtk_editable_select_region (GTK_EDITABLE (entry), 0, 5);
gtk_box_pack_start (GTK_BOX (box2), entry, TRUE, TRUE, 0);
gtk_widget_show (entry);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
button = gtk_button_new_with_mnemonic ("_Props");
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (entry_props_clicked),
entry);
cb = gtk_combo_new ();
gtk_combo_set_popdown_strings (GTK_COMBO (cb), cbitems);
......@@ -3619,58 +3600,25 @@ create_entry (void)
gtk_editable_select_region (GTK_EDITABLE (GTK_COMBO(cb)->entry),
0, -1);
gtk_box_pack_start (GTK_BOX (box2), cb, TRUE, TRUE, 0);
gtk_widget_show (cb);
editable_check = gtk_check_button_new_with_label("Editable");
gtk_box_pack_start (GTK_BOX (box2), editable_check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(editable_check), "toggled",
GTK_SIGNAL_FUNC(entry_toggle_editable), entry);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(editable_check), TRUE);
gtk_widget_show (editable_check);
editable_check = gtk_check_button_new_with_label("Visible");
gtk_box_pack_start (GTK_BOX (box2), editable_check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(editable_check), "toggled",
GTK_SIGNAL_FUNC(entry_toggle_visibility), entry);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(editable_check), TRUE);
gtk_widget_show (editable_check);
sensitive_check = gtk_check_button_new_with_label("Sensitive");
gtk_box_pack_start (GTK_BOX (box2), sensitive_check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(sensitive_check), "toggled",
GTK_SIGNAL_FUNC(entry_toggle_sensitive), entry);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sensitive_check), TRUE);
gtk_widget_show (sensitive_check);
activate_check = gtk_check_button_new_with_label ("Activates default");
gtk_box_pack_start (GTK_BOX (box2), activate_check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (activate_check), "toggled",
GTK_SIGNAL_FUNC (entry_toggle_activate_default), entry);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (activate_check), FALSE);
gtk_widget_show (activate_check);
invisible_char_check = gtk_check_button_new_with_label("invisible_char = 0");
gtk_box_pack_start (GTK_BOX (box2), invisible_char_check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(invisible_char_check), "toggled",
GTK_SIGNAL_FUNC(entry_toggle_invisible_char), entry);
gtk_widget_show (invisible_char_check);
editable_check = gtk_check_button_new_with_label("Has Frame");
gtk_box_pack_start (GTK_BOX (box2), editable_check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(editable_check), "toggled",
has_frame_check = gtk_check_button_new_with_label("Has Frame");
gtk_box_pack_start (GTK_BOX (box2), has_frame_check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(has_frame_check), "toggled",
GTK_SIGNAL_FUNC(entry_toggle_frame), entry);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(editable_check), TRUE);
gtk_widget_show (editable_check);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(has_frame_check), TRUE);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
gtk_widget_show (separator);
box2 = gtk_vbox_new (FALSE, 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
gtk_widget_show (box2);
button = gtk_button_new_with_label ("close");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
......@@ -3679,11 +3627,10 @@ create_entry (void)
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
gtk_widget_show (button);
}
if (!GTK_WIDGET_VISIBLE (window))
gtk_widget_show (window);
gtk_widget_show_all (window);
else
gtk_widget_destroy (window);
}
......@@ -8381,35 +8328,35 @@ window_controls (GtkWidget *window)
g_object_set_data (G_OBJECT (control_window), "spin2", spin);
button = gtk_button_new_with_label ("Queue resize");
gtk_signal_connect_object (GTK_WIDGET (button),
gtk_signal_connect_object (GTK_OBJECT (button),
"clicked",
GTK_SIGNAL_FUNC (gtk_widget_queue_resize),
GTK_OBJECT (control_window));
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
button = gtk_button_new_with_label ("Set size");
gtk_signal_connect (GTK_WIDGET (button),
gtk_signal_connect (GTK_OBJECT (button),
"clicked",
GTK_SIGNAL_FUNC (set_size_callback),
GTK_OBJECT (control_window));
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
button = gtk_button_new_with_label ("Set default size");
gtk_signal_connect (GTK_WIDGET (button),
gtk_signal_connect (GTK_OBJECT (button),
"clicked",
GTK_SIGNAL_FUNC (set_default_size_callback),
GTK_OBJECT (control_window));
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
button = gtk_button_new_with_label ("Set usize");
gtk_signal_connect (GTK_WIDGET (button),
gtk_signal_connect (GTK_OBJECT (button),
"clicked",
GTK_SIGNAL_FUNC (set_usize_callback),
GTK_OBJECT (control_window));
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
button = gtk_button_new_with_label ("Set location");
gtk_signal_connect (GTK_WIDGET (button),
gtk_signal_connect (GTK_OBJECT (button),
"clicked",
GTK_SIGNAL_FUNC (set_location_callback),
GTK_OBJECT (control_window));
......@@ -8417,7 +8364,7 @@ window_controls (GtkWidget *window)
button = gtk_check_button_new_with_label ("Allow shrink");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
gtk_signal_connect (GTK_WIDGET (button),
gtk_signal_connect (GTK_OBJECT (button),
"toggled",
GTK_SIGNAL_FUNC (allow_shrink_callback),
GTK_OBJECT (control_window));
......@@ -8425,7 +8372,7 @@ window_controls (GtkWidget *window)
button = gtk_check_button_new_with_label ("Allow grow");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
gtk_signal_connect (GTK_WIDGET (button),
gtk_signal_connect (GTK_OBJECT (button),
"toggled",
GTK_SIGNAL_FUNC (allow_grow_callback),
GTK_OBJECT (control_window));
......@@ -8433,7 +8380,7 @@ window_controls (GtkWidget *window)
button = gtk_check_button_new_with_label ("Auto shrink");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
gtk_signal_connect (GTK_WIDGET (button),
gtk_signal_connect (GTK_OBJECT (button),
"toggled",
GTK_SIGNAL_FUNC (auto_shrink_callback),
GTK_OBJECT (control_window));
......
#include <gtk/gtk.h>
#include <string.h>
#include "prop-editor.h"
#include <gtk/gtk.h>
/* Don't copy this bad example; inline RGB data is always a better
......@@ -32,7 +32,6 @@ static char *book_closed_xpm[] = {
" "
};
static GtkWidget* create_prop_editor (GObject *object);
static void run_automated_tests (void);
/* This custom model is to test custom model use. */
......@@ -303,7 +302,7 @@ set_columns_type (GtkTreeView *tree_view, ColumnsType type)
rend = gtk_cell_renderer_toggle_new ();
g_signal_connect_data (G_OBJECT (rend), "toggled",
toggled_callback, tree_view,
GTK_SIGNAL_FUNC (toggled_callback), tree_view,
NULL, FALSE, FALSE);
col = gtk_tree_view_column_new_with_attributes ("Column 3",
......@@ -315,7 +314,7 @@ set_columns_type (GtkTreeView *tree_view, ColumnsType type)
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), col);
pixbuf = gdk_pixbuf_new_from_xpm_data (book_closed_xpm);
pixbuf = gdk_pixbuf_new_from_xpm_data ((char **)book_closed_xpm);
image = gtk_image_new_from_pixbuf (pixbuf);
......@@ -336,7 +335,7 @@ set_columns_type (GtkTreeView *tree_view, ColumnsType type)
g_object_set (G_OBJECT (rend), "radio", TRUE, NULL);
g_signal_connect_data (G_OBJECT (rend), "toggled",
toggled_callback, tree_view,
G_CALLBACK (toggled_callback), tree_view,
NULL, FALSE, FALSE);
col = gtk_tree_view_column_new_with_attributes ("Column 4",
......@@ -910,7 +909,7 @@ gtk_tree_model_types_class_init (GtkTreeModelTypesClass *class)
GTK_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
GTK_SIGNAL_OFFSET (GtkTreeModelTypesClass, changed),
NULL,
NULL, NULL,
gtk_marshal_VOID__BOXED_BOXED,
G_TYPE_NONE, 2,
G_TYPE_POINTER,
......@@ -920,7 +919,7 @@ gtk_tree_model_types_class_init (GtkTreeModelTypesClass *class)
GTK_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
GTK_SIGNAL_OFFSET (GtkTreeModelTypesClass, inserted),
NULL,
NULL, NULL,
gtk_marshal_VOID__BOXED_BOXED,
G_TYPE_NONE, 2,
G_TYPE_POINTER,
......@@ -930,7 +929,7 @@ gtk_tree_model_types_class_init (GtkTreeModelTypesClass *class)
GTK_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
GTK_SIGNAL_OFFSET (GtkTreeModelTypesClass, child_toggled),
NULL,
NULL, NULL,
gtk_marshal_VOID__BOXED_BOXED,
G_TYPE_NONE, 2,
G_TYPE_POINTER,
......@@ -940,7 +939,7 @@ gtk_tree_model_types_class_init (GtkTreeModelTypesClass *class)
GTK_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
GTK_SIGNAL_OFFSET (GtkTreeModelTypesClass, deleted),
NULL,
NULL, NULL,
gtk_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
......@@ -1270,469 +1269,6 @@ gtk_real_model_types_iter_parent (GtkTreeModel *tree_model,
}
}
/*
* Property editor thingy
*/
static void
get_param_specs (GObject *object,
GParamSpec ***specs,
gint *n_specs)
{
/* Use private interface for now, fix later */
*specs = G_OBJECT_GET_CLASS (object)->property_specs;
*n_specs = G_OBJECT_GET_CLASS (object)->n_property_specs;
}
typedef struct
{
gpointer instance;
guint id;
} DisconnectData;
static void
disconnect_func (gpointer data)
{
DisconnectData *dd = data;
g_signal_handler_disconnect (dd->instance, dd->id);
g_free (dd);
}
static void
g_object_connect_property (GObject *object,
const gchar *prop_name,
GtkSignalFunc func,
gpointer data,
GObject *alive_object)
{
gchar *with_detail = g_strconcat ("notify::", prop_name, NULL);
DisconnectData *dd;
dd = g_new (DisconnectData, 1);
dd->id = g_signal_connect_data (object, with_detail,
func, data,
NULL, FALSE, FALSE);
dd->instance = object;
g_object_set_data_full (G_OBJECT (alive_object),
"alive-object",
dd,
disconnect_func);
g_free (with_detail);
}
typedef struct
{
GObject *obj;
gchar *prop;
} ObjectProperty;
static void
free_object_property (ObjectProperty *p)
{
g_free (p->prop);
g_free (p);
}
static void
connect_controller (GObject *controller,
const gchar *signal,
GObject *model,
const gchar *prop_name,
GtkSignalFunc func)
{
ObjectProperty *p;
p = g_new (ObjectProperty, 1);
p->obj = model;
p->prop = g_strdup (prop_name);
g_signal_connect_data (controller, signal, func, p,
(GClosureNotify)free_object_property,
FALSE, FALSE);
}
static void
int_modified (GtkAdjustment *adj, gpointer data)
{
ObjectProperty *p = data;
g_object_set (p->obj, p->prop, (int) adj->value, NULL);
}
static void
int_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkAdjustment *adj = GTK_ADJUSTMENT (data);
GValue val = { 0, };
g_value_init (&val, G_TYPE_INT);
g_object_get_property (object, pspec->name, &val);
if (g_value_get_int (&val) != (int)adj->value)
gtk_adjustment_set_value (adj, g_value_get_int (&val));
g_value_unset (&val);
}
static void
float_modified (GtkAdjustment *adj, gpointer data)
{
ObjectProperty *p = data;
g_object_set (p->obj, p->prop, (float) adj->value, NULL);
}
static void
float_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkAdjustment *adj = GTK_ADJUSTMENT (data);
GValue val = { 0, };
g_value_init (&val, G_TYPE_FLOAT);
g_object_get_property (object, pspec->name, &val);
if (g_value_get_float (&val) != (float) adj->value)
gtk_adjustment_set_value (adj, g_value_get_float (&val));
g_value_unset (&val);
}
static void
string_modified (GtkEntry *entry, gpointer data)
{
ObjectProperty *p = data;
gchar *text;
text = gtk_entry_get_text (entry);
g_object_set (p->obj, p->prop, text, NULL);
}
static void
string_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkEntry *entry = GTK_ENTRY (data);
GValue val = { 0, };
gchar *str;
gchar *text;
g_value_init (&val, G_TYPE_STRING);
g_object_get_property (object, pspec->name, &val);
str = g_value_get_string (&val);
if (str == NULL)
str = "";
text = gtk_entry_get_text (entry);
if (strcmp (str, text) != 0)
gtk_entry_set_text (entry, str);
g_value_unset (&val);
}
static void
bool_modified (GtkToggleButton *tb, gpointer data)
{
ObjectProperty *p = data;