[Gtk-sharp-list] TextTag.Weight property fix

Radek Doulik rodo@matfyz.cz
Fri, 12 Dec 2003 17:39:19 +0100


--=-vOhyn33L7NW8xSPDq+m9
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

attached patch fixes TextTag.Weight property, the custom file is needed
as well

cheers
Radek


--=-vOhyn33L7NW8xSPDq+m9
Content-Disposition: attachment; filename=text-tag-weight.fix
Content-Type: text/x-patch; name=text-tag-weight.fix; charset=ISO-8859-2
Content-Transfer-Encoding: 7bit

Index: ChangeLog
===================================================================
RCS file: /cvs/public/gtk-sharp/ChangeLog,v
retrieving revision 1.585
diff -u -p -r1.585 ChangeLog
--- ChangeLog	10 Dec 2003 22:56:49 -0000	1.585
+++ ChangeLog	12 Dec 2003 16:21:41 -0000
@@ -1,3 +1,14 @@
+2003-12-12  Radek Doulik  <rodo@ximian.com>
+
+	* gtk/Gtk.metadata: hide TextTag.Weight property and implement it
+	in TextTag.custom. TextTag Weight property in gtk is of type int,
+	but we want it to be Pango.Weight enum
+
+2003-12-10  Radek Doulik  <rodo@ximian.com>
+
+	* glue/program.c (get_default): moved check after strspec is set
+	so we don't check uninitialized value
+
 2003-12-10  Mike Kestner  <mkestner@ximian.com>
 
 	* generator/CallbackGen.cs : kill ref_owned generation
Index: glue/program.c
===================================================================
RCS file: /cvs/public/gtk-sharp/glue/program.c,v
retrieving revision 1.4
diff -u -p -r1.4 program.c
--- glue/program.c	22 Mar 2003 17:37:43 -0000	1.4
+++ glue/program.c	12 Dec 2003 16:21:43 -0000
@@ -24,9 +24,9 @@ get_default (GObjectClass *klass, const 
 	gchar *ret;
 
 	g_return_val_if_fail (spec != NULL, NULL);
+	strspec = G_PARAM_SPEC_STRING (spec);
 	g_return_val_if_fail (strspec != NULL, NULL);
 	
-	strspec = G_PARAM_SPEC_STRING (spec);
 	ret = g_strdup (strspec->default_value);
 	//g_param_spec_unref (spec);
 	
Index: gtk/Gtk.metadata
===================================================================
RCS file: /cvs/public/gtk-sharp/gtk/Gtk.metadata,v
retrieving revision 1.15
diff -u -p -r1.15 Gtk.metadata
--- gtk/Gtk.metadata	3 Dec 2003 23:08:14 -0000	1.15
+++ gtk/Gtk.metadata	12 Dec 2003 16:21:43 -0000
@@ -178,7 +178,7 @@
   <attr path="/api/namespace/object[@cname='GtkTextLayout']/method[@name='GetIterAtLine']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
   <attr path="/api/namespace/object[@cname='GtkText']/signal[@name='SetScrollAdjustments']" name="name">ScrollAdjustmentsSet</attr>
   <attr path="/api/namespace/object[@cname='GtkTextTag']/method[@name='Event']" name="name">ProcessEvent</attr>
-  <attr path="/api/namespace/object[@cname='GtkTextTag']/property[@name='Weight']" name="type">PangoWeight</attr>
+  <attr path="/api/namespace/object[@cname='GtkTextTag']/property[@name='Weight']" name="hidden">1</attr>
   <attr path="/api/namespace/object[@cname='GtkTextTag']/signal[@name='Event']" name="name">TextEvent</attr>
   <attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetIterAtLocation']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
   <attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetLineAtY']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
Index: gtk/gtk-api.xml
===================================================================
RCS file: /cvs/public/gtk-sharp/gtk/gtk-api.xml,v
retrieving revision 1.23
diff -u -p -r1.23 gtk-api.xml
--- gtk/gtk-api.xml	3 Dec 2003 23:08:14 -0000	1.23
+++ gtk/gtk-api.xml	12 Dec 2003 16:21:49 -0000
@@ -7292,7 +7292,7 @@
       <property name="Family" cname="family" type="gchar*" readable="true" writeable="true" />
       <property name="Style" cname="style" type="PangoStyle" readable="true" writeable="true" />
       <property name="Variant" cname="variant" type="PangoVariant" readable="true" writeable="true" />
-      <property name="Weight" cname="weight" readable="true" writeable="true" type="PangoWeight" />
+      <property name="Weight" cname="weight" readable="true" writeable="true" type="PangoWeight" hidden="1" />
       <property name="Stretch" cname="stretch" type="PangoStretch" readable="true" writeable="true" />
       <property name="Size" cname="size" type="gint" readable="true" writeable="true" />
       <property name="Scale" cname="scale" type="gdouble" readable="true" writeable="true" />
Index: sample/GtkDemo/DemoTextView.cs
===================================================================
RCS file: /cvs/public/gtk-sharp/sample/GtkDemo/DemoTextView.cs,v
retrieving revision 1.3
diff -u -p -r1.3 DemoTextView.cs
--- sample/GtkDemo/DemoTextView.cs	20 Nov 2003 01:07:35 -0000	1.3
+++ sample/GtkDemo/DemoTextView.cs	12 Dec 2003 16:21:49 -0000
@@ -132,7 +132,7 @@ namespace GtkDemo
 		 */
 
 			TextTag tag  = new TextTag("heading");
-			tag.FontDesc.Weight = Pango.Weight.Bold;
+			tag.Weight = Pango.Weight.Bold;
 			tag.Size = (int) Pango.Scale.PangoScale * 15;
 			buffer.TagTable.Add(tag);
 
@@ -141,7 +141,7 @@ namespace GtkDemo
 			buffer.TagTable.Add(tag);
 
 			tag  = new TextTag("bold");
-			tag.FontDesc.Weight = Pango.Weight.Bold;
+			tag.Weight = Pango.Weight.Bold;
 			buffer.TagTable.Add(tag);
 
 			tag  = new TextTag("big");

--=-vOhyn33L7NW8xSPDq+m9
Content-Disposition: attachment; filename=TextTag.custom
Content-Type: text/plain; name=TextTag.custom; charset=ISO-8859-2
Content-Transfer-Encoding: 7bit

		//
		// Gtk.TextTag.custom - Gtk TextTag class customizations
		//
		// Author: Radek Doulik  (rodo@ximian.com)
		//
		// Copyright (C) 2002 Ximian, Inc. 
		//
		// This code is inserted after the automatically generated code.
		//
		
		public Pango.Weight Weight {
			get {
				GLib.Value val = new GLib.Value ();
				GetProperty ("weight", val);
				Pango.Weight ret = (Pango.Weight) (int) val;
				return ret;
			}
			set {
				SetProperty ("weight", new GLib.Value ((int) value));
			}
		}
--=-vOhyn33L7NW8xSPDq+m9--