[Gtk-sharp-list] Gtk# and gnomeprint

Martin Willemoes Hansen mwh@sysrq.dk
Fri, 26 Sep 2003 14:02:18 +0200


--=-CJwbdOKjmbpnPGa5Ta/f
Content-Type: multipart/alternative; boundary="=-G/kLG4Ku/WX4GfMoeJKo"


--=-G/kLG4Ku/WX4GfMoeJKo
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi!

Im doing some wrapping work on GnomePrint and GnomePrintUi for the Gtk#
project. I have discovered some code which do not play that well with
the Gtk# parser and generator. After doing some modifications to your
library I got it to work somewhat okay. Can this be merged back into
GnomePrint?

In gnome-print-config.[ch] I changed function signature:
guchar * gnome_print_config_get (GnomePrintConfig *config, const guchar
*key)
to
const guchar * gnome_print_config_get (GnomePrintConfig *config, const
guchar *key) 

This change helps the generator to use string instead of byte as the
return value in C# and I guess it can make it clear that the returned
value should not be free'd by the user of the function.

In gnome-print-dialog.h and gnome-print-paper-selector.h I changed some
enums from the form:
enum Foobar { ... } to
typedef enum { ... } Foobar;

This change makes the generator eat them, else it just skips them. Also
it makes it clear that gnome_print_dialog_new takes a
GnomePrintDialogFlag as a parameter.

Hope this stuff makes any sense and is usefull to you guys.

Im not on the gnome-print list so please reply to me directly.

-- 
Martin Willemoes Hansen

--------------------------------------------------------
E-Mail	mwh@sysrq.dk	Website	mwh.sysrq.dk
IRC     MWH, freenode.net
--------------------------------------------------------               


--=-G/kLG4Ku/WX4GfMoeJKo
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.0.9">
</HEAD>
<BODY>
Hi!<BR>
<BR>
Im doing some wrapping work on GnomePrint and GnomePrintUi for the Gtk# project. I have discovered some code which do not play that well with the Gtk# parser and generator. After doing some modifications to your library I got it to work somewhat okay. Can this be merged back into GnomePrint?<BR>
<BR>
In gnome-print-config.[ch] I changed function signature:<BR>
guchar * gnome_print_config_get (GnomePrintConfig *config, const guchar *key)<BR>
to<BR>
const guchar * gnome_print_config_get (GnomePrintConfig *config, const guchar *key) <BR>
<BR>
This change helps the generator to use string instead of byte as the return value in C# and I guess it can make it clear that the returned value should not be free'd by the user of the function.<BR>
<BR>
In gnome-print-dialog.h and gnome-print-paper-selector.h I changed some enums from the form:<BR>
enum Foobar { ... } to<BR>
typedef enum { ... } Foobar;<BR>
<BR>
This change makes the generator eat them, else it just skips them. Also it makes it clear that gnome_print_dialog_new takes a GnomePrintDialogFlag as a parameter.<BR>
<BR>
Hope this stuff makes any sense and is usefull to you guys.<BR>
<BR>
Im not on the gnome-print list so please reply to me directly.<BR>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>-- 
Martin Willemoes Hansen

--------------------------------------------------------
E-Mail	mwh@sysrq.dk	Website	mwh.sysrq.dk
IRC     MWH, freenode.net
--------------------------------------------------------               
</PRE>
</TD>
</TR>
</TABLE>

</BODY>
</HTML>

--=-G/kLG4Ku/WX4GfMoeJKo--

--=-CJwbdOKjmbpnPGa5Ta/f
Content-Disposition: attachment; filename=gnome-print-config.c.diff
Content-Type: text/x-patch; name=gnome-print-config.c.diff; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

--- gnome-print-config.c.old	2003-01-27 00:47:41.000000000 +0100
+++ gnome-print-config.c	2003-09-26 12:08:12.000000000 +0200
@@ -155,7 +155,7 @@
 	return config;
 }
 
-guchar *
+const guchar *
 gnome_print_config_get (GnomePrintConfig *config, const guchar *key)
 {
 	guchar *val;

--=-CJwbdOKjmbpnPGa5Ta/f
Content-Disposition: attachment; filename=gnome-print-config.h.diff
Content-Type: text/x-patch; name=gnome-print-config.h.diff; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

--- gnome-print-config.h.old	2003-01-27 00:47:41.000000000 +0100
+++ gnome-print-config.h	2003-09-26 12:08:42.000000000 +0200
@@ -154,7 +154,7 @@
  * gnome_print_config_get just returns NULL, if given key does not exist.
  *
  */
-guchar  *gnome_print_config_get         (GnomePrintConfig *config, const guchar *key);
+const guchar  *gnome_print_config_get         (GnomePrintConfig *config, const guchar *key);
 gboolean gnome_print_config_set         (GnomePrintConfig *config, const guchar *key, const guchar *value);
 
 gboolean gnome_print_config_get_boolean (GnomePrintConfig *config, const guchar *key, gboolean *val);

--=-CJwbdOKjmbpnPGa5Ta/f
Content-Disposition: attachment; filename=gnome-print-dialog.h.diff
Content-Type: text/x-patch; name=gnome-print-dialog.h.diff; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

--- gnome-print-dialog.h.old	2003-09-25 13:05:07.000000000 +0200
+++ gnome-print-dialog.h	2003-09-26 11:45:48.000000000 +0200
@@ -60,35 +60,35 @@
 /*
  * Flags for creation of range widget
  */
-enum GnomePrintDialogRangeFlags {
+typedef enum {
 	GNOME_PRINT_RANGE_CURRENT = (1 << 0),
 	GNOME_PRINT_RANGE_ALL = (1 << 1),
 	GNOME_PRINT_RANGE_RANGE = (1 << 2),
 	GNOME_PRINT_RANGE_SELECTION = (1 << 3),
 	GNOME_PRINT_RANGE_SELECTION_UNSENSITIVE  = (1 << 4),
-};
+} GnomePrintDialogRangeFlags;
 
 /*
  * Flags to specify, whether we want range and copies widgets
  */
-enum GnomePrintDialogFlags {
+typedef enum {
+	GNOME_PRINT_DIALOG_NONE = 0,
 	GNOME_PRINT_DIALOG_RANGE = (1 << 0),
 	GNOME_PRINT_DIALOG_COPIES = (1 << 1)
-};
+} GnomePrintDialogFlags;
 
 /*
  * The button numbers corresponding to the standard buttons
  * Used with the GnomeDialog "clicked" signal.
  */
-enum GnomePrintButtons {
+typedef enum {
 	GNOME_PRINT_DIALOG_RESPONSE_PRINT = 1,
 	GNOME_PRINT_DIALOG_RESPONSE_PREVIEW,
-	GNOME_PRINT_DIALOG_RESPONSE_CANCEL = GTK_RESPONSE_CANCEL,
-};
+} GnomePrintDialogResponseType;
 
 GType gnome_print_dialog_get_type (void);
 
-GtkWidget * gnome_print_dialog_new (GnomePrintJob *gpj, const guchar *title, gint flags);
+GtkWidget * gnome_print_dialog_new (GnomePrintJob *gpj, const guchar *title, GnomePrintDialogFlags flags);
 
 /* For language bindings */
 void gnome_print_dialog_construct (GnomePrintDialog *gpd, const guchar *title, gint flags);

--=-CJwbdOKjmbpnPGa5Ta/f
Content-Disposition: attachment; filename=gnome-print-paper-selector.h.diff
Content-Type: text/x-patch; name=gnome-print-paper-selector.h.diff; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

--- gnome-print-paper-selector.h.old	2003-01-11 17:46:47.000000000 +0100
+++ gnome-print-paper-selector.h	2003-09-25 13:10:12.000000000 +0200
@@ -44,10 +44,10 @@
 #include <glib-object.h>
 #include <libgnomeprint/gnome-print-config.h>
 
-enum GnomePaperSelectorFlags {
+typedef enum {
 	GNOME_PAPER_SELECTOR_MARGINS = (1 << 0),
 	GNOME_PAPER_SELECTOR_FEED_ORIENTATION = (1 << 1)
-};
+} GnomePaperSelectorFlags;
 
 GType       gnome_paper_selector_get_type (void);
 GtkWidget * gnome_paper_selector_new (GnomePrintConfig *config);

--=-CJwbdOKjmbpnPGa5Ta/f--