2007-04-24 Aaron Bockover <abockover@novell.com>

* gtk/Widget.custom (StyleGetProperty): return null if
    gtksharp_widget_style_get_property returns FALSE (property
    doesn't exist) [Fixes #81445]

    * gtk/glue/widget.c (gtksharp_widget_style_get_property): check
    return of gtk_widget_class_find_style_property for NULL; function now
    returns TRUE if spec is not NULL, FALSE otherwise



svn path=/trunk/gtk-sharp/; revision=76217
This commit is contained in:
Aaron Bockover 2007-04-24 19:40:27 +00:00
parent d802b53549
commit f89698d3b3
3 changed files with 25 additions and 9 deletions

View file

@ -1,3 +1,13 @@
2007-04-24 Aaron Bockover <abockover@novell.com>
* gtk/Widget.custom (StyleGetProperty): return null if
gtksharp_widget_style_get_property returns FALSE (property
doesn't exist) [Fixes #81445]
* gtk/glue/widget.c (gtksharp_widget_style_get_property): check
return of gtk_widget_class_find_style_property for NULL; function now
returns TRUE if spec is not NULL, FALSE otherwise
2007-04-23 Brad Taylor <brad@getcoded.net>
* gtk/TreePath.custom: Override Equals and compare based upon the

View file

@ -317,18 +317,21 @@ static void ClassInit (GLib.GType gtype, Type t)
}
[DllImport("gtksharpglue-2")]
static extern void gtksharp_widget_style_get_property (IntPtr widget, IntPtr property, ref GLib.Value value);
static extern bool gtksharp_widget_style_get_property (IntPtr widget, IntPtr property, ref GLib.Value value);
public object StyleGetProperty (string property_name) {
GLib.Value value = new GLib.Value ();
object ret;
IntPtr name = GLib.Marshaller.StringToPtrGStrdup (property_name);
gtksharp_widget_style_get_property (Handle, name, ref value);
bool success = gtksharp_widget_style_get_property (Handle, name, ref value);
GLib.Marshaller.Free (name);
ret = value.Val;
value.Dispose ();
return ret;
if(success) {
object ret = value.Val;
value.Dispose ();
return ret;
}
return null;
}
internal GLib.Value StyleGetPropertyValue (string property_name) {

View file

@ -40,7 +40,7 @@ void gtksharp_gtk_widget_set_flags (GtkWidget *widget, int flags);
int gtksharp_gtk_widget_style_get_int (GtkWidget *widget, const char *name);
void gtksharp_widget_add_binding_signal (GType gtype, const char *sig_name, GCallback cb);
void gtksharp_widget_register_binding (GType gtype, const char *sig_name, guint key, int mod, gpointer data);
void gtksharp_widget_style_get_property (GtkWidget *widget, const gchar* property, GValue *value);
gboolean gtksharp_widget_style_get_property (GtkWidget *widget, const gchar* property, GValue *value);
/* */
GdkRectangle*
@ -171,11 +171,14 @@ gtksharp_widget_register_binding (GType gtype, const gchar *signame, guint key,
gtk_binding_entry_add_signal (set, key, mod, signame, 1, G_TYPE_LONG, data);
}
void
gboolean
gtksharp_widget_style_get_property (GtkWidget *widget, const gchar* property, GValue *value)
{
GParamSpec *spec = gtk_widget_class_find_style_property (GTK_WIDGET_GET_CLASS (widget), property);
if (spec == NULL)
return FALSE;
g_value_init (value, spec->value_type);
gtk_widget_style_get_property (widget, property, value);
return TRUE;
}