[Xfce4-commits] r26804 - in xfconf/trunk: docs/reference docs/reference/tmpl xfconf-gtk
Brian Tarricone
kelnos at xfce.org
Wed Apr 9 08:02:42 CEST 2008
Author: kelnos
Date: 2008-04-09 06:02:42 +0000 (Wed, 09 Apr 2008)
New Revision: 26804
Modified:
xfconf/trunk/docs/reference/tmpl/xfconf-gtk.sgml
xfconf/trunk/docs/reference/tmpl/xfconf-unused.sgml
xfconf/trunk/docs/reference/xfconf-sections.txt
xfconf/trunk/xfconf-gtk/xfconf-gtk.c
xfconf/trunk/xfconf-gtk/xfconf-gtk.h
Log:
rename xfconf_gtk_widget_bind_property() s/widget/editable, fix some bugs
different widget types are going to have to be handled differently, with
different parameters. check buttons will always be boolean types, radio
buttons will need to have some sort of identifier associated with them, etc.
Modified: xfconf/trunk/docs/reference/tmpl/xfconf-gtk.sgml
===================================================================
--- xfconf/trunk/docs/reference/tmpl/xfconf-gtk.sgml 2008-04-09 05:30:06 UTC (rev 26803)
+++ xfconf/trunk/docs/reference/tmpl/xfconf-gtk.sgml 2008-04-09 06:02:42 UTC (rev 26804)
@@ -26,12 +26,12 @@
<!-- ##### SECTION Stability_Level ##### -->
-<!-- ##### FUNCTION xfconf_gtk_widget_bind_property ##### -->
+<!-- ##### FUNCTION xfconf_gtk_editable_bind_property ##### -->
<para>
</para>
- at widget:
+ at editable:
@channel:
@property:
@property_type:
Modified: xfconf/trunk/docs/reference/tmpl/xfconf-unused.sgml
===================================================================
--- xfconf/trunk/docs/reference/tmpl/xfconf-unused.sgml 2008-04-09 05:30:06 UTC (rev 26803)
+++ xfconf/trunk/docs/reference/tmpl/xfconf-unused.sgml 2008-04-09 06:02:42 UTC (rev 26804)
@@ -103,3 +103,13 @@
@value:
@Returns:
+<!-- ##### FUNCTION xfconf_gtk_widget_bind_property ##### -->
+<para>
+
+</para>
+
+ at widget:
+ at channel:
+ at property:
+ at property_type:
+
Modified: xfconf/trunk/docs/reference/xfconf-sections.txt
===================================================================
--- xfconf/trunk/docs/reference/xfconf-sections.txt 2008-04-09 05:30:06 UTC (rev 26803)
+++ xfconf/trunk/docs/reference/xfconf-sections.txt 2008-04-09 06:02:42 UTC (rev 26804)
@@ -86,6 +86,6 @@
<SECTION>
<FILE>xfconf-gtk</FILE>
-xfconf_gtk_widget_bind_property
+xfconf_gtk_editable_bind_property
xfconf_gtk_widget_unbind
</SECTION>
Modified: xfconf/trunk/xfconf-gtk/xfconf-gtk.c
===================================================================
--- xfconf/trunk/xfconf-gtk/xfconf-gtk.c 2008-04-09 05:30:06 UTC (rev 26803)
+++ xfconf/trunk/xfconf-gtk/xfconf-gtk.c 2008-04-09 06:02:42 UTC (rev 26804)
@@ -155,6 +155,9 @@
gchar *cur_val, *new_val;
gint strpos = 0;
+ if(strcmp(property, binding->property))
+ return;
+
if(!xfconf_channel_get_property(channel, property, &val))
return;
@@ -199,53 +202,48 @@
/**
- * xfconf_gtk_widget_bind_property:
- * @widget: A #GtkWidget.
+ * xfconf_gtk_editable_bind_property:
+ * @editable: A widget implementing #GtkEditable.
* @channel: An #XfconfChannel.
* @property: A string property name.
* @property_type: The #GType of @property.
*
- * Binds @widget to @property on @channel such that @widget will
+ * Binds @editable to @property on @channel such that @editable will
* always display the value of @property, even if that value changes
* via any other means. If @widget is editable, the binding will also
* cause @property to be updated in the Xfconf configuration store.
*
- * Note that not all types of #GtkWidget are supported. Specifically,
- * the following widgets are supported:
- * FIXME: list widgets
+ * Note: #GtkEntry and #GtkSpinButton (and perhaps others) both
+ * implement the #GtkEditable interface and can be used with
+ * this function.
**/
void
-xfconf_gtk_widget_bind_property(GtkWidget *widget,
- XfconfChannel *channel,
- const gchar *property,
- GType property_type)
+xfconf_gtk_editable_bind_property(GtkEditable *editable,
+ XfconfChannel *channel,
+ const gchar *property,
+ GType property_type)
{
XfconfGtkBinding *binding;
+ GtkWidget *widget;
- g_return_if_fail(GTK_IS_WIDGET(widget) && XFCONF_IS_CHANNEL(channel)
+ g_return_if_fail(GTK_IS_EDITABLE(editable) && XFCONF_IS_CHANNEL(channel)
&& property && *property);
- if(GTK_IS_EDITABLE(widget)) {
- binding = g_new0(XfconfGtkBinding, 1);
+ widget = GTK_WIDGET(editable);
- binding->widget = widget;
- binding->channel = channel;
- binding->property = g_strdup(property);
- binding->property_type = property_type;
- binding->xfconf_callback = G_CALLBACK(xfconf_gtk_editable_binding);
- binding->gtk_callback = G_CALLBACK(xfconf_gtk_editable_changed);
+ binding = g_new0(XfconfGtkBinding, 1);
+ binding->widget = widget;
+ binding->channel = channel;
+ binding->property = g_strdup(property);
+ binding->property_type = property_type;
+ binding->xfconf_callback = G_CALLBACK(xfconf_gtk_editable_binding);
+ binding->gtk_callback = G_CALLBACK(xfconf_gtk_editable_changed);
- /* set initial entry value */
- xfconf_gtk_editable_binding(channel, property, binding);
+ /* set initial entry value */
+ xfconf_gtk_editable_binding(channel, property, binding);
- g_signal_connect(G_OBJECT(widget), "changed",
- binding->gtk_callback, binding);
- } else {
- g_warning("GtkWidget type %s cannot be bound to an xfconf property",
- G_OBJECT_TYPE_NAME(widget));
- return;
- }
-
+ g_signal_connect(G_OBJECT(widget), "changed",
+ binding->gtk_callback, binding);
g_signal_connect(G_OBJECT(channel), "property-changed",
binding->xfconf_callback, binding);
Modified: xfconf/trunk/xfconf-gtk/xfconf-gtk.h
===================================================================
--- xfconf/trunk/xfconf-gtk/xfconf-gtk.h 2008-04-09 05:30:06 UTC (rev 26803)
+++ xfconf/trunk/xfconf-gtk/xfconf-gtk.h 2008-04-09 06:02:42 UTC (rev 26804)
@@ -25,10 +25,10 @@
G_BEGIN_DECLS
-void xfconf_gtk_widget_bind_property(GtkWidget *widget,
- XfconfChannel *channel,
- const gchar *property,
- GType property_type);
+void xfconf_gtk_editable_bind_property(GtkEditable *editable,
+ XfconfChannel *channel,
+ const gchar *property,
+ GType property_type);
void xfconf_gtk_widget_unbind(GtkWidget *widget);
More information about the Xfce4-commits
mailing list