[Gtk-sharp-list] patch for gnome binding
Martin Willemoes Hansen
mwh@sysrq.dk
Mon, 12 Jul 2004 17:55:56 +0200
--=-NhTEZ/l+tbPqKHrVZlPy
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
man, 2004-07-12 kl. 16:48 skrev Mike Kestner:
> On Mon, 2004-07-12 at 09:37, Mike Kestner wrote:
> > On Mon, 2004-07-12 at 08:43, Martin Willemoes Hansen wrote:
> >
> > > Okay, here is a quick try to implement the suggestions you mentioned,
> > > what do you think?
> >
> > You didn't add the glue file to the Makefile.am, so it's not getting
> > built. If it had been compiled, you would've seen that the glue isn't
> > right. ;-)
> >
> > Your set_print_config method needs to take two parameters, a PrintJob
> > and a PrintConfig, and it should set job->config, and from looking at a
> > little C code, it should probably take a ref on the config.
> >
> > In your Config property in the .custom, you don't need to do the
> > IntPtr.Zero check, because GetObject (IntPtr.Zero) returns null.
>
> Another point...
>
> I'm not convinced it's a good idea to expose set_Config publicly. I
> would just invoke the glue method from the ctor instead and leave the
> property read only.
Ok, here is yet another updated patch ;)
--
Martin Willemoes Hansen
--=-NhTEZ/l+tbPqKHrVZlPy
Content-Disposition: attachment; filename=gnome.diff
Content-Type: text/x-patch; name=gnome.diff; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Index: ChangeLog
===================================================================
RCS file: /cvs/public/gtk-sharp/ChangeLog,v
retrieving revision 1.877
diff -u -r1.877 ChangeLog
--- ChangeLog 9 Jul 2004 15:28:51 -0000 1.877
+++ ChangeLog 12 Jul 2004 14:57:20 -0000
@@ -1,3 +1,12 @@
+2004-07-12 Martin Willemoes Hansen <mwh@sysrq.dk>
+
+ * gnome/Gnome.metadata: Fixed typo i to 1
+ Remove unnessesary disabledefaultconstructor
+ * gnome/PrintJob.custom: Removed ctor which was not inheritable
+ Added new inheritable ctor
+ * gnome/glue/printjob.c: Added glue code to set private PrintJob->config
+
+
2004-07-09 Mike Kestner <mkestner@ximian.com>
* gdk/Gdk.metadata : mark gc param of Drawable.DrawPixbuf null_ok.
Index: gnome/Gnome.metadata
===================================================================
RCS file: /cvs/public/gtk-sharp/gnome/Gnome.metadata,v
retrieving revision 1.16
diff -u -r1.16 Gnome.metadata
--- gnome/Gnome.metadata 19 Jun 2004 14:46:11 -0000 1.16
+++ gnome/Gnome.metadata 12 Jul 2004 14:57:20 -0000
@@ -88,7 +88,7 @@
<attr path="/api/namespace/object[@cname='GnomeIconEntry']/method[@name='PickDialog']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GnomeIconList']/method[@cname='gnome_icon_list_construct']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GnomeIconList']/constructor[@cname='gnome_icon_list_new']" name="hidden">1</attr>
- <attr path="/api/namespace/object[@cname='GnomeIconList']/method[@name='GetSelection']" name="hidden">i</attr>
+ <attr path="/api/namespace/object[@cname='GnomeIconList']/method[@name='GetSelection']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GnomeIconList']/method[@name='SetHadjustment']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GnomeIconList']/method[@name='SetVadjustment']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GnomeIconList']/signal[@name='FocusIcon']" name="name">IconFocused</attr>
@@ -101,7 +101,6 @@
<attr path="/api/namespace/object[@cname='GnomePrintDialog']/method/*/*[@type='const-guchar*']" name="type">const-gchar*</attr>
<attr path="/api/namespace/object[@cname='GnomePrintDialog']/constructor[@cname='gnome_print_dialog_new']/*/*[@type='const-guchar*']" name="type">const-gchar*</attr>
<attr path="/api/namespace/object[@cname='GnomePrintDialog']/constructor[@cname='gnome_print_dialog_new']/*/*[@name='flags']" name="type">GnomePrintDialogFlags</attr>
- <attr path="/api/namespace/object[@cname='GnomePrintJob']" name="disabledefaultconstructor">1</attr>
<attr path="/api/namespace/object[@cname='GnomePrintJobPreview']/constructor/*/*[@type='const-guchar*']" name="type">const-gchar*</attr>
<attr path="/api/namespace/object[@cname='GnomePrintMeta']/method/*/*[@name='filename']" name="type">const-gchar*</attr>
<attr path="/api/namespace/object[@cname='GnomePrintPdf']" name="parent">GObject</attr>
Index: gnome/PrintJob.custom
===================================================================
RCS file: /cvs/public/gtk-sharp/gnome/PrintJob.custom,v
retrieving revision 1.3
diff -u -r1.3 PrintJob.custom
--- gnome/PrintJob.custom 25 Jun 2004 18:42:18 -0000 1.3
+++ gnome/PrintJob.custom 12 Jul 2004 14:57:20 -0000
@@ -3,7 +3,7 @@
//
// Author: Martin Willemoes Hansen <mwh@sysrq.dk>
//
-// Copyright (C) 2003 Martin Willemoes Hansen
+// Copyright (C) 2003 2004 Martin Willemoes Hansen
//
// This code is inserted after the automatically generated code.
//
@@ -22,8 +22,18 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
-
+[DllImport("gnomesharpglue")]
+extern static void gnome_print_job_set_print_config (IntPtr job, IntPtr config);
+
public PrintJob() : base (IntPtr.Zero)
{
+ if (GetType () != typeof (PrintJob)) {
+ CreateNativeObject (new string [0], new GLib.Value [0]);
+ gnome_print_job_set_print_config (Handle, PrintConfig.Default().Handle);
+ return;
+ }
+
Raw = gnome_print_job_new (PrintConfig.Default().Handle);
}
+
+
Index: gnome/glue/Makefile.am
===================================================================
RCS file: /cvs/public/gtk-sharp/gnome/glue/Makefile.am,v
retrieving revision 1.4
diff -u -r1.4 Makefile.am
--- gnome/glue/Makefile.am 11 Jun 2004 18:19:40 -0000 1.4
+++ gnome/glue/Makefile.am 12 Jul 2004 14:57:20 -0000
@@ -16,8 +16,8 @@
canvas-proxy.h \
canvas-proxy-marshal.c \
canvas-proxy-marshal.h \
- program.c \
- #
+ printjob.c \
+ program.c
libgnomesharpglue_la_LIBADD = $(GNOME_LIBS)
Index: gnome/glue/printjob.c
===================================================================
RCS file: gnome/glue/printjob.c
diff -N gnome/glue/printjob.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnome/glue/printjob.c 12 Jul 2004 14:57:20 -0000
@@ -0,0 +1,31 @@
+/* printjob.c : Glue for accessing fields in a GnomePrintJob
+ *
+ * Author: Martin Willemoes Hansen (mwh@sysrq.dk)
+ *
+ * Copyright (C) 2004 Martin Willemoes Hansen
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the Lesser GNU General
+ * Public License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <libgnomeprint/gnome-print-job.h>
+
+void gnomesharp_print_job_set_print_config (GnomePrintJob * job, GnomePrintConfig * config);
+
+void
+gnomesharp_print_job_set_print_config (GnomePrintJob * job,
+ GnomePrintConfig * config)
+{
+ g_object_set (job, "config", config, NULL);
+}
--=-NhTEZ/l+tbPqKHrVZlPy--