check if g_module_supported is TRUE in here, if it isn't there is no point

2001-07-09  Chema Celorio  <chema@celorio.com>

	* src/main.c (glade_init): check if g_module_supported is TRUE
	in here, if it isn't there is no point in running glade2

	* src/glade.h (GLADE_TAG_SET_FUNCTION): add the new tags beeing
	used in the .xml files

	* src/glade-xml-utils.c (glade_xml_get_boolean): accept
	"TRUE" and "FALSE" as valid (before only "True" & "False")

	* src/glade-widget.c (glade_widget_button_press): return FLASE
	so that the emision continues (fixes clicking over items)
	(glade_widget_button_release): ditto

	* src/glade-widget-class.h: add the spec function prototypes

	* src/glade-widget-class.c (glade_widget_class_get_specs): move
	here from glade_propery_class.
	(glade_widget_class_find_spec): ditto
	(glade_widget_class_dump_param_specs): implement

	* src/glade-property.h: add the headers for the _double functions

	* src/glade-property.c (glade_property_new_from_string): handle
	double type
	(glade_property_changed_double): implement
	(glade_property_get_double): impl.

	* src/glade-property-class.h: add _TYPE_DOUBLE and _TYPE_OBJECT
	remove class->gtk_arg add class->id. Fixed the code all over
	to use ->id and ->name correctly.
	- add children for child objects and set_function to set properties
	that gtk is not exposing

	* src/glade-property-class.c: add frames for handling _TYPE_OBJECT
	no content tho
	(glade_property_get_parameter_numeric_default):
	(glade_property_get_parameter_numeric_min):
	(glade_property_get_parameter_numeric_max): impl.
	(glade_property_get_parameters_numeric): clean
	(glade_property_class_get_set_function): implement but not use yet
	cause I could not get it to work. Use glade_gtk_get_set_function_hack
	for now.
	(glade_property_class_new_from_node): change to reflect new changes
	in .xml format

	* src/glade-project-window.c (glade_project_window_query_properties):
	use ->id and not ->name

	* src/glade-placeholder.c (glade_placeholder_add): s/Size/size
	s/Rows/rows since we use class->id and not class->name

	* src/glade-parameter.c (glade_parameter_adjustment_new): make
	the increment 1 so that integers can be changed if the increment
	is not specified

	* src/glade-palette.c (glade_palette_init): set the policy of the
	pallete (which is a gtkwindow)

	* src/glade-editor.h: add GladeEditorNumericType to share functions
	that interact with numbers

	* src/glade-editor.c (glade_editor_property_changed_numeric): handle
	integers, floats and doubles. rename from _changed_integer
	(glade_editor_create_input): handle double
	(glade_editor_property_load_double): impl.

	* src/Makefile.am: add glade-gtk.[ch]

	* src/glade-property-class.c (glade_property_class_get_set_function):
	implement

	* widgets/gtk*.xml: clean lots of files, changed the format it is now
	a lot better.

	* src/glade-gtk.c (glade_gtk_entry_set_text): implement
	(glade_gtk_get_set_function_hack): implement a temp hack to find
	function pointers at run time, i could not make gmodule work.
This commit is contained in:
Chema Celorio 2001-07-09 07:16:00 +00:00 committed by Jose Maria Celorio
parent 3358ff35f3
commit f25dd18f8f
34 changed files with 811 additions and 379 deletions

8
BUGS
View File

@ -1 +1,7 @@
- Create a window, create a window (2), add a table to window 2 add anything else to the table
- Create a window, create a window (2), add a table to window 2 add anything else to the table
Missing Properties for gtk :
spinbutton:setvalue does not seem to work
gtkentry:text (or contents) not implemented
gtkadjustment not exposing any properties

View File

@ -1,3 +1,88 @@
2001-07-09 Chema Celorio <chema@celorio.com>
* src/main.c (glade_init): check if g_module_supported is TRUE
in here, if it isn't there is no point in running glade2
* src/glade.h (GLADE_TAG_SET_FUNCTION): add the new tags beeing
used in the .xml files
* src/glade-xml-utils.c (glade_xml_get_boolean): accept
"TRUE" and "FALSE" as valid (before only "True" & "False")
* src/glade-widget.c (glade_widget_button_press): return FLASE
so that the emision continues (fixes clicking over items)
(glade_widget_button_release): ditto
* src/glade-widget-class.h: add the spec function prototypes
* src/glade-widget-class.c (glade_widget_class_get_specs): move
here from glade_propery_class.
(glade_widget_class_find_spec): ditto
(glade_widget_class_dump_param_specs): implement
* src/glade-property.h: add the headers for the _double functions
* src/glade-property.c (glade_property_new_from_string): handle
double type
(glade_property_changed_double): implement
(glade_property_get_double): impl.
* src/glade-property-class.h: add _TYPE_DOUBLE and _TYPE_OBJECT
remove class->gtk_arg add class->id. Fixed the code all over
to use ->id and ->name correctly.
- add children for child objects and set_function to set properties
that gtk is not exposing
* src/glade-property-class.c: add frames for handling _TYPE_OBJECT
no content tho
(glade_property_get_parameter_numeric_default):
(glade_property_get_parameter_numeric_min):
(glade_property_get_parameter_numeric_max): impl.
(glade_property_get_parameters_numeric): clean
(glade_property_class_get_set_function): implement but not use yet
cause I could not get it to work. Use glade_gtk_get_set_function_hack
for now.
(glade_property_class_new_from_node): change to reflect new changes
in .xml format
* src/glade-project-window.c (glade_project_window_query_properties):
use ->id and not ->name
* src/glade-placeholder.c (glade_placeholder_add): s/Size/size
s/Rows/rows since we use class->id and not class->name
* src/glade-parameter.c (glade_parameter_adjustment_new): make
the increment 1 so that integers can be changed if the increment
is not specified
* src/glade-palette.c (glade_palette_init): set the policy of the
pallete (which is a gtkwindow)
* src/glade-editor.h: add GladeEditorNumericType to share functions
that interact with numbers
* src/glade-editor.c (glade_editor_property_changed_numeric): handle
integers, floats and doubles. rename from _changed_integer
(glade_editor_create_input): handle double
(glade_editor_property_load_double): impl.
* src/Makefile.am: add glade-gtk.[ch]
* src/glade-property-class.c (glade_property_class_get_set_function):
implement
* widgets/gtk*.xml: clean lots of files, changed the format it is now
a lot better.
* src/glade-gtk.c (glade_gtk_entry_set_text): implement
(glade_gtk_get_set_function_hack): implement a temp hack to find
function pointers at run time, i could not make gmodule work.
2001-07-07 Chema Celorio <chema@celorio.com>
* src/glade-widget.c (glade_widget_button_release): return FALSE so that
the propagation continues.
2001-07-05 Chema Celorio <chema@celorio.com>
* src/glade-property-class.c (glade_property_get_parameters_integer):

View File

@ -38,6 +38,7 @@ glade2_SOURCES = \
glade-catalog.c \
glade-choice.c \
glade-editor.c \
glade-gtk.c \
glade-signal-editor.c
noinst_HEADERS = \
@ -58,5 +59,6 @@ noinst_HEADERS = \
glade-property-class.h \
glade-popup.h \
glade-choice.h \
glade-gtk.h \
glade-catalog.h \
glade-xml-utils.h

View File

@ -293,33 +293,39 @@ glade_editor_property_changed_enabled (GtkWidget *button,
}
static void
glade_editor_property_changed_integer (GtkWidget *spin,
glade_editor_property_changed_numeric (GtkWidget *spin,
GladeEditorProperty *property)
{
gint val;
g_return_if_fail (property != NULL);
GladeEditorNumericType numeric_type;
gdouble double_val;
gfloat float_val;
gint integer_val;
g_return_if_fail (property != NULL);
if (property->loading)
return;
val = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin));
glade_property_changed_integer (property->property, val);
}
numeric_type = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (spin), "NumericType"));
static void
glade_editor_property_changed_float (GtkWidget *spin,
GladeEditorProperty *property)
{
gfloat val;
g_return_if_fail (property != NULL);
if (property->loading)
return;
val = gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (spin));
glade_property_changed_float (property->property, val);
switch (numeric_type) {
case GLADE_EDITOR_INTEGER:
integer_val = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin));
glade_property_changed_integer (property->property, integer_val);
break;
case GLADE_EDITOR_FLOAT:
g_print ("Changed numeric type float\n\n");
float_val = gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (spin));
glade_property_changed_float (property->property, float_val);
break;
case GLADE_EDITOR_DOUBLE:
g_print ("Changed numeric typoe double\n");
double_val = (gdouble) gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (spin));
glade_property_changed_double (property->property, double_val);
break;
default:
g_warning ("Invalid numeric_type %i\n", numeric_type);
}
}
static void
@ -461,7 +467,7 @@ glade_editor_create_input_text (GladeEditorProperty *property)
static GtkWidget *
glade_editor_create_input_numeric (GladeEditorProperty *property,
gboolean is_integer)
GladeEditorNumericType numeric_type)
{
GladePropertyClass *class;
GtkAdjustment *adjustment;
@ -472,18 +478,19 @@ glade_editor_create_input_numeric (GladeEditorProperty *property,
class = property->glade_property_class;
adjustment = glade_parameter_adjustment_new (class->parameters);
spin = gtk_spin_button_new (adjustment, 10, is_integer ? 0 : 2);
if (is_integer)
gtk_signal_connect (GTK_OBJECT (spin), "changed",
GTK_SIGNAL_FUNC (glade_editor_property_changed_integer),
property);
else
gtk_signal_connect (GTK_OBJECT (spin), "changed",
GTK_SIGNAL_FUNC (glade_editor_property_changed_float),
property);
spin = gtk_spin_button_new (adjustment, 10,
numeric_type == GLADE_EDITOR_INTEGER ? 0 : 2);
gtk_object_set_data (GTK_OBJECT (spin), "NumericType", GINT_TO_POINTER (numeric_type));
gtk_signal_connect (GTK_OBJECT (spin), "changed",
GTK_SIGNAL_FUNC (glade_editor_property_changed_numeric),
property);
/* Some numeric types are optional, for example the default window size, so
* they have a toggle button right next to the spin button.
*/
if (class->optional) {
GtkWidget *check;
GtkWidget *hbox;
@ -504,13 +511,19 @@ glade_editor_create_input_numeric (GladeEditorProperty *property,
static GtkWidget *
glade_editor_create_input_integer (GladeEditorProperty *property)
{
return glade_editor_create_input_numeric (property, TRUE);
return glade_editor_create_input_numeric (property, GLADE_EDITOR_INTEGER);
}
static GtkWidget *
glade_editor_create_input_float (GladeEditorProperty *property)
{
return glade_editor_create_input_numeric (property, FALSE);
return glade_editor_create_input_numeric (property, GLADE_EDITOR_FLOAT);
}
static GtkWidget *
glade_editor_create_input_double (GladeEditorProperty *property)
{
return glade_editor_create_input_numeric (property, GLADE_EDITOR_DOUBLE);
}
static GtkWidget *
@ -531,7 +544,7 @@ glade_editor_create_input_boolean (GladeEditorProperty *property)
return button;
}
GtkWidget *
static GtkWidget *
glade_editor_create_input (GladeEditorProperty *property)
{
GladePropertyType type;
@ -551,6 +564,9 @@ glade_editor_create_input (GladeEditorProperty *property)
case GLADE_PROPERTY_TYPE_INTEGER:
input = glade_editor_create_input_integer (property);
break;
case GLADE_PROPERTY_TYPE_DOUBLE:
input = glade_editor_create_input_double (property);
break;
case GLADE_PROPERTY_TYPE_TEXT:
input = glade_editor_create_input_text (property);
break;
@ -560,7 +576,11 @@ glade_editor_create_input (GladeEditorProperty *property)
case GLADE_PROPERTY_TYPE_OTHER_WIDGETS:
g_warning ("The widget type %d does not have an input implemented\n", type);
break;
default:
case GLADE_PROPERTY_TYPE_OBJECT:
return gtk_label_new ("Implement object");
case GLADE_PROPERTY_TYPE_ERROR:
return gtk_label_new ("Error !");
}
if (input == NULL) {
@ -669,6 +689,10 @@ glade_editor_create_table_from_class (GladeEditor *editor,
GladeEditorProperty *editor_property;
property_class = (GladePropertyClass *) list->data;
/* Special cases */
label = glade_property_class_create_label (property_class);
if (label == NULL)
return NULL;
@ -835,7 +859,7 @@ glade_editor_property_load_integer (GladeEditorProperty *property)
spin = property->input;
}
val = atoi (property->property->value);
val = atof (property->property->value);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), val);
gtk_object_set_user_data (GTK_OBJECT (spin), property);
}
@ -851,6 +875,17 @@ glade_editor_property_load_float (GladeEditorProperty *property)
glade_editor_property_load_integer (property);
}
static void
glade_editor_property_load_double (GladeEditorProperty *property)
{
g_return_if_fail (property != NULL);
g_return_if_fail (property->property != NULL);
g_return_if_fail (property->property->value != NULL);
g_return_if_fail (property->input != NULL);
glade_editor_property_load_integer (property);
}
static void
glade_editor_property_load_choice (GladeEditorProperty *property)
@ -973,6 +1008,9 @@ glade_editor_property_load (GladeEditorProperty *property, GladeWidget *widget)
case GLADE_PROPERTY_TYPE_FLOAT:
glade_editor_property_load_float (property);
break;
case GLADE_PROPERTY_TYPE_DOUBLE:
glade_editor_property_load_double (property);
break;
case GLADE_PROPERTY_TYPE_INTEGER:
glade_editor_property_load_integer (property);
break;
@ -982,7 +1020,8 @@ glade_editor_property_load (GladeEditorProperty *property, GladeWidget *widget)
case GLADE_PROPERTY_TYPE_OTHER_WIDGETS:
glade_editor_property_load_other_widgets (property);
break;
default:
case GLADE_PROPERTY_TYPE_OBJECT:
case GLADE_PROPERTY_TYPE_ERROR:
g_warning ("%s : type %i not implemented\n", __FUNCTION__,
property_class->type);
}

View File

@ -151,7 +151,13 @@ struct _GladeEditorProperty
* really changed, we just loaded a new glade widget
*/
};
typedef enum {
GLADE_EDITOR_INTEGER,
GLADE_EDITOR_FLOAT,
GLADE_EDITOR_DOUBLE,
}GladeEditorNumericType;
void glade_editor_create (GladeProjectWindow *gpw);
void glade_editor_show (GladeProjectWindow *gpw);
void glade_editor_select_widget (GladeEditor *editor, GladeWidget *widget);

76
src/glade-gtk.c Normal file
View File

@ -0,0 +1,76 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU 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.
*
* Authors:
* Chema Celorio <chema@celorio.com>
*/
/* This struct is used for a temp hack */
#include "glade.h"
#include "glade-property-class.h"
static void
glade_gtk_entry_set_text (GObject *object, const gchar *text)
{
gtk_entry_set_text (GTK_ENTRY (object), text);
}
/* ================ Temp hack =================== */
typedef struct _GladeGtkFunction GladeGtkFunction;
struct _GladeGtkFunction {
const gchar *name;
gpointer function;
};
GladeGtkFunction functions [] = {
{"glade_gtk_entry_set_text", &glade_gtk_entry_set_text},
{NULL, NULL},
};
gboolean
glade_gtk_get_set_function_hack (GladePropertyClass *class, const gchar *function_name)
{
gint num;
gint i;
num = sizeof (functions) / sizeof (GladeGtkFunction);
for (i = 0; i < num; i++) {
if (strcmp (function_name, functions[i].name) == 0)
break;
}
if (i == num) {
g_warning ("Could not find the function %s for %s\n",
function_name, class->name);
return FALSE;
}
class->set_function = functions[i].function;
return TRUE;
}

11
src/glade-gtk.h Normal file
View File

@ -0,0 +1,11 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef __GLADE_GTK_H__
#define __GLADE_GTK_H__
G_BEGIN_DECLS
gboolean glade_gtk_get_set_function_hack (GladePropertyClass *class, const gchar *function_name);
G_END_DECLS
#endif /* __GLADE_GTK_H__ */

View File

@ -268,7 +268,11 @@ glade_palette_init (GladePalette * palette)
GtkWidget *widget;
gtk_window_set_title (GTK_WINDOW (palette), _("Palette"));
gtk_window_set_policy (GTK_WINDOW (palette),
TRUE,
FALSE,
TRUE);
palette->tooltips = gtk_tooltips_new ();
palette->widgets_button_group = NULL;
palette->sections_button_group = NULL;

View File

@ -216,7 +216,7 @@ glade_parameter_adjustment_new (GList *parameters)
gfloat lower = 0;
gfloat upper = 999999;
gfloat step_increment = 0.01;
gfloat step_increment = 1;
gfloat page_increment = 265;
gfloat climb_rate = 1;
@ -226,7 +226,7 @@ glade_parameter_adjustment_new (GList *parameters)
glade_parameter_get_float (parameters, "StepIncrement", &step_increment);
glade_parameter_get_float (parameters, "PageIncrement", &page_increment);
glade_parameter_get_float (parameters, "ClimbRate", &climb_rate);
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (value,
lower,
upper,
@ -235,3 +235,4 @@ glade_parameter_adjustment_new (GList *parameters)
climb_rate));
return adjustment;
}

View File

@ -284,7 +284,7 @@ glade_placeholder_add (GladeWidgetClass *class,
gint i;
gint size;
glade_property_query_result_get_int (result, "Size", &size);
glade_property_query_result_get_int (result, "size", &size);
for (i = 0; i < size; i++) {
placeholder = glade_placeholder_new (widget);
@ -296,10 +296,10 @@ glade_placeholder_add (GladeWidgetClass *class,
if ((strcmp (class->name, "GtkTable") == 0)) {
gint row, col;
gint rows, cols;
glade_property_query_result_get_int (result, "Rows", &rows);
glade_property_query_result_get_int (result, "Columns", &cols);
gint rows = 6, cols = 6;
glade_property_query_result_get_int (result, "rows", &rows);
glade_property_query_result_get_int (result, "columns", &cols);
for (row = 0; row < rows; row++) {
for (col = 0; col < cols; col++) {

View File

@ -533,7 +533,7 @@ glade_project_window_query_properties (GladeWidgetClass *class,
property_class = list->data;
if (property_class->query) {
spin = glade_project_append_query (table, property_class, row++);
g_hash_table_insert (hash, property_class->name, spin);
g_hash_table_insert (hash, property_class->id, spin);
}
}
if (spin == NULL)

View File

@ -29,7 +29,10 @@
#include "glade-parameter.h"
#include "glade-property.h"
#include "glade-property-class.h"
#include "glade-gtk.h"
#include <string.h>
#include <gmodule.h>
GladePropertyType
glade_property_type_str_to_enum (const gchar *str)
@ -46,14 +49,16 @@ glade_property_type_str_to_enum (const gchar *str)
return GLADE_PROPERTY_TYPE_CHOICE;
if (strcmp (str, GLADE_TAG_OTHER_WIDGETS) == 0)
return GLADE_PROPERTY_TYPE_OTHER_WIDGETS;
if (strcmp (str, GLADE_TAG_OBJECT) == 0)
return GLADE_PROPERTY_TYPE_OBJECT;
g_warning ("Could not determine the property type from *%s*\n", str);
return GLADE_PROPERTY_TYPE_ERROR;
}
const gchar *
glade_property_type_enum_to_str (GladePropertyType type)
gchar *
glade_property_type_enum_to_string (GladePropertyType type)
{
switch (type) {
case GLADE_PROPERTY_TYPE_TEXT:
@ -64,12 +69,16 @@ glade_property_type_enum_to_str (GladePropertyType type)
return GLADE_TAG_FLOAT;
case GLADE_PROPERTY_TYPE_INTEGER:
return GLADE_TAG_INTEGER;
case GLADE_PROPERTY_TYPE_DOUBLE:
return GLADE_TAG_DOUBLE;
case GLADE_PROPERTY_TYPE_CHOICE:
return GLADE_TAG_CHOICE;
case GLADE_PROPERTY_TYPE_OTHER_WIDGETS:
return GLADE_TAG_OTHER_WIDGETS;
default:
break;
case GLADE_PROPERTY_TYPE_OBJECT:
return GLADE_TAG_OBJECT;
case GLADE_PROPERTY_TYPE_ERROR:
return NULL;
}
return NULL;
@ -115,72 +124,18 @@ glade_property_class_new (void)
property_class = g_new0 (GladePropertyClass, 1);
property_class->type = GLADE_PROPERTY_TYPE_ERROR;
property_class->id = NULL;
property_class->name = NULL;
property_class->tooltip = NULL;
property_class->gtk_arg = NULL;
property_class->parameters = NULL;
property_class->choices = NULL;
property_class->optional = FALSE;
property_class->query = NULL;
property_class->set_function = NULL;
return property_class;
}
static void
glade_property_class_get_specs (GladeWidgetClass *class, GParamSpec ***specs, gint *n_specs)
{
GObjectClass *object_class;
GType type;
type = glade_widget_class_get_type (class);
g_type_class_ref (type); /* hmm */
/* We count on the fact we have an instance, or else we'd have
* touse g_type_class_ref ();
*/
object_class = g_type_class_peek (type);
if (object_class == NULL) {
g_warning ("Class peek failed\n");
*specs = NULL;
*n_specs = 0;
return;
}
*specs = g_object_class_list_properties (object_class, n_specs);
}
GParamSpec *
glade_property_class_find_spec (GladeWidgetClass *class, const gchar *name)
{
GParamSpec **specs = NULL;
GParamSpec *spec;
gint n_specs = 0;
gint i;
glade_property_class_get_specs (class, &specs, &n_specs);
#if 0
g_print ("Dumping specs for %s\n\n", class->name);
for (i = 0; i < n_specs; i++) {
spec = specs[i];
g_print ("%02d - %s\n", i, spec->name);
}
#endif
for (i = 0; i < n_specs; i++) {
spec = specs[i];
if (!spec || !spec->name) {
g_warning ("Spec does not have a valid name, or invalid spec");
return NULL;
}
if (strcmp (spec->name, name) == 0)
return spec;
}
return NULL;
}
static GladePropertyType
glade_property_class_get_type_from_spec (GParamSpec *spec)
@ -199,8 +154,7 @@ glade_property_class_get_type_from_spec (GParamSpec *spec)
case G_TYPE_PARAM_ENUM:
return GLADE_PROPERTY_TYPE_CHOICE;
case G_TYPE_PARAM_DOUBLE:
g_warning ("Double not implemented\n");
break;
return GLADE_PROPERTY_TYPE_DOUBLE;
case G_TYPE_PARAM_LONG:
g_warning ("Long not implemented\n");
break;
@ -269,26 +223,95 @@ glade_property_get_parameters_boolean (GParamSpec *spec,
return g_list_prepend (NULL, parameter);
}
static gchar *
glade_property_get_parameter_numeric_default (GParamSpec *spec)
{
gchar *value = NULL;
if (G_IS_PARAM_SPEC_INT (spec))
value = g_strdup_printf ("%d", G_PARAM_SPEC_INT (spec)->default_value);
else if (G_IS_PARAM_SPEC_UINT (spec))
value = g_strdup_printf ("%u", G_PARAM_SPEC_UINT (spec)->default_value);
else if (G_IS_PARAM_SPEC_FLOAT (spec))
value = g_strdup_printf ("%g", G_PARAM_SPEC_FLOAT (spec)->default_value);
else if (G_IS_PARAM_SPEC_DOUBLE (spec))
value = g_strdup_printf ("%g", G_PARAM_SPEC_DOUBLE (spec)->default_value);
else
g_warning ("glade_propery_get_parameter_numeric_item invalid ParamSpec (default)\n");
return value;
}
static gchar *
glade_property_get_parameter_numeric_min (GParamSpec *spec)
{
gchar *value = NULL;
if (G_IS_PARAM_SPEC_INT (spec))
value = g_strdup_printf ("%d", G_PARAM_SPEC_INT (spec)->minimum);
else if (G_IS_PARAM_SPEC_UINT (spec))
value = g_strdup_printf ("%u", G_PARAM_SPEC_UINT (spec)->minimum);
else if (G_IS_PARAM_SPEC_FLOAT (spec))
value = g_strdup_printf ("%g", G_PARAM_SPEC_FLOAT (spec)->minimum);
else if (G_IS_PARAM_SPEC_DOUBLE (spec))
value = g_strdup_printf ("%g", G_PARAM_SPEC_DOUBLE (spec)->minimum);
else
g_warning ("glade_propery_get_parameter_numeric_item invalid ParamSpec (min)\n");
return value;
}
static gchar *
glade_property_get_parameter_numeric_max (GParamSpec *spec)
{
gchar *value = NULL;
if (G_IS_PARAM_SPEC_INT (spec))
value = g_strdup_printf ("%d", G_PARAM_SPEC_INT (spec)->maximum);
else if (G_IS_PARAM_SPEC_UINT (spec))
value = g_strdup_printf ("%u", G_PARAM_SPEC_UINT (spec)->maximum);
else if (G_IS_PARAM_SPEC_FLOAT (spec))
value = g_strdup_printf ("%g", G_PARAM_SPEC_FLOAT (spec)->maximum);
else if (G_IS_PARAM_SPEC_DOUBLE (spec))
value = g_strdup_printf ("%g", G_PARAM_SPEC_DOUBLE (spec)->maximum);
else
g_warning ("glade_propery_get_parameter_numeric_item invalid ParamSpec (max)\n");
return value;
}
static GList *
glade_property_get_parameters_integer (GParamSpec *spec,
glade_property_get_parameters_numeric (GParamSpec *spec,
GladePropertyClass *class)
{
GladeParameter *parameter;
gint def;
g_return_val_if_fail (G_IS_PARAM_SPEC_INT (spec) |
G_IS_PARAM_SPEC_UINT (spec), NULL);
GList *list = NULL;
if (G_IS_PARAM_SPEC_INT (spec))
def = (gint) G_PARAM_SPEC_INT (spec)->default_value;
else
def = (gint) G_PARAM_SPEC_UINT (spec)->default_value;
g_return_val_if_fail (G_IS_PARAM_SPEC_INT (spec) |
G_IS_PARAM_SPEC_UINT (spec) |
G_IS_PARAM_SPEC_FLOAT (spec) |
G_IS_PARAM_SPEC_DOUBLE (spec), NULL);
/* Get the default value */
parameter = glade_parameter_new ();
parameter->key = g_strdup ("Default");
parameter->value = g_strdup_printf ("%i", def);
parameter->value = glade_property_get_parameter_numeric_default (spec);
list = g_list_prepend (list, parameter);
/* Get the min value */
parameter = glade_parameter_new ();
parameter->key = g_strdup ("Min");
parameter->value = glade_property_get_parameter_numeric_min (spec);
list = g_list_prepend (list, parameter);
/* Get the max value */
parameter = glade_parameter_new ();
parameter->key = g_strdup ("Max");
parameter->value = glade_property_get_parameter_numeric_max (spec);
list = g_list_prepend (list, parameter);
return g_list_prepend (NULL, parameter);
return list;
}
static GList *
@ -343,16 +366,22 @@ glade_property_class_get_parameters_from_spec (GParamSpec *spec,
case GLADE_PROPERTY_TYPE_TEXT:
break;
case GLADE_PROPERTY_TYPE_INTEGER:
parameters = glade_property_get_parameters_integer (spec,
class);
break;
case GLADE_PROPERTY_TYPE_FLOAT:
case GLADE_PROPERTY_TYPE_DOUBLE:
parameters = glade_property_get_parameters_numeric (spec,
class);
break;
case GLADE_PROPERTY_TYPE_BOOLEAN:
parameters = glade_property_get_parameters_boolean (spec,
class);
break;
default:
case GLADE_PROPERTY_TYPE_OTHER_WIDGETS:
break;
case GLADE_PROPERTY_TYPE_OBJECT:
g_print ("get parameters from spec for type object not implemented\n");
break;
case GLADE_PROPERTY_TYPE_ERROR:
break;
}
/* Get the parameters that are specified on the glade file,
@ -376,7 +405,7 @@ glade_property_class_new_from_param_spec (const gchar *name,
GladePropertyClass *class;
GParamSpec *spec;
spec = glade_property_class_find_spec (widget_class, name);
spec = glade_widget_class_find_spec (widget_class, name);
if (spec == NULL) {
g_warning ("Could not create a property class from a param spec for *%s* with name *%s*\n",
@ -385,9 +414,9 @@ glade_property_class_new_from_param_spec (const gchar *name,
}
class = glade_property_class_new ();
class->id = g_strdup (spec->name);
class->name = g_strdup (spec->nick);
class->tooltip = g_strdup (spec->blurb);
class->gtk_arg = g_strdup (name);
class->type = glade_property_class_get_type_from_spec (spec);
if (class->type == GLADE_PROPERTY_TYPE_CHOICE)
@ -398,6 +427,35 @@ glade_property_class_new_from_param_spec (const gchar *name,
return class;
}
static gboolean
glade_property_class_get_set_function (GladePropertyClass *class, const gchar *function_name)
{
static GModule *allsymbols;
/* This is not working ... So add a temp hack */
return glade_gtk_get_set_function_hack (class, function_name);
g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (class), FALSE);
g_return_val_if_fail (class->set_function == NULL, FALSE);
g_return_val_if_fail (function_name != NULL, FALSE);
if (!allsymbols)
allsymbols = g_module_open (NULL, 0);
if (!g_module_symbol (allsymbols, function_name,
(gpointer) &class->set_function)) {
g_warning (_("We could not find the symbol \"%s\" while trying to load \"%s\""),
function_name, class->name);
return FALSE;
}
g_assert (class->set_function);
g_print ("Got the %s function for %s\n",
function_name, class->name);
return TRUE;
}
static GladePropertyClass *
glade_property_class_new_from_node (xmlNodePtr node, GladeWidgetClass *widget_class)
@ -405,29 +463,41 @@ glade_property_class_new_from_node (xmlNodePtr node, GladeWidgetClass *widget_cl
GladePropertyClass *property_class;
xmlNodePtr child;
gchar *type;
gchar *id;
gchar *name;
if (!glade_xml_node_verify (node, GLADE_TAG_PROPERTY))
return NULL;
name = glade_xml_get_value_string_required (node, GLADE_TAG_NAME, NULL);
if (name == NULL)
id = glade_xml_get_value_string_required (node, GLADE_TAG_ID, widget_class->name);
if (id == NULL)
return NULL;
/* Should we load this property from the ParamSpec ? */
/* Should we load this property from the ParamSpec ?
* We can have a property like ... ParamSpec="TRUE">
* Or a child like <ParamSpec/>, but this will be deprecated
*/
child = glade_xml_search_child (node, GLADE_TAG_PARAM_SPEC);
if (child) {
property_class = glade_property_class_new_from_param_spec (name, widget_class, node);
g_free (name);
if (child ||
glade_xml_get_boolean (node, GLADE_TAG_PARAM_SPEC)) {
property_class = glade_property_class_new_from_param_spec (id, widget_class, node);
g_free (id);
if (property_class == NULL)
glade_widget_class_dump_param_specs (widget_class);
return property_class;
}
name = glade_xml_get_value_string_required (node, GLADE_TAG_NAME, widget_class->name);
if (name == NULL)
return NULL;
/* Ok, this property should not be loaded with ParamSpec */
property_class = glade_property_class_new ();
property_class->name = name;
property_class->id = id;
property_class->name = name;
property_class->tooltip = glade_xml_get_value_string (node, GLADE_TAG_TOOLTIP);
property_class->gtk_arg = glade_xml_get_value_string (node, GLADE_TAG_GTKARG);
/* Get the type */
type = glade_xml_get_value_string_required (node, GLADE_TAG_TYPE, widget_class->name);
@ -457,7 +527,20 @@ glade_property_class_new_from_node (xmlNodePtr node, GladeWidgetClass *widget_cl
property_class->choices = glade_choice_list_new_from_node (child);
}
/* If the property is an object Load it */
if (property_class->type == GLADE_PROPERTY_TYPE_OBJECT) {
}
/* If this property can't be set with g_object_set, get the workarround
* function
*/
child = glade_xml_search_child (node, GLADE_TAG_SET_FUNCTION);
if (child != NULL) {
gchar * content = glade_xml_get_content (child);
glade_property_class_get_set_function (property_class, content);
g_free (content);
}
return property_class;
}
@ -480,9 +563,8 @@ glade_property_class_list_new_from_node (xmlNodePtr node, GladeWidgetClass *clas
if (!glade_xml_node_verify (child, GLADE_TAG_PROPERTY))
return NULL;
property_class = glade_property_class_new_from_node (child, class);
if (property_class == NULL)
return NULL;
list = g_list_prepend (list, property_class);
if (property_class != NULL)
list = g_list_prepend (list, property_class);
child = child->next;
}

View File

@ -10,9 +10,11 @@ typedef enum {
GLADE_PROPERTY_TYPE_BOOLEAN,
GLADE_PROPERTY_TYPE_FLOAT,
GLADE_PROPERTY_TYPE_INTEGER,
GLADE_PROPERTY_TYPE_DOUBLE,
GLADE_PROPERTY_TYPE_TEXT,
GLADE_PROPERTY_TYPE_CHOICE,
GLADE_PROPERTY_TYPE_OTHER_WIDGETS,
GLADE_PROPERTY_TYPE_OBJECT,
GLADE_PROPERTY_TYPE_ERROR
} GladePropertyType;
@ -94,20 +96,23 @@ typedef enum {
*/
#define GLADE_PROPERTY_CLASS(gpc) ((GladePropertyClass *) gpc)
#define GLADE_IS_PROPERTY_CLASS(gpc) (gpc != NULL)
struct _GladePropertyClass {
GladePropertyType type; /* The type of property from GladePropertyType
*/
gchar *name; /* The name of the property. Like "Label" or "xpad"
gchar *id; /* The id of the property. Like "label" or "xpad"
* this is a non-translatable string
*/
gchar *name; /* The name of the property. Like "Label" or "X Pad"
* this is a translatable string
*/
gchar *tooltip; /* The tooltip. Currently unimplemented. Not sure if
* it should go here
*/
gchar *gtk_arg; /* The gtk arg to modify this property. Like
* "label" from "GtkLabel::label"
*/
GList *parameters; /* list of GladeParameter objects. This list
* provides with an extra set of key-value
@ -129,7 +134,22 @@ struct _GladePropertyClass {
* left that enables/disables de input
*/
GladePropertyQuery *query;
GladePropertyQuery *query;
GList *children; /* A list of GladeWidgetClass pointer of objects
* that we need to set for this widget
* for example : GtkSpinButton has a Adjustment inside
* a GtkCombo has an entry inside and a GtkClist which
* makes a drop dowm menu
*/
void (*set_function) (GObject *object,
const gchar *value);
/* If this property can't be set with g_object_set then
* we need to implement it inside glade. This is a pointer
* to the function that can set this property. The functions
* to work arround this problems are inside glade-gtk.c
*/
};
GtkWidget * glade_property_class_create_label (GladePropertyClass *pclass);
@ -138,6 +158,8 @@ GList * glade_property_class_list_new_from_node (xmlNodePtr node, GladeWidgetCla
GParamSpec * glade_property_class_find_spec (GladeWidgetClass *class, const gchar *name);
gchar * glade_property_type_enum_to_string (GladePropertyType type);
G_END_DECLS
#endif /* __GLADE_PROPERTY_CLASS_H__ */

View File

@ -85,6 +85,16 @@ glade_property_new_from_string (const gchar *string, GladePropertyClass *class)
"OptionalDefault",
&property->enabled);
break;
case GLADE_PROPERTY_TYPE_DOUBLE:
if (string)
float_val = atof (string);
else
float_val = 0;
value = g_strdup_printf ("%g", float_val);
glade_parameter_get_boolean (class->parameters,
"OptionalDefault",
&property->enabled);
break;
case GLADE_PROPERTY_TYPE_INTEGER:
if (string)
int_val = atoi (string);
@ -122,15 +132,17 @@ glade_property_new_from_string (const gchar *string, GladePropertyClass *class)
}
choice = list->data;
g_warning ("Invalid default tag \"%s\" for property \"%s\", setting deafult to %s (%s)",
choice->name, class->name,
choice->name, class->id,
choice->symbol, string);
value = g_strdup (choice->symbol);
break;
case GLADE_PROPERTY_TYPE_OTHER_WIDGETS:
value = g_strdup ("");
break;
case GLADE_PROPERTY_TYPE_OBJECT:
g_print ("Dunno what to do with type object \n");
break;
case GLADE_PROPERTY_TYPE_ERROR:
default:
g_warning ("Invalid Glade property type (%d)\n", class->type);
break;
}
@ -176,20 +188,20 @@ glade_property_list_new_from_widget_class (GladeWidgetClass *class,
GladeProperty *
glade_property_get_from_gtk_arg (GList *settings_list, const gchar *arg)
glade_property_get_from_id (GList *settings_list, const gchar *id)
{
GList *list;
GladeProperty *property;
g_return_val_if_fail (arg != NULL, NULL);
g_return_val_if_fail (id != NULL, NULL);
list = settings_list;
for (; list != NULL; list = list->next) {
property = list->data;
g_return_val_if_fail (property, NULL);
g_return_val_if_fail (property->class, NULL);
g_return_val_if_fail (property->class->gtk_arg, NULL);
if (strcmp (property->class->gtk_arg, arg) == 0)
g_return_val_if_fail (property->class->id, NULL);
if (strcmp (property->class->id, id) == 0)
return property;
}
@ -223,13 +235,18 @@ glade_property_changed_text (GladeProperty *property,
property->value = g_strdup (text);
g_free (temp);
if (property->class->gtk_arg == NULL) {
g_print ("I don't have a gtk arg for %s\n", property->class->name);
if (property->class->id == NULL) {
g_print ("I don't have an id %s\n", property->class->id);
return;
}
gtk_object_set (GTK_OBJECT (property->widget->widget),
property->class->gtk_arg, property->value, NULL);
if (property->class->set_function == NULL)
gtk_object_set (GTK_OBJECT (property->widget->widget),
property->class->id,
property->value, NULL);
else
(*property->class->set_function) (G_OBJECT (property->widget->widget),
property->value);
}
void
@ -242,7 +259,7 @@ glade_property_changed_integer (GladeProperty *property, gint val)
property->value = g_strdup_printf ("%i", val);
gtk_object_set (GTK_OBJECT (property->widget->widget),
property->class->gtk_arg, val, NULL);
property->class->id, val, NULL);
}
void
@ -251,11 +268,62 @@ glade_property_changed_float (GladeProperty *property, gfloat val)
g_return_if_fail (property != NULL);
g_return_if_fail (property->value != NULL);
g_print ("Changed float\n");
g_free (property->value);
property->value = g_strdup_printf ("%g", val);
gtk_object_set (GTK_OBJECT (property->widget->widget),
property->class->gtk_arg, val, NULL);
property->class->id, val, NULL);
}
void
glade_property_changed_double (GladeProperty *property, gdouble val)
{
#if 0
GValue *gvalue = g_new0 (GValue, 1);
#endif
g_return_if_fail (property != NULL);
g_return_if_fail (property->value != NULL);
g_free (property->value);
property->value = g_strdup_printf ("%g", val);
#if 0
gvalue = g_value_init (gvalue, G_TYPE_DOUBLE);
g_value_set_double (gvalue, val);
#endif
#if 0
g_print ("Changed double to %g \"%s\" -->%s<-- but using gvalue @%d\n",
val,
property->value,
property->class->gtk_arg,
GPOINTER_TO_INT (gvalue));
#endif
g_object_set (G_OBJECT (property->widget->widget),
property->class->id, val, NULL);
#if 0
if (GTK_IS_SPIN_BUTTON (property->widget->widget)) {
g_print ("It is spin button\n");
g_print ("The alignement is min :%g max:%g value%g\n",
GTK_SPIN_BUTTON (property->widget->widget)->adjustment->lower,
GTK_SPIN_BUTTON (property->widget->widget)->adjustment->upper,
GTK_SPIN_BUTTON (property->widget->widget)->adjustment->value);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (property->widget->widget),
333.22);
}
#endif
#if 0
g_print ("Setting-------------------- 222222222\n");
g_object_set (G_OBJECT (property->widget->widget),
property->class->gtk_arg,
gvalue, NULL);
g_print ("DONE: Setting-------------------------\n");
#endif
}
void
@ -268,7 +336,7 @@ glade_property_changed_boolean (GladeProperty *property, gboolean val)
property->value = g_strdup_printf ("%s", val ? GLADE_TAG_TRUE : GLADE_TAG_FALSE);
gtk_object_set (GTK_OBJECT (property->widget->widget),
property->class->gtk_arg, val, NULL);
property->class->id, val, NULL);
}
void
@ -311,6 +379,14 @@ glade_property_get_float (GladeProperty *property)
return atof (property->value);
}
gdouble
glade_property_get_double (GladeProperty *property)
{
g_return_val_if_fail (property != NULL, 0.0);
g_return_val_if_fail (property->value != NULL, 0.0);
return (gdouble) atof (property->value);
}
gboolean
glade_property_get_boolean (GladeProperty *property)

View File

@ -51,12 +51,14 @@ GList * glade_property_list_new_from_widget_class (GladeWidgetClass *class,
void glade_property_changed_text (GladeProperty *property, const gchar *text);
void glade_property_changed_integer (GladeProperty *property, gint val);
void glade_property_changed_float (GladeProperty *property, gfloat val);
void glade_property_changed_double (GladeProperty *property, gdouble val);
void glade_property_changed_boolean (GladeProperty *property, gboolean val);
void glade_property_changed_choice (GladeProperty *property, GladeChoice *choice);
const gchar * glade_property_get_text (GladeProperty *property);
gint glade_property_get_integer (GladeProperty *property);
gfloat glade_property_get_float (GladeProperty *property);
gdouble glade_property_get_double (GladeProperty *property);
gboolean glade_property_get_boolean (GladeProperty *property);
GladeChoice * glade_property_get_choice (GladeProperty *property);
@ -66,8 +68,8 @@ GladeProperty * glade_property_get_from_name (GList *property_list,
const gchar *name);
GladeProperty * glade_property_get_from_class (GladeWidget *widget,
GladePropertyClass *class);
GladeProperty * glade_property_get_from_gtk_arg (GList *settings_list,
const gchar *arg);
GladeProperty * glade_property_get_from_id (GList *settings_list,
const gchar *id);
/* Property Queries */
GladePropertyQueryResult * glade_property_query_result_new (void);

View File

@ -148,12 +148,6 @@ glade_widget_class_set_type (GladeWidgetClass *class, const gchar *init_function
g_return_val_if_fail (GLADE_IS_WIDGET_CLASS (class), FALSE);
g_return_val_if_fail (init_function_name != NULL, FALSE);
if (!g_module_supported ()) {
g_warning (_("gmodule support not found. gmodule support is requiered "
"for glade to work"));
return FALSE;
}
if (!allsymbols)
allsymbols = g_module_open (NULL, 0);
@ -332,3 +326,78 @@ glade_widget_class_has_queries (GladeWidgetClass *class)
return FALSE;
}
/* ParamSpec stuff */
static void
glade_widget_class_get_specs (GladeWidgetClass *class, GParamSpec ***specs, gint *n_specs)
{
GObjectClass *object_class;
GType type;
type = glade_widget_class_get_type (class);
g_type_class_ref (type); /* hmm */
/* We count on the fact we have an instance, or else we'd have
* touse g_type_class_ref ();
*/
object_class = g_type_class_peek (type);
if (object_class == NULL) {
g_warning ("Class peek failed\n");
*specs = NULL;
*n_specs = 0;
return;
}
*specs = g_object_class_list_properties (object_class, n_specs);
}
GParamSpec *
glade_widget_class_find_spec (GladeWidgetClass *class, const gchar *name)
{
GParamSpec **specs = NULL;
GParamSpec *spec;
gint n_specs = 0;
gint i;
glade_widget_class_get_specs (class, &specs, &n_specs);
#if 0
g_print ("Dumping specs for %s\n\n", class->name);
for (i = 0; i < n_specs; i++) {
spec = specs[i];
g_print ("%02d - %s\n", i, spec->name);
}
#endif
for (i = 0; i < n_specs; i++) {
spec = specs[i];
if (!spec || !spec->name) {
g_warning ("Spec does not have a valid name, or invalid spec");
return NULL;
}
if (strcmp (spec->name, name) == 0)
return spec;
}
return NULL;
}
void
glade_widget_class_dump_param_specs (GladeWidgetClass *class)
{
GParamSpec **specs = NULL;
GParamSpec *spec;
gint n_specs = 0;
gint i;
glade_widget_class_get_specs (class, &specs, &n_specs);
g_print ("Dumping ParamSpec for %s\n", class->name);
for (i = 0; i < n_specs; i++) {
spec = specs[i];
g_print ("%02d - %s\n", i, spec->name);
}
}

View File

@ -75,6 +75,11 @@ const gchar * glade_widget_class_get_name (GladeWidgetClass *class);
GType glade_widget_class_get_type (GladeWidgetClass *class);
gboolean glade_widget_class_has_queries (GladeWidgetClass *class);
/* ParamSpec stuff */
GParamSpec * glade_widget_class_find_spec (GladeWidgetClass *class, const gchar *name);
void glade_widget_class_dump_param_specs (GladeWidgetClass *class);
G_END_DECLS
#endif /* __GLADE_WIDGET_CLASS_H__ */

View File

@ -249,6 +249,16 @@ glade_widget_get_from_event_widget (GtkWidget *event_widget, GdkEventButton *eve
return found;
}
/**
* glade_widget_button_press:
* @event_widget:
* @event:
* @not_used:
*
* Handle the button press event for every GladeWidget
*
* Return Value:
**/
static gboolean
glade_widget_button_press (GtkWidget *event_widget, GdkEventButton *event, gpointer not_used)
{
@ -270,13 +280,13 @@ glade_widget_button_press (GtkWidget *event_widget, GdkEventButton *event, gpoin
else if (event->button == 3)
glade_popup_pop (glade_widget, event);
else
g_print ("BUtton press not handled yet.\n");
g_print ("Button press not handled yet.\n");
#ifdef DEBUG
g_print ("The widget found was a %s\n", glade_widget->class->name);
#endif
return TRUE;
return FALSE;
}
#undef DEBUG
@ -286,8 +296,7 @@ glade_widget_button_release (GtkWidget *widget, GdkEventButton *event, gpointer
#ifdef DEBUG
g_print ("button release\n");
#endif
return TRUE;
return FALSE;
}
@ -320,6 +329,10 @@ glade_widget_set_default_options (GladeWidget *widget)
glade_property_changed_integer (property,
glade_property_get_integer (property));
break;
case GLADE_PROPERTY_TYPE_DOUBLE:
glade_property_changed_double (property,
glade_property_get_double (property));
break;
case GLADE_PROPERTY_TYPE_TEXT:
glade_property_changed_text (property,
glade_property_get_text (property));
@ -487,12 +500,12 @@ glade_widget_set_contents (GladeWidget *widget)
class = widget->class;
if (glade_property_class_find_spec (class, "label") != NULL)
property = glade_property_get_from_gtk_arg (widget->properties,
if (glade_widget_class_find_spec (class, "label") != NULL)
property = glade_property_get_from_id (widget->properties,
"label");
if (glade_property_class_find_spec (class, "title") != NULL)
property = glade_property_get_from_gtk_arg (widget->properties,
"title");
if (glade_widget_class_find_spec (class, "title") != NULL)
property = glade_property_get_from_id (widget->properties,
"title");
if (property != NULL)
glade_property_changed_text (property, widget->name);
}

View File

@ -170,8 +170,10 @@ glade_xml_get_value_string (xmlNodePtr node, const char *name)
return glade_xml_get_value (node, name);
}
#define GLADE_TAG_TRUE "True"
#define GLADE_TAG_FALSE "False"
#define GLADE_TAG_TRUE "True"
#define GLADE_TAG_FALSE "False"
#define GLADE_TAG_TRUE2 "TRUE"
#define GLADE_TAG_FALSE2 "FALSE"
/*
* Get a String value for a node either carried as an attibute or as
* the content of a child.
@ -188,8 +190,12 @@ glade_xml_get_boolean (xmlNodePtr node, const char *name)
if (strcmp (value, GLADE_TAG_FALSE) == 0)
ret = FALSE;
else if (strcmp (value, GLADE_TAG_FALSE2) == 0)
ret = FALSE;
else if (strcmp (value, GLADE_TAG_TRUE) == 0)
ret = TRUE;
else if (strcmp (value, GLADE_TAG_TRUE2) == 0)
ret = TRUE;
else
g_warning ("Boolean tag unrecognized *%s*\n", value);
@ -199,6 +205,8 @@ glade_xml_get_boolean (xmlNodePtr node, const char *name)
}
#undef GLADE_TAG_TRUE
#undef GLADE_TAG_FALSE
#undef GLADE_TAG_TRUE2
#undef GLADE_TAG_FALSE2
gchar *
glade_xml_get_value_string_required (xmlNodePtr node, const char *name, const char *xtra)

View File

@ -14,6 +14,7 @@ gchar * _ (gchar * name);
#define GLADE_TAG_GET_TYPE_FUNCTION "GetTypeFunction"
#define GLADE_TAG_GENERIC_NAME "GenericName"
#define GLADE_TAG_NAME "Name"
#define GLADE_TAG_ID "Id"
#define GLADE_TAG_KEY "Key"
#define GLADE_TAG_VALUE "Value"
#define GLADE_TAG_TOPLEVEL "Toplevel"
@ -37,8 +38,11 @@ gchar * _ (gchar * name);
#define GLADE_TAG_BOOLEAN "Boolean"
#define GLADE_TAG_FLOAT "Float"
#define GLADE_TAG_INTEGER "Integer"
#define GLADE_TAG_DOUBLE "Double"
#define GLADE_TAG_CHOICE "Choice"
#define GLADE_TAG_OTHER_WIDGETS "OtherWidgets"
#define GLADE_TAG_OBJECT "Object"
#define GLADE_TAG_SET_FUNCTION "SetFunction"
#define GLADE_TAG_QUERY "Query"
#define GLADE_TAG_WINDOW_TITLE "WindowTitle"
#define GLADE_TAG_QUESTION "Question"

View File

@ -32,6 +32,8 @@
#include "glade-project-view.h"
#include "glade-project-window.h"
#include <gmodule.h>
#ifdef FIX_POPT
static void parse_command_line (poptContext);
@ -54,7 +56,13 @@ glade_init ()
GladeProjectWindow *project_window;
GladeProject *project;
GladeCatalog *catalog;
if (!g_module_supported ()) {
g_warning (_("gmodule support not found. gmodule support is requiered "
"for glade to work"));
return FALSE;
}
/*
* 1. Init the cursors
* 2. Create the catalog

View File

@ -6,16 +6,12 @@
<Properties>
<Property>
<Name>label</Name>
<ParamSpec/>
</Property>
<Property>
<Property ParamSpec="TRUE" Id="label"/>
<Property Name="Stock Button" Id="stock-button">
<Type>Choice</Type>
<Name>Stock Button</Name>
<Tooltip>The GNOME stock button to use</Tooltip>
<GtkArg>fixme</GtkArg>
<Parameters>
<Parameter Key="Default" Value="GTK_RELIEF_NORMAL"/>
</Parameters>
@ -36,6 +32,7 @@
</Property>
</Properties>
</GladeWidgetClass>

View File

@ -6,36 +6,10 @@
<Properties>
<Property>
<Name>label</Name>
<ParamSpec/>
</Property>
<Property ParamSpec="TRUE" Id="label"/>
<Property>
<Type>Choice</Type>
<Name>Stock Button</Name>
<Tooltip>The GNOME stock button to use</Tooltip>
<GtkArg>fixme</GtkArg>
<Parameters>
<Parameter Key="Default" Value="GTK_RELIEF_NORMAL"/>
</Parameters>
<Choices>
<Choice>
<Name>Normal</Name>
<Symbol>GTK_RELIEF_NORMAL</Symbol>
</Choice>
<Choice>
<Name>Half</Name>
<Symbol>GTK_RELIEF_HALF</Symbol>
</Choice>
<Choice>
<Name>None</Name>
<Symbol>GTK_RELIEF_NONE</Symbol>
</Choice>
</Choices>
</Property>
</Properties>
</GladeWidgetClass>

View File

@ -7,19 +7,14 @@
<Properties>
<Property>
<Name>editable</Name>
<ParamSpec/>
</Property>
<Property ParamSpec="TRUE" Id="editable"/>
<Property ParamSpec="TRUE" Id="visibility"/>
<Property ParamSpec="TRUE" Id="max-length"/>
<Property>
<Name>visibility</Name>
<ParamSpec/>
</Property>
<Property>
<Name>max-length</Name>
<ParamSpec/>
<Property ParamSpec="FALSE" Id="text" Name="Text">
<Type>Text</Type>
<Tooltip>Initial Contents of the entry</Tooltip>
<SetFunction>glade_gtk_entry_set_text</SetFunction>
</Property>
</Properties>

View File

@ -7,10 +7,7 @@
<Properties>
<Property>
<Name>label</Name>
<ParamSpec/>
</Property>
<Property ParamSpec="TRUE" Id="label"/>
</Properties>

View File

@ -7,19 +7,24 @@
<Properties>
<Property>
<Name>size</Name>
<ParamSpec/>
<Property Name="Size" Id="size">
<Type>Integer</Type>
<Tooltip>The number of colunms in the box</Tooltip>
<Parameters>
<Parameter Key="Min" Value="0"/>
<Parameter Key="Max" Value="10000"/>
<Parameter Key="Default" Value="3"/>
<Parameter Key="StepIncrement" Value="1"/>
<Parameter Key="PageIncrement" Value="10"/>
<Parameter Key="ClibmRate" Value="1"/>
</Parameters>
<Query>
<WindowTitle>New vertical box</WindowTitle>
<Question>Number of rows</Question>
<WindowTitle>New horizontal box</WindowTitle>
<Question>Number of columns</Question>
</Query>
</Property>
<Property>
<Name>spacing</Name>
<ParamSpec/>
</Property>
<Property ParamSpec="TRUE" Id="spacing"/>
</Properties>

View File

@ -7,44 +7,18 @@
<Properties>
<Property>
<Name>label</Name>
<ParamSpec/>
<Property ParamSpec="TRUE" Id="label">
<Parameters>
<Parameter Key="VisibleLines" Value="1"/>
</Parameters>
</Property>
<Property>
<Name>justify</Name>
<ParamSpec/>
</Property>
<Property>
<Name>wrap</Name>
<ParamSpec/>
</Property>
<Property>
<Name>xalign</Name>
<ParamSpec/>
</Property>
<Property>
<Name>yalign</Name>
<ParamSpec/>
</Property>
<Property>
<Name>xpad</Name>
<ParamSpec/>
</Property>
<Property>
<Name>ypad</Name>
<ParamSpec/>
</Property>
<Property ParamSpec="TRUE" Id="justify"/>
<Property ParamSpec="TRUE" Id="wrap"/>
<Property ParamSpec="TRUE" Id="xalign"/>
<Property ParamSpec="TRUE" Id="yalign"/>
<Property ParamSpec="TRUE" Id="xpad"/>
<Property ParamSpec="TRUE" Id="ypad"/>
</Properties>
</GladeWidgetClass>

View File

@ -7,10 +7,7 @@
<Properties>
<Property>
<Name>name</Name>
<ParamSpec/>
</Property>
<Property ParamSpec="TRUE" Id="name"/>
</Properties>

View File

@ -6,10 +6,7 @@
<Properties>
<Property>
<Name>label</Name>
<ParamSpec/>
</Property>
<Property ParamSpec="TRUE" Id="label"/>
</Properties>

View File

@ -1,4 +1,5 @@
<GladeWidgetClass>
<Name>GtkSpinButton</Name>
<GetTypeFunction>gtk_spin_button_get_type</GetTypeFunction>
<GenericName>spinbutton</GenericName>
@ -6,7 +7,41 @@
<Properties>
<Property ParamSpec="TRUE" Id="climb-rate"/>
<Property ParamSpec="TRUE" Id="digits"/>
<Property ParamSpec="TRUE" Id="numeric"/>
<Property ParamSpec="TRUE" Id="update-policy"/>
<Property ParamSpec="TRUE" Id="snap-to-ticks"/>
<Property ParamSpec="TRUE" Id="wrap"/>
<Property ParamSpec="TRUE" Id="value"/>
<Property Name="Adjustment" Id="adjustment">
<Type>Object</Type>
<GladeObject>
<Name>GtkAdjustment</Name>
<GetTypeFunction>gtk_adjustment_get_type</GetTypeFunction>
<Properties>
<Property ParamSpec="TRUE" Id="climb-rate"/>
<Property ParamSpec="TRUE" Id="digits"/>
<Property ParamSpec="TRUE" Id="numeric"/>
<Property ParamSpec="TRUE" Id="update-policy"/>
</Properties>
</GladeObject>
<!--
<Parameters>
<Parameter Key="Default" Value="1"/>
<Parameter Key="Min" Value="0"/>
<Parameter Key="Max" Value="100"/>
<Parameter Key="StepIncrement" Value="1"/>
<Parameter Key="PageIncrement" Value="10"/>
<Parameter Key="PageSize" Value="10"/>
</Parameters>
-->
</Property>
</Properties>
</GladeWidgetClass>

View File

@ -7,12 +7,14 @@
<Properties>
<Property>
<Name>border-width</Name>
<ParamSpec/>
<Property ParamSpec="TRUE" Id="n-rows">
<Query>
<WindowTitle>New vertical box</WindowTitle>
<Question>Number of rows</Question>
</Query>
</Property>
<Property>
<Property Id="rows">
<Type>Integer</Type>
<Name>Rows</Name>
<Tooltip>The number of rows in the table</Tooltip>
@ -31,7 +33,7 @@
</Query>
</Property>
<Property>
<Property Id="columns">
<Type>Integer</Type>
<Name>Columns</Name>
<Tooltip>The number of columnd in the table</Tooltip>
@ -50,20 +52,9 @@
</Query>
</Property>
<Property>
<Name>homogeneous</Name>
<ParamSpec/>
</Property>
<Property>
<Name>row-spacing</Name>
<ParamSpec/>
</Property>
<Property>
<Name>column-spacing</Name>
<ParamSpec/>
</Property>
<Property ParamSpec="TRUE" Id="homogeneous"/>
<Property ParamSpec="TRUE" Id="row-spacing"/>
<Property ParamSpec="TRUE" Id="column-spacing"/>
</Properties>

View File

@ -6,10 +6,7 @@
<Properties>
<Property>
<Name>label</Name>
<ParamSpec/>
</Property>
<Property ParamSpec="TRUE" Id="label"/>
</Properties>

View File

@ -7,24 +7,27 @@
<Properties>
<Property>
<Name>border-width</Name>
<ParamSpec/>
</Property>
<Property ParamSpec="TRUE" Id="border-width"/>
<Property>
<Name>size</Name>
<ParamSpec/>
<Property Name="Size" Id="size">
<Type>Integer</Type>
<Tooltip>The number of rows in the box</Tooltip>
<Parameters>
<Parameter Key="Min" Value="0"/>
<Parameter Key="Max" Value="10000"/>
<Parameter Key="Default" Value="3"/>
<Parameter Key="StepIncrement" Value="1"/>
<Parameter Key="PageIncrement" Value="10"/>
<Parameter Key="ClibmRate" Value="1"/>
</Parameters>
<Query>
<WindowTitle>New vertical box</WindowTitle>
<Question>Number of rows</Question>
</Query>
</Property>
<Property>
<Name>spacing</Name>
<ParamSpec/>
</Property>
<Property ParamSpec="TRUE" Id="spacing"/>
</Properties>
</GladeWidgetClass>

View File

@ -7,75 +7,26 @@
<Properties>
<Property>
<Name>title</Name>
<ParamSpec/>
</Property>
<Property>
<Name>type</Name>
<ParamSpec/>
</Property>
<Property>
<Name>window-position</Name>
<ParamSpec/>
</Property>
<Property>
<Name>modal</Name>
<ParamSpec/>
</Property>
<Property>
<Name>default-width</Name>
<ParamSpec/>
<Property ParamSpec="TRUE" Id="title"/>
<Property ParamSpec="TRUE" Id="type"/>
<Property ParamSpec="TRUE" Id="window-position"/>
<Property ParamSpec="TRUE" Id="modal"/>
<Property ParamSpec="TRUE" Id="default-width">
<Parameters>
<Parameter Key="Default" Value="440"/>
</Parameters>
</Property>
<Property>
<Name>default-height</Name>
<ParamSpec/>
<Property ParamSpec="TRUE" Id="default-height">
<Parameters>
<Parameter Key="Default" Value="300"/>
<Parameter Key="Default" Value="250"/>
</Parameters>
</Property>
<Property>
<Name>allow-shrink</Name>
<ParamSpec/>
</Property>
<Property>
<Name>allow-grow</Name>
<ParamSpec/>
</Property>
<Property>
<Name>auto-shrink</Name>
<ParamSpec/>
</Property>
<!-- Dunno what this does, dunno if we should remove it -->
<!--
<Property>
<Type>Text</Type>
<Name>WM Name</Name>
<Tooltip>The name to pass to the window manager</Tooltip>
<GtkArg>fixme</GtkArg>
</Property>
<Property>
<Type>Text</Type>
<Name>WM Class</Name>
<Tooltip>The class name to pass to the window manager</Tooltip>
<GtkArg>fixme</GtkArg>
</Property>
-->
<Property ParamSpec="TRUE" Id="auto-shrink"/>
<Property ParamSpec="TRUE" Id="allow-grow"/>
<Property ParamSpec="TRUE" Id="auto-shrink"/>
</Properties>
</GladeWidgetClass>