[Python-gtkextra-commits] CVS: python-gtkextra2/gtkextra mkfields.py,NONE,1.1 gtkextra-types.defs,1.
Status: Beta
Brought to you by:
treeves
From: <pyt...@li...> - 2003-01-21 17:09:14
|
Update of /cvsroot/python-gtkextra/python-gtkextra2/gtkextra In directory sc8-pr-cvs1:/tmp/cvs-serv16209/gtkextra Modified Files: gtkextra-types.defs gtkextra.override Added Files: mkfields.py Log Message: more fields --- NEW FILE: mkfields.py --- # Quick hack to help populate objects definitions in defs files. # Copy C field definitions to this string. # Then run me. lines = """ """ """ (fields '("gboolean" "is_visible") '("GtkPlotVector" "origin") '("GtkPlotVector" "direction") '("GtkPlotText" "title") """ import string print """ (fields""" for line in lines.split('\n'): line = line.strip() line = line.replace(';', '') if not line: continue t,v = line.split(' ') t = t.strip() v = v.strip() if v[0] == '*': v = v[1:] t += '*' print """ '("%s" "%s")""" % (t,v) print """ )""" Index: gtkextra-types.defs =================================================================== RCS file: /cvsroot/python-gtkextra/python-gtkextra2/gtkextra/gtkextra-types.defs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gtkextra-types.defs 15 Jan 2003 18:57:08 -0000 1.7 --- gtkextra-types.defs 21 Jan 2003 17:09:09 -0000 1.8 *************** *** 168,171 **** --- 168,198 ---- (c-name "GtkPlotAxis") (gtype-id "GTK_TYPE_PLOT_AXIS") + (fields + '("gboolean" "is_visible") + '("GtkPlotVector" "origin") + '("GtkPlotVector" "direction") + '("GtkPlotText" "title") + '("gboolean" "title_visible") + '("GtkPlotTicks" "ticks") + '("GtkPlotOrientation" "orientation") + '("GtkPlotScale" "scale") + '("GtkPlotLine" "line") + '("GtkPlotLine" "major_grid") + '("GtkPlotLine" "minor_grid") + '("gint" "major_mask") + '("gint" "minor_mask") + '("gint" "ticks_length") + '("gfloat" "ticks_width") + '("gboolean" "custom_labels") + '("gint" "labels_offset") + '("gchar*" "labels_prefix") + '("gchar*" "labels_suffix") + '("gboolean" "show_major_grid") + '("gboolean" "show_minor_grid") + '("GtkPlotText" "labels_attr") + '("gint" "label_precision") + '("gint" "label_style") + '("gint" "label_mask") + ) ) *************** *** 317,323 **** --- 344,367 ---- (define-boxed PlotText + ;(define-pointer PlotText (in-module "Gtk") (c-name "GtkPlotText") (gtype-id "GTK_TYPE_PLOT_TEXT") + (fields + '("gdouble" "x") + '("gdouble" "y") + '("gint" "angle") + '("GdkColor" "fg") + '("GdkColor" "bg") + '("gboolean" "transparent") + '("GtkPlotBorderStyle" "border") + '("gint" "border_width") + '("gint" "shadow_width") + '("gint" "border_space") + '("gchar*" "font") + '("gint" "height") + '("gchar*" "text") + '("GtkJustification" "justification") + ) ) Index: gtkextra.override =================================================================== RCS file: /cvsroot/python-gtkextra/python-gtkextra2/gtkextra/gtkextra.override,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** gtkextra.override 15 Jan 2003 20:29:41 -0000 1.14 --- gtkextra.override 21 Jan 2003 17:09:09 -0000 1.15 *************** *** 130,133 **** --- 130,158 ---- } + GtkPlotText* + gtk_plot_text_copy (const GtkPlotText *text) + { + /* FIXME: am I correct? */ + GtkPlotText *copy; + g_return_val_if_fail (text != NULL, NULL); + copy = g_new (GtkPlotText, 1); + *copy = *text; + copy->font = g_strdup(text->font); + copy->text = g_strdup(text->text); + return copy; + } + + void + gtk_plot_text_free (GtkPlotText *text) + { + /* FIXME: am I correct? */ + g_return_if_fail (text != NULL); + if (text->font) + g_free(text->font); + if (text->text) + g_free(text->text); + g_free (text); + } + #define GTK_TYPE_PLOT_TEXT (gtk_plot_text_get_type ()) static GType *************** *** 136,140 **** static GType our_type = 0; ! #if 1 //HACK if (our_type == 0) our_type = g_pointer_type_register_static ("GtkPlotText"); --- 161,165 ---- static GType our_type = 0; ! #if 0 //HACK if (our_type == 0) our_type = g_pointer_type_register_static ("GtkPlotText"); *************** *** 142,147 **** if (our_type == 0) our_type = g_boxed_type_register_static ("GtkPlotText", ! (GBoxedCopyFunc) gtk_plot_text_ref, ! (GBoxedFreeFunc) gtk_plot_text_unref); #endif return our_type; --- 167,172 ---- if (our_type == 0) our_type = g_boxed_type_register_static ("GtkPlotText", ! (GBoxedCopyFunc) gtk_plot_text_copy, ! (GBoxedFreeFunc) gtk_plot_text_free); #endif return our_type; |