Author: abock
Date: 2007-04-24 15:40:27 -0400 (Tue, 24 Apr 2007)
New Revision: 76217

Modified:
   trunk/gtk-sharp/ChangeLog
   trunk/gtk-sharp/gtk/Widget.custom
   trunk/gtk-sharp/gtk/glue/widget.c
Log:
2007-04-24  Aaron Bockover  <[EMAIL PROTECTED]>

    * 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




Modified: trunk/gtk-sharp/ChangeLog
===================================================================
--- trunk/gtk-sharp/ChangeLog   2007-04-24 19:30:07 UTC (rev 76216)
+++ trunk/gtk-sharp/ChangeLog   2007-04-24 19:40:27 UTC (rev 76217)
@@ -1,3 +1,13 @@
+2007-04-24  Aaron Bockover  <[EMAIL PROTECTED]>
+
+       * 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  <[EMAIL PROTECTED]>
        
        * gtk/TreePath.custom: Override Equals and compare based upon the

Modified: trunk/gtk-sharp/gtk/Widget.custom
===================================================================
--- trunk/gtk-sharp/gtk/Widget.custom   2007-04-24 19:30:07 UTC (rev 76216)
+++ trunk/gtk-sharp/gtk/Widget.custom   2007-04-24 19:40:27 UTC (rev 76217)
@@ -317,18 +317,21 @@
 }
 
 [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) {

Modified: trunk/gtk-sharp/gtk/glue/widget.c
===================================================================
--- trunk/gtk-sharp/gtk/glue/widget.c   2007-04-24 19:30:07 UTC (rev 76216)
+++ trunk/gtk-sharp/gtk/glue/widget.c   2007-04-24 19:40:27 UTC (rev 76217)
@@ -40,7 +40,7 @@
 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 @@
        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;
 }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to