mirror of
https://gitlab.gnome.org/GNOME/glade.git
synced 2025-08-10 00:04:29 -04:00
don't unref the cell nor the column. Thanks jacob@ximian.com
2001-09-03 Chema Celorio <chema@celorio.com> * src/glade-project-view.c (glade_project_view_create_widget): don't unref the cell nor the column. Thanks jacob@ximian.com 2001-09-03 Chema Celorio <chema@celorio.com> * src/glade.h: add new xml tags * src/glade-xml-utils.h: standarize a lot of the calls to xml-utils and rename all the calling funcitions to the new names * src/glade-widget.c (glade_widget_new): add a project parameter needed for loading objects. (glade_widget_create_gtk_widget): only call the widget resize when the object is an actual widget (v.s. beeing an object like a gtkadjustment) * src/glade-widget-class.c (glade_widget_class_set_type): call get_type_from_name and move the code to get the type there (glade_widget_class_load_packing_properties_from_node): impl. (glade_widget_class_load_packing_properties): impl. * src/glade-utils.c (glade_util_get_type_from_name): move here * src/glade-property.c (glade_property_new_from_class): set property->child for type = _TYPE_OBJECT (glade_property_set_enum): s/choice/enum * src/glade-packing.c (glade_packing_add_properties_from_list): add packing properties too (glade_packing_property_get_from_class): impl. * src/glade-gtk.c (glade_gtk_button_set_stock): implement stock buttons * src/glade-editor.c (glade_editor_property_changed_enum): s/choice/enum * src/glade-choice.c (glade_enum_from_string): add a temp entry for gtk-ok, glade-none and gtk-cancel. (glade_choice_list_new_from_node): change the XML tag name to ENUMS from CHOICE * src/glade-catalog.h: add prototype for glade_catalog_get * src/glade-catalog.c (glade_catalog_get): impl. (glade_catalog_load): after loading all the widgets load the packing properties.
This commit is contained in:
parent
5edecc7430
commit
a70b7edb58
55
ChangeLog
55
ChangeLog
@ -1,3 +1,57 @@
|
||||
2001-09-03 Chema Celorio <chema@celorio.com>
|
||||
|
||||
* src/glade-project-view.c (glade_project_view_create_widget):
|
||||
|
||||
2001-09-03 Chema Celorio <chema@celorio.com>
|
||||
|
||||
* src/glade.h: add new xml tags
|
||||
|
||||
* src/glade-xml-utils.h: standarize a lot of the calls to xml-utils and rename all the
|
||||
calling funcitions to the new names
|
||||
|
||||
* src/glade-widget.c (glade_widget_new): add a project parameter needed for loading
|
||||
objects.
|
||||
(glade_widget_create_gtk_widget): only call the widget resize when the object is an
|
||||
actual widget (v.s. beeing an object like a gtkadjustment)
|
||||
|
||||
* src/glade-widget-class.c (glade_widget_class_set_type): call get_type_from_name
|
||||
and move the code to get the type there
|
||||
(glade_widget_class_load_packing_properties_from_node): impl.
|
||||
(glade_widget_class_load_packing_properties): impl.
|
||||
|
||||
* src/glade-utils.c (glade_util_get_type_from_name): move here
|
||||
|
||||
* src/glade-property.c (glade_property_new_from_class): set property->child for
|
||||
type = _TYPE_OBJECT
|
||||
(glade_property_set_enum): s/choice/enum
|
||||
|
||||
* src/glade-packing.c (glade_packing_add_properties_from_list): add packing
|
||||
properties too
|
||||
(glade_packing_property_get_from_class): impl.
|
||||
|
||||
* src/glade-gtk.c (glade_gtk_button_set_stock): implement stock buttons
|
||||
|
||||
* src/glade-editor.c (glade_editor_property_changed_enum): s/choice/enum
|
||||
|
||||
* src/glade-choice.c (glade_enum_from_string): add a temp entry
|
||||
for gtk-ok, glade-none and gtk-cancel.
|
||||
(glade_choice_list_new_from_node): change the XML tag name to ENUMS
|
||||
from CHOICE
|
||||
|
||||
* src/glade-catalog.h: add prototype for glade_catalog_get
|
||||
|
||||
* src/glade-catalog.c (glade_catalog_get): impl.
|
||||
(glade_catalog_load): after loading all the widgets load the
|
||||
packing properties.
|
||||
|
||||
2001-08-29 Chema Celorio <chema@celorio.com>
|
||||
|
||||
* src/glade-widget-class.c (glade_util_get_type_from_name):
|
||||
|
||||
* src/glade-property-class.c (glade_property_class_create_label): Try to
|
||||
add a tooltip for the editor labels, not working yet.
|
||||
|
||||
|
||||
2001-08-29 Carlos Perelló Marín <carlos@gnome-db.org>
|
||||
|
||||
* autogen.sh:
|
||||
@ -12,6 +66,7 @@
|
||||
2001-08-28 Chema Celorio <chema@celorio.com>
|
||||
|
||||
* src/glade-placeholder.c (glade_placeholder_add_with_result): rewrite
|
||||
(glade_placeholder_is): impl.
|
||||
|
||||
* src/glade-widget-class.c (glade_widget_class_is): impl.
|
||||
|
||||
|
17
TODO
17
TODO
@ -14,14 +14,13 @@ TODO
|
||||
OPEN ITEMS [PLease let me know before starting working on any of this]
|
||||
----------
|
||||
- Implement file opened history feature.
|
||||
- Implement gtk stock buttons.
|
||||
- gtklabels can't be selected. This looks like a fun thing and maybe tricky
|
||||
to fix. I am guessing that gtklabeles don't like the idea of disabling
|
||||
double buffering because of pango, but this is just a guess.
|
||||
- Implement show clipboard (blocks on copy/cut)
|
||||
- Implement the menu bar widget and the menu editor.
|
||||
- Implement the glade-property type "File". For example to be used with a pixmap
|
||||
that specifies a file.
|
||||
that specifies a file.
|
||||
- The tree view does not remember if the "leafs" are opened or closed
|
||||
when switching between projects, or when reconstructing it. The tree view
|
||||
should remember the states of the leafs. Some of this functionality might
|
||||
@ -63,6 +62,8 @@ DONE [just as a reference]
|
||||
This does not allow checkbuttons to be set/unset or buttons to be pressed.
|
||||
- Fix multiple lines GladeEditor text entries. See glade-editor.c,
|
||||
function : glade_editor_create_input_text.
|
||||
- Implement gtk stock buttons.
|
||||
|
||||
(Shane)
|
||||
- Signal editor
|
||||
- Implement the popup menu option "Select", it needs to create submenus for
|
||||
@ -73,3 +74,15 @@ function : glade_editor_create_input_text.
|
||||
NOT YET (Items that we need to do, but are not a priority right now)
|
||||
-------
|
||||
- Implement the custom widget
|
||||
|
||||
Problems found with the gtk-spin button
|
||||
- Does not emit a click up, click down signal
|
||||
- If you change the max or min of the adjustment and emit an adjustment
|
||||
changed signal it does not evaluates if the current value is inside the range
|
||||
- The inability to be used wihtout an adjustment (clock)
|
||||
|
||||
discuss with jamesh
|
||||
- How are we going to save pixmaps
|
||||
- How are we going to save custom widgets
|
||||
- How are we going to save gtkadjusments of gtkspinbuttons
|
||||
- How are we going to save entry properties for a gtk_combo
|
@ -30,12 +30,14 @@ AM_GLIB_GNU_GETTEXT
|
||||
dnl
|
||||
dnl Start of pkg-config checks
|
||||
dnl
|
||||
PKG_CHECK_MODULES(GLADE, gtk+-2.0 >= 1.3.7 libxml-2.0 >= 2.3.10 libgnomeui-2.0 >= 1.96.88)
|
||||
dnl PKG_CHECK_MODULES(GLADE, gtk+-2.0 >= 1.3.7 libxml-2.0 >= 2.3.10 libgnomeui-2.0 >= 1.96.88)
|
||||
PKG_CHECK_MODULES(GLADE, gtk+-2.0 >= 1.3.7 libxml-2.0 >= 2.3.10)
|
||||
GLADE_LIBS="${GLADE_LIBS}"
|
||||
AC_SUBST(GLADE_LIBS)
|
||||
AC_SUBST(GLADE_CFLAGS)
|
||||
|
||||
AC_CHECK_LIB(popt, poptStrippedArgv,, AC_MSG_ERROR([popt 1.5 or newer is required to build
|
||||
gnome-libs. You can download the latest version from ftp://people.redhat.com/sopwith/popt/]))
|
||||
glade2. You can download the latest version from ftp://people.redhat.com/sopwith/popt/]))
|
||||
|
||||
|
||||
dnl ================================================================
|
||||
|
@ -14,7 +14,7 @@ INCLUDES = \
|
||||
-DGLADE_LOCALEDIR=\""$(datadir)/locale"\" \
|
||||
-DG_LOG_DOMAIN=\"Glade\"
|
||||
|
||||
CFLAGS = -g -O2 -Wall
|
||||
CFLAGS = -g -O2 -Wall
|
||||
|
||||
glade2_LDADD = \
|
||||
$(GLADE_LIBS)
|
||||
|
@ -28,6 +28,14 @@
|
||||
#include "glade-catalog.h"
|
||||
#include "glade-widget-class.h"
|
||||
|
||||
GladeCatalog *glade_catalog = NULL;
|
||||
|
||||
GladeCatalog *
|
||||
glade_catalog_get (void)
|
||||
{
|
||||
return glade_catalog;
|
||||
}
|
||||
|
||||
static GladeCatalog *
|
||||
glade_catalog_new (void)
|
||||
{
|
||||
@ -119,6 +127,15 @@ glade_catalog_load (void)
|
||||
|
||||
catalog->widgets = g_list_reverse (new_list);
|
||||
|
||||
glade_catalog = catalog;
|
||||
|
||||
list = catalog->widgets;
|
||||
for (; list != NULL; list = list->next) {
|
||||
class = list->data;
|
||||
glade_widget_class_load_packing_properties (class);
|
||||
}
|
||||
|
||||
|
||||
return catalog;
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ struct _GladeCatalog
|
||||
};
|
||||
|
||||
GladeCatalog * glade_catalog_load (void);
|
||||
GladeCatalog * glade_catalog_get (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -72,6 +72,14 @@ glade_enum_from_string (const gchar *string)
|
||||
return GTK_RELIEF_HALF;
|
||||
if (strcmp (string, "GTK_RELIEF_NONE") == 0)
|
||||
return GTK_RELIEF_NONE;
|
||||
if (strcmp (string, "glade-none") == 0)
|
||||
return 0;
|
||||
if (strcmp (string, "gtk-ok") == 0)
|
||||
return 1;
|
||||
if (strcmp (string, "gtk-cancel") == 0)
|
||||
return 2;
|
||||
|
||||
g_print ("Could not get Enum from string %s\n", string);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -83,13 +91,16 @@ glade_string_from_string (const gchar *string)
|
||||
|
||||
if (strcmp (string, "-") == 0)
|
||||
return "None";
|
||||
#if 0 /* Add the gtk stock buttons list here. Gtk takes care of stock
|
||||
#if 1 /* Add the gtk stock buttons list here. Gtk takes care of stock
|
||||
* items now
|
||||
*/
|
||||
if (strcmp (string, "GNOME_STOCK_BUTTON_OK") == 0)
|
||||
return GNOME_STOCK_BUTTON_OK;
|
||||
if (strcmp (string, "GNOME_STOCK_BUTTON_CANCEL") == 0)
|
||||
return GNOME_STOCK_BUTTON_CANCEL;
|
||||
if (strcmp (string, "GTK_STOCK_OK") == 0)
|
||||
return GTK_STOCK_OK;
|
||||
if (strcmp (string, "GTK_STOCK_CANCEL") == 0)
|
||||
return GTK_STOCK_CANCEL;
|
||||
#endif
|
||||
#if 0
|
||||
|
||||
if (strcmp (string, "GNOME_STOCK_BUTTON_YES") == 0)
|
||||
return GNOME_STOCK_BUTTON_YES;
|
||||
if (strcmp (string, "GNOME_STOCK_BUTTON_NO") == 0)
|
||||
@ -123,17 +134,25 @@ glade_choice_new_from_node (GladeXmlNode *node)
|
||||
{
|
||||
GladeChoice *choice;
|
||||
|
||||
if (!glade_xml_node_verify (node, GLADE_TAG_CHOICE))
|
||||
if (!glade_xml_node_verify (node, GLADE_TAG_ENUM))
|
||||
return NULL;
|
||||
|
||||
choice = glade_choice_new ();
|
||||
choice->name = glade_xml_get_value_string_required (node, GLADE_TAG_NAME, NULL);
|
||||
choice->symbol = glade_xml_get_value_string_required (node, GLADE_TAG_SYMBOL, NULL);
|
||||
choice->value = glade_enum_from_string (choice->symbol);
|
||||
choice->name = glade_xml_get_property_string_required (node, GLADE_TAG_NAME, NULL);
|
||||
choice->id = glade_xml_get_property_string_required (node, GLADE_TAG_ID, NULL);
|
||||
#if 0
|
||||
choice->symbol = glade_xml_get_property_string_required (node, GLADE_TAG_SYMBOL, NULL);
|
||||
#endif
|
||||
choice->value = glade_enum_from_string (choice->id);
|
||||
#if 0
|
||||
if (choice->value == -1)
|
||||
choice->string = glade_string_from_string (choice->symbol);
|
||||
choice->string = glade_string_from_string (choice->id);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if ((choice->value == -1 && choice->string == NULL) || !choice->name) {
|
||||
#endif
|
||||
if (!choice->name) {
|
||||
g_warning ("Could not create Choice from node");
|
||||
return NULL;
|
||||
}
|
||||
@ -148,14 +167,14 @@ glade_choice_list_new_from_node (GladeXmlNode *node)
|
||||
GladeChoice *choice;
|
||||
GList *list;
|
||||
|
||||
if (!glade_xml_node_verify (node, GLADE_TAG_ENUM))
|
||||
if (!glade_xml_node_verify (node, GLADE_TAG_ENUMS))
|
||||
return NULL;
|
||||
|
||||
list = NULL;
|
||||
child = glade_xml_node_get_children (node);
|
||||
|
||||
for (; child != NULL; child = glade_xml_node_next (child)) {
|
||||
if (!glade_xml_node_verify (child, GLADE_TAG_CHOICE))
|
||||
if (!glade_xml_node_verify (child, GLADE_TAG_ENUM))
|
||||
return NULL;
|
||||
choice = glade_choice_new_from_node (child);
|
||||
if (choice == NULL)
|
||||
|
@ -26,26 +26,32 @@ G_BEGIN_DECLS
|
||||
|
||||
*/
|
||||
struct _GladeChoice {
|
||||
GType type;
|
||||
|
||||
gchar *name; /* Name of the choice to be used in the gui. This
|
||||
* field is translated. Like "Top Level" or "Ok"
|
||||
* (for GTK_WINDOW_TOPLEVEL & GNOME_STOCK_BUTTON_OK
|
||||
*/
|
||||
gchar *id;
|
||||
#if 0
|
||||
gchar *symbol; /* Symbol for the choice. Like GTK_WINDOW_TOPLEVEL (which
|
||||
* is an integer) or GNOME_STOCK_BUTTON_FOO (which is
|
||||
* not an integer). For integers which are enum'ed values
|
||||
* this symbol is converted to its value
|
||||
*/
|
||||
#endif
|
||||
|
||||
gint value; /* The enum value of the symbol. The symbol GTK_WINDOW_
|
||||
* TOPLEVEL will be 0 and GTK_WINDOW_POPUP will be 1
|
||||
*/
|
||||
|
||||
#if 0
|
||||
const gchar *string; /* For non-integer values like GNOME_STOCK_BUTTON_OK
|
||||
* it points to a string inside the librarry that
|
||||
* it points to a string inside the library that
|
||||
* contains it.
|
||||
* See glade-choice.c#glade_string_from_sring
|
||||
*/
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -278,7 +278,7 @@ glade_editor_property_changed_text_view (GtkTextBuffer *buffer,
|
||||
}
|
||||
|
||||
static void
|
||||
glade_editor_property_changed_choice (GtkWidget *menu_item,
|
||||
glade_editor_property_changed_enum (GtkWidget *menu_item,
|
||||
GladeEditorProperty *property)
|
||||
{
|
||||
GladeChoice *choice;
|
||||
@ -289,10 +289,10 @@ glade_editor_property_changed_choice (GtkWidget *menu_item,
|
||||
return;
|
||||
|
||||
choice = gtk_object_get_data (GTK_OBJECT (menu_item),
|
||||
GLADE_CHOICE_DATA_TAG);
|
||||
GLADE_ENUM_DATA_TAG);
|
||||
g_return_if_fail (choice != NULL);
|
||||
|
||||
glade_property_set_choice (property->property, choice);
|
||||
glade_property_set_enum (property->property, choice);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -343,6 +343,7 @@ glade_editor_property_changed_numeric (GtkWidget *spin,
|
||||
gint integer_val;
|
||||
|
||||
g_return_if_fail (property != NULL);
|
||||
g_return_if_fail (property->property != NULL);
|
||||
|
||||
if (property->property->loading)
|
||||
return;
|
||||
@ -400,8 +401,8 @@ glade_editor_property_changed_boolean (GtkWidget *button,
|
||||
|
||||
/* ================================ Create inputs ==================================== */
|
||||
static GtkWidget *
|
||||
glade_editor_create_input_choice_item (GladeEditorProperty *property,
|
||||
GladeChoice *choice)
|
||||
glade_editor_create_input_enum_item (GladeEditorProperty *property,
|
||||
GladeChoice *choice)
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
const gchar *name;
|
||||
@ -410,15 +411,15 @@ glade_editor_create_input_choice_item (GladeEditorProperty *property,
|
||||
menu_item = gtk_menu_item_new_with_label (name);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
|
||||
GTK_SIGNAL_FUNC (glade_editor_property_changed_choice), property);
|
||||
GTK_SIGNAL_FUNC (glade_editor_property_changed_enum), property);
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (menu_item), GLADE_CHOICE_DATA_TAG, choice);
|
||||
gtk_object_set_data (GTK_OBJECT (menu_item), GLADE_ENUM_DATA_TAG, choice);
|
||||
|
||||
return menu_item;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
glade_editor_create_input_choice (GladeEditorProperty *property)
|
||||
glade_editor_create_input_enum (GladeEditorProperty *property)
|
||||
{
|
||||
GladeChoice *choice;
|
||||
GtkWidget *menu_item;
|
||||
@ -432,7 +433,7 @@ glade_editor_create_input_choice (GladeEditorProperty *property)
|
||||
menu = gtk_menu_new ();
|
||||
for (; list != NULL; list = list->next) {
|
||||
choice = (GladeChoice *)list->data;
|
||||
menu_item = glade_editor_create_input_choice_item (property, choice);
|
||||
menu_item = glade_editor_create_input_enum_item (property, choice);
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
|
||||
}
|
||||
@ -598,7 +599,7 @@ glade_editor_append_item_real (GladeEditorTable *table, GladeEditorProperty *pro
|
||||
input = glade_editor_create_input_text (property);
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_ENUM:
|
||||
input = glade_editor_create_input_choice (property);
|
||||
input = glade_editor_create_input_enum (property);
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_OTHER_WIDGETS:
|
||||
g_warning ("The widget type %s does not have an input implemented\n",
|
||||
@ -928,6 +929,8 @@ glade_editor_property_load_integer (GladeEditorProperty *property)
|
||||
|
||||
if (property->property->value->g_type == G_TYPE_INT)
|
||||
val = (gfloat) g_value_get_int (property->property->value);
|
||||
else if (property->property->value->g_type == G_TYPE_DOUBLE)
|
||||
val = (gfloat) g_value_get_double (property->property->value);
|
||||
else
|
||||
val = g_value_get_float (property->property->value);
|
||||
|
||||
@ -959,9 +962,8 @@ glade_editor_property_load_double (GladeEditorProperty *property)
|
||||
|
||||
|
||||
static void
|
||||
glade_editor_property_load_choice (GladeEditorProperty *property)
|
||||
glade_editor_property_load_enum (GladeEditorProperty *property)
|
||||
{
|
||||
#if 0
|
||||
GladePropertyClass *pclass;
|
||||
GladeChoice *choice;
|
||||
GList *list;
|
||||
@ -976,8 +978,9 @@ glade_editor_property_load_choice (GladeEditorProperty *property)
|
||||
|
||||
list = pclass->choices;
|
||||
for (; list != NULL; list = list->next) {
|
||||
gint value = g_value_get_enum (property->property->value);
|
||||
choice = (GladeChoice *)list->data;
|
||||
if (strcmp (choice->symbol, property->property->value) == 0)
|
||||
if (choice->value == value)
|
||||
break;
|
||||
idx ++;
|
||||
}
|
||||
@ -992,7 +995,6 @@ glade_editor_property_load_choice (GladeEditorProperty *property)
|
||||
GtkMenuItem *menu_item = list->data;
|
||||
gtk_object_set_user_data (GTK_OBJECT (menu_item), property);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1072,15 +1074,17 @@ glade_editor_property_load_text (GladeEditorProperty *property)
|
||||
static void glade_editor_property_load (GladeEditorProperty *property, GladeWidget *widget);
|
||||
|
||||
static void
|
||||
glade_editor_property_load_object (GladeEditorProperty *property)
|
||||
glade_editor_property_load_object (GladeEditorProperty *property, GladeWidget *widget)
|
||||
{
|
||||
GladeEditorProperty *child;
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (property != NULL);
|
||||
|
||||
list = property->children;
|
||||
for (; list != NULL; list = list->next) {
|
||||
child = list->data;
|
||||
glade_editor_property_load (child, property->property->widget);
|
||||
glade_editor_property_load (child, widget);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1093,6 +1097,11 @@ glade_editor_property_load (GladeEditorProperty *property, GladeWidget *widget)
|
||||
g_return_if_fail (GLADE_IS_EDITOR_PROPERTY (property));
|
||||
g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property->class));
|
||||
|
||||
if (class->type == GLADE_PROPERTY_TYPE_OBJECT) {
|
||||
glade_editor_property_load_object (property, widget);
|
||||
return;
|
||||
}
|
||||
|
||||
property->property = glade_widget_get_property_from_class (widget, class);
|
||||
|
||||
g_return_if_fail (property->property != NULL);
|
||||
@ -1117,17 +1126,18 @@ glade_editor_property_load (GladeEditorProperty *property, GladeWidget *widget)
|
||||
glade_editor_property_load_integer (property);
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_ENUM:
|
||||
glade_editor_property_load_choice (property);
|
||||
glade_editor_property_load_enum (property);
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_OTHER_WIDGETS:
|
||||
glade_editor_property_load_other_widgets (property);
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_OBJECT:
|
||||
glade_editor_property_load_object (property);
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_ERROR:
|
||||
g_warning ("%s : type %i not implemented\n", __FUNCTION__,
|
||||
class->type);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
glade_editor_property_set_tooltips (property);
|
||||
@ -1244,6 +1254,10 @@ glade_editor_load_item (GladeEditor *editor, GladeWidget *item)
|
||||
for (; list != NULL; list = list->next) {
|
||||
property = list->data;
|
||||
glade_editor_property_load (property, item);
|
||||
|
||||
if (property->class->type == GLADE_PROPERTY_TYPE_OBJECT)
|
||||
continue;
|
||||
|
||||
glade_editor_property_connect_signals (property, item);
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,11 @@
|
||||
|
||||
#include "glade.h"
|
||||
#include "glade-widget.h"
|
||||
#include "glade-widget-class.h"
|
||||
#include "glade-placeholder.h"
|
||||
#include "glade-property.h"
|
||||
#include "glade-property-class.h"
|
||||
#include "glade-choice.h"
|
||||
|
||||
static gint
|
||||
glade_widget_ugly_hack (gpointer data)
|
||||
@ -144,6 +147,8 @@ glade_gtk_adjustment_set_min (GObject *object, GValue *value)
|
||||
|
||||
adjustment->lower = g_value_get_float (value);
|
||||
gtk_adjustment_changed (adjustment);
|
||||
|
||||
g_print ("Set min !!\n");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -364,6 +369,71 @@ glade_gtk_table_set_n_columns (GObject *object, GValue *value)
|
||||
glade_gtk_table_set_n_common (object, value, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_gtk_button_set_stock (GObject *object, GValue *value)
|
||||
{
|
||||
GladeWidget *glade_widget;
|
||||
GtkWidget *button;
|
||||
GtkStockItem item;
|
||||
GladeChoice *choice = NULL;
|
||||
GladeProperty *property;
|
||||
GladeProperty *text;
|
||||
GList *list;
|
||||
gint val;
|
||||
|
||||
val = g_value_get_enum (value);
|
||||
|
||||
button = GTK_WIDGET (object);
|
||||
g_return_if_fail (GTK_IS_BUTTON (button));
|
||||
glade_widget = glade_widget_get_from_gtk_widget (button);
|
||||
g_return_if_fail (glade_widget != NULL);
|
||||
|
||||
property = glade_property_get_from_id (glade_widget->properties,
|
||||
"stock");
|
||||
text = glade_property_get_from_id (glade_widget->properties,
|
||||
"label");
|
||||
|
||||
g_return_if_fail (property != NULL);
|
||||
g_return_if_fail (text != NULL);
|
||||
|
||||
list = property->class->choices;
|
||||
for (; list; list = list->next) {
|
||||
choice = list->data;
|
||||
if (val == choice->value)
|
||||
break;
|
||||
}
|
||||
g_return_if_fail (list != NULL);
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (button),
|
||||
GTK_BIN (button)->child);
|
||||
|
||||
if (!gtk_stock_lookup (choice->id, &item))
|
||||
{
|
||||
GtkWidget *label;
|
||||
|
||||
label = gtk_label_new (g_value_get_string (text->value));
|
||||
gtk_container_add (GTK_CONTAINER (button), label);
|
||||
gtk_widget_show_all (button);
|
||||
} else {
|
||||
GtkWidget *label;
|
||||
GtkWidget *image;
|
||||
GtkWidget *hbox;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 1);
|
||||
label = gtk_label_new_with_mnemonic (item.label);
|
||||
image = gtk_image_new_from_stock (choice->id,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label),
|
||||
button);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), label, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (button), hbox);
|
||||
|
||||
gtk_widget_show_all (button);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
empty (GObject *object, GValue *value)
|
||||
@ -438,6 +508,8 @@ GladeGtkFunction functions [] = {
|
||||
{"glade_gtk_box_get_size", glade_gtk_box_get_size},
|
||||
{"glade_gtk_widget_get_tooltip", empty},
|
||||
|
||||
{"glade_gtk_button_set_stock", glade_gtk_button_set_stock},
|
||||
|
||||
#if 0
|
||||
{"glade_gtk_table_get_n_rows", glade_gtk_table_get_n_rows},
|
||||
{"glade_gtk_table_get_n_columns", glade_gtk_table_get_n_columns},
|
||||
|
@ -923,6 +923,7 @@ glade_packing_init (void)
|
||||
gint num;
|
||||
gint i;
|
||||
|
||||
|
||||
num = sizeof (table_props) / sizeof (GladePackingProperty);
|
||||
for (i = 0; i < num; i++)
|
||||
glade_packing_add_property (&table_properties, table_props[i]);
|
||||
@ -947,14 +948,29 @@ static void
|
||||
glade_packing_add_properties_from_list (GladeWidget *widget,
|
||||
GList *list)
|
||||
{
|
||||
GladePackingProperties *packing_properties;
|
||||
GladePropertyClass *class;
|
||||
GladeProperty *property;
|
||||
|
||||
packing_properties = glade_packing_property_get_from_class (widget->class,
|
||||
widget->parent->class);
|
||||
for (; list != NULL; list = list->next) {
|
||||
class = list->data;
|
||||
property = glade_property_new_from_class (class, widget);
|
||||
property->widget = widget;
|
||||
widget->properties = g_list_append (widget->properties, property);
|
||||
|
||||
if (packing_properties) {
|
||||
GValue *gvalue;
|
||||
const gchar *value;
|
||||
value = g_hash_table_lookup (packing_properties->properties,
|
||||
property->class->id);
|
||||
if (value) {
|
||||
gvalue = glade_property_class_make_gvalue_from_string (property->class->type, value);
|
||||
g_free (property->value);
|
||||
property->value = gvalue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -975,7 +991,7 @@ glade_packing_add_properties (GladeWidget *widget)
|
||||
|
||||
if (widget->parent == NULL)
|
||||
return;
|
||||
class = widget->parent->class->name;
|
||||
class = widget->parent->class->name;
|
||||
|
||||
if (strcmp (class, "GtkTable") == 0)
|
||||
glade_packing_add_properties_from_list (widget, table_properties);
|
||||
@ -985,3 +1001,23 @@ glade_packing_add_properties (GladeWidget *widget)
|
||||
glade_packing_add_properties_from_list (widget, box_properties);
|
||||
|
||||
}
|
||||
|
||||
|
||||
GladePackingProperties *
|
||||
glade_packing_property_get_from_class (GladeWidgetClass *class,
|
||||
GladeWidgetClass *container_class)
|
||||
{
|
||||
GladePackingProperties *property = NULL;
|
||||
GList *list;
|
||||
|
||||
list = class->packing_properties;
|
||||
for (; list; list = list->next) {
|
||||
property = list->data;
|
||||
if (property->container_class == container_class)
|
||||
break;
|
||||
}
|
||||
if (list == NULL)
|
||||
return NULL;
|
||||
|
||||
return property;
|
||||
}
|
||||
|
@ -4,8 +4,17 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GladePackingProperties GladePackingProperties;
|
||||
|
||||
struct _GladePackingProperties {
|
||||
GladeWidgetClass *container_class;
|
||||
GHashTable *properties; /* Contains a gvalue */
|
||||
};
|
||||
|
||||
void glade_packing_init (void);
|
||||
void glade_packing_add_properties (GladeWidget *widget);
|
||||
GladePackingProperties * glade_packing_property_get_from_class (GladeWidgetClass *class,
|
||||
GladeWidgetClass *container_class);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -38,6 +38,7 @@
|
||||
#define GLADE_PLACEHOLDER_COL_STRING "GladePlaceholderColumn"
|
||||
#define GLADE_PLACEHOLDER_PARENT_DATA "GladePlaceholderParentData"
|
||||
#define GLADE_PLACEHOLDER_IS_DATA "GladeIsPlaceholderData"
|
||||
|
||||
static void
|
||||
glade_placeholder_replace_box (GtkWidget *current,
|
||||
GtkWidget *new,
|
||||
@ -344,99 +345,6 @@ glade_placeholder_new (GladeWidget *parent)
|
||||
|
||||
#undef GLADE_PLACEHOLDER_SIZE
|
||||
|
||||
|
||||
/* This function is no longer used. We add a placholder to all the containers
|
||||
* then when we apply the properties, the size property will add the containers
|
||||
* for us. Chema
|
||||
*/
|
||||
#if 0
|
||||
void
|
||||
glade_placeholder_add (GladeWidgetClass *class,
|
||||
GladeWidget *widget,
|
||||
gint rows, gint columns)
|
||||
{
|
||||
GladePlaceholder *placeholder;
|
||||
|
||||
g_return_if_fail (class != NULL);
|
||||
g_return_if_fail (widget != NULL);
|
||||
|
||||
if (GLADE_WIDGET_CLASS_TOPLEVEL (class)) {
|
||||
placeholder = glade_placeholder_new (widget);
|
||||
gtk_container_add (GTK_CONTAINER (widget->widget), GTK_WIDGET (placeholder));
|
||||
return;
|
||||
}
|
||||
|
||||
if (glade_widget_class_is (class, "GtkFrame") ||
|
||||
glade_widget_class_is (class, "GtkHandleBox")) {
|
||||
placeholder = glade_placeholder_new (widget);
|
||||
gtk_container_add (GTK_CONTAINER (widget->widget),
|
||||
placeholder);
|
||||
return;
|
||||
}
|
||||
|
||||
if (glade_widget_class_is (class, "GtkVBox") ||
|
||||
glade_widget_class_is (class, "GtkHBox")) {
|
||||
#if 0
|
||||
g_print ("Deprecated !!\n");
|
||||
#endif
|
||||
return;
|
||||
/* This function shuold not exist */
|
||||
/* Because we just set the property of size to a value
|
||||
* the set_size function for boxes will take care of
|
||||
* adding the new widgets ( I think ? ;-), but can't
|
||||
* remeber with detail.
|
||||
*
|
||||
* Chema.
|
||||
*/
|
||||
}
|
||||
|
||||
if (glade_widget_class_is (class, "GtkTable")) {
|
||||
gint row, col;
|
||||
gint n_rows = rows, n_cols = columns;
|
||||
|
||||
for (row = 0; row < n_rows; row++) {
|
||||
for (col = 0; col < n_cols; col++) {
|
||||
placeholder = glade_placeholder_new (widget);
|
||||
gtk_table_attach (GTK_TABLE (widget->widget),
|
||||
GTK_WIDGET (placeholder),
|
||||
col, col+1,
|
||||
row, row+1,
|
||||
GTK_EXPAND | GTK_FILL,
|
||||
GTK_EXPAND | GTK_FILL,
|
||||
0, 0);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (glade_widget_class_is (class, "GtkNotebook")) {
|
||||
GladeWidgetClass *label_class;
|
||||
GladeWidget *label;
|
||||
gint page;
|
||||
gint pages = rows;
|
||||
|
||||
label_class = glade_widget_class_get_by_name ("GtkLabel");
|
||||
g_return_if_fail (label_class != NULL);
|
||||
|
||||
for (page = 0; page < pages; page++) {
|
||||
label = glade_widget_new_from_class_name ("GtkLabel",
|
||||
widget);
|
||||
g_return_if_fail (GTK_IS_WIDGET (label->widget));
|
||||
placeholder = glade_placeholder_new (widget);
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (widget->widget),
|
||||
placeholder,
|
||||
label->widget);
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
g_warning ("A new container was cretated but there isn't any code to add a placeholder "
|
||||
"for this class (%s)", class->name);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
glade_placeholder_add_with_result (GladeWidgetClass *class,
|
||||
GladeWidget *widget,
|
||||
@ -459,38 +367,6 @@ glade_placeholder_add_with_result (GladeWidgetClass *class,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
GladeProperty *property;
|
||||
|
||||
if (glade_widget_class_is (class, "GtkVBox") ||
|
||||
glade_widget_class_is (class, "GtkHBox")) {
|
||||
gint size;
|
||||
glade_property_query_result_get_int (result, "size", &size);
|
||||
property = glade_property_get_from_id (widget->properties,
|
||||
"size");
|
||||
glade_property_set_integer (property, size);
|
||||
}
|
||||
|
||||
if (glade_widget_class_is (class, "GtkTable")) {
|
||||
gint rows;
|
||||
gint columns;
|
||||
glade_property_query_result_get_int (result, "n-rows", &rows);
|
||||
property = glade_property_get_from_id (widget->properties, "n-rows");
|
||||
glade_property_set_integer (property, rows);
|
||||
|
||||
glade_property_query_result_get_int (result, "n-columns", &columns);
|
||||
property = glade_property_get_from_id (widget->properties, "n-columns");
|
||||
glade_property_set_integer (property, columns);
|
||||
}
|
||||
|
||||
if (glade_widget_class_is (class, "GtkNotebook")) {
|
||||
gint pages;
|
||||
glade_property_query_result_get_int (result, "pages", &pages);
|
||||
/* FIXME . Set integer of property */
|
||||
}
|
||||
#endif
|
||||
|
||||
if (GLADE_WIDGET_CLASS_TOPLEVEL (class)) {
|
||||
GladePlaceholder *placeholder;
|
||||
placeholder = glade_placeholder_new (widget);
|
||||
@ -534,10 +410,6 @@ glade_placeholder_get_from_properties (GladeWidget *parent,
|
||||
GladePlaceholder *placeholder = NULL;
|
||||
GList *list;
|
||||
|
||||
#if 0
|
||||
g_print ("Parent Class is %s\n", parent->class->name);
|
||||
#endif
|
||||
|
||||
if (glade_widget_class_is (parent->class, "GtkVBox") ||
|
||||
glade_widget_class_is (parent->class, "GtkHBox")) {
|
||||
GtkBoxChild *box_child;
|
||||
@ -547,14 +419,11 @@ glade_placeholder_get_from_properties (GladeWidget *parent,
|
||||
box_child = (GtkBoxChild *) g_list_nth (list, atoi (val));
|
||||
placeholder = box_child->widget;
|
||||
g_assert (placeholder);
|
||||
#if 0
|
||||
if (!placeholder && list)
|
||||
placeholder = ((GtkBoxChild *)list->data)->widget;
|
||||
#endif
|
||||
} else if (glade_widget_class_is (parent->class, "GtkTable")) {
|
||||
GtkTableChild *child;
|
||||
gint col = atoi (g_hash_table_lookup (properties, "cell_x"));
|
||||
gint row = atoi (g_hash_table_lookup (properties, "cell_y"));
|
||||
|
||||
list = GTK_TABLE (parent->widget)->children;
|
||||
for (; list; list = list->next) {
|
||||
child = list->data;
|
||||
@ -564,15 +433,6 @@ glade_placeholder_get_from_properties (GladeWidget *parent,
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_assert_not_reached ();
|
||||
#if 0
|
||||
/* Get the first free placeholder */
|
||||
/* Should this be an error ? */
|
||||
if (!placeholder && list) {
|
||||
g_print ("Not found \n");
|
||||
placeholder = ((GtkTableChild *)list->data)->widget;
|
||||
}
|
||||
#endif
|
||||
} else if (glade_widget_class_is (parent->class, "GtkWindow")) {
|
||||
placeholder = NULL;
|
||||
} else {
|
||||
|
@ -427,7 +427,6 @@ glade_project_view_button_press_cb (GtkTreeView *view, GdkEventButton *event)
|
||||
GtkTreeIter iter;
|
||||
GladeWidget *widget;
|
||||
|
||||
g_print ("Double click\n");
|
||||
if (!gtk_tree_view_get_path_at_pos (view,
|
||||
event->window,
|
||||
event->x, event->y,
|
||||
@ -476,9 +475,6 @@ glade_project_view_create_widget (GladeProjectView *view)
|
||||
gtk_tree_view_column_set_cell_data_func (column, cell, glade_project_view_cell_function, NULL, NULL);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column);
|
||||
|
||||
gtk_object_unref (GTK_OBJECT (column));
|
||||
gtk_object_unref (GTK_OBJECT (cell));
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
|
||||
g_signal_connect_data (G_OBJECT (selection),
|
||||
"changed", GTK_SIGNAL_FUNC (glade_project_view_selection_changed_cb),
|
||||
|
@ -321,9 +321,8 @@ glade_project_window_new (GladeCatalog *catalog)
|
||||
gpw->add_class = NULL;
|
||||
|
||||
glade_project_window_set_view (gpw, view);
|
||||
|
||||
glade_project_window = gpw;
|
||||
|
||||
glade_project_window = gpw;
|
||||
glade_palette_create (gpw);
|
||||
glade_editor_create (gpw);
|
||||
|
||||
|
@ -405,7 +405,7 @@ glade_project_write_widgets (const GladeProject *project, GladeXmlContext *conte
|
||||
if (GLADE_WIDGET_IS_TOPLEVEL (widget)) {
|
||||
child = glade_widget_write (context, widget);
|
||||
if (child != NULL)
|
||||
glade_xml_append_child (node, child);
|
||||
glade_xml_node_append_child (node, child);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -38,6 +38,16 @@
|
||||
#include <stdlib.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#if 0
|
||||
typedef struct GladePropertyTypeTable {
|
||||
const gchar *xml_tag;
|
||||
GladePropertyType glade_type;
|
||||
GType *g_type;
|
||||
};
|
||||
|
||||
/* #warning Implement me. */
|
||||
#endif
|
||||
|
||||
GladePropertyType
|
||||
glade_property_type_str_to_enum (const gchar *str)
|
||||
{
|
||||
@ -49,7 +59,7 @@ glade_property_type_str_to_enum (const gchar *str)
|
||||
return GLADE_PROPERTY_TYPE_FLOAT;
|
||||
if (strcmp (str, GLADE_TAG_INTEGER) == 0)
|
||||
return GLADE_PROPERTY_TYPE_INTEGER;
|
||||
if (strcmp (str, GLADE_TAG_CHOICE) == 0)
|
||||
if (strcmp (str, GLADE_TAG_ENUM) == 0)
|
||||
return GLADE_PROPERTY_TYPE_ENUM;
|
||||
if (strcmp (str, GLADE_TAG_OTHER_WIDGETS) == 0)
|
||||
return GLADE_PROPERTY_TYPE_OTHER_WIDGETS;
|
||||
@ -129,6 +139,10 @@ glade_property_class_new (void)
|
||||
property_class = g_new0 (GladePropertyClass, 1);
|
||||
property_class->type = GLADE_PROPERTY_TYPE_ERROR;
|
||||
property_class->id = NULL;
|
||||
#if 0
|
||||
g_print ("New property class %d. Id:%d\n",
|
||||
GPOINTER_TO_INT (property_class), GPOINTER_TO_INT (property_class->id));
|
||||
#endif
|
||||
property_class->name = NULL;
|
||||
property_class->tooltip = NULL;
|
||||
property_class->parameters = NULL;
|
||||
@ -198,7 +212,13 @@ glade_property_class_choice_new_from_value (GEnumValue value)
|
||||
|
||||
choice = glade_choice_new ();
|
||||
choice->name = g_strdup (value.value_nick);
|
||||
choice->id = g_strdup (value.value_name);
|
||||
#if 0
|
||||
g_print ("Choice Id is %s\n", choice->id);
|
||||
#endif
|
||||
#if 0
|
||||
choice->symbol = g_strdup (value.value_name);
|
||||
#endif
|
||||
choice->value = value.value;
|
||||
|
||||
return choice;
|
||||
@ -281,9 +301,7 @@ glade_property_class_make_string_from_gvalue (GladePropertyType type,
|
||||
string = g_strdup (g_value_get_string (value));
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_ENUM:
|
||||
#if 0
|
||||
glade_implement_me ();
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
g_warning ("Could not make string from gvalue for type %s\n",
|
||||
@ -324,11 +342,17 @@ glade_property_class_make_gvalue_from_string (GladePropertyType type,
|
||||
g_value_set_string (value, string);
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_ENUM:
|
||||
glade_implement_me ();
|
||||
#if 0
|
||||
g_value_init (value);
|
||||
g_free (value);
|
||||
value = NULL;
|
||||
#endif
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_OBJECT:
|
||||
break;
|
||||
default:
|
||||
g_warning ("Could not make gvalue from string %s and type %s\n",
|
||||
g_warning ("Could not make gvalue from string ->%s<- and type %s\n",
|
||||
string,
|
||||
glade_property_type_enum_to_string (type));
|
||||
g_free (value);
|
||||
@ -349,12 +373,8 @@ glade_property_class_get_default_from_spec (GParamSpec *spec,
|
||||
|
||||
switch (class->type) {
|
||||
case GLADE_PROPERTY_TYPE_ENUM:
|
||||
#if 0
|
||||
g_value_init (value, G_TYPE_ENUM);
|
||||
if (!G_VALUE_HOLDS_ENUM (value))
|
||||
g_print ("Error\n");
|
||||
g_value_init (value, spec->value_type);
|
||||
g_value_set_enum (value, G_PARAM_SPEC_ENUM (spec)->default_value);
|
||||
#endif
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_STRING:
|
||||
g_value_init (value, G_TYPE_STRING);
|
||||
@ -506,8 +526,12 @@ glade_property_class_get_default (GladeXmlNode *node, GladePropertyType type)
|
||||
|
||||
temp = glade_xml_get_property_string (node, GLADE_TAG_DEFAULT);
|
||||
|
||||
if (!temp)
|
||||
if (!temp) {
|
||||
#if 0
|
||||
g_print ("Temp is NULL, we dont' have a default\n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
value = glade_property_class_make_gvalue_from_string (type, temp);
|
||||
|
||||
@ -660,10 +684,10 @@ glade_property_class_new_from_node (GladeXmlNode *node, GladeWidgetClass *widget
|
||||
|
||||
|
||||
/* Will this property go in the common tab ? */
|
||||
property_class->common = glade_xml_property_get_boolean (node, GLADE_TAG_COMMON, FALSE);
|
||||
property_class->optional = glade_xml_property_get_boolean (node, GLADE_TAG_OPTIONAL, FALSE);
|
||||
property_class->common = glade_xml_get_property_boolean (node, GLADE_TAG_COMMON, FALSE);
|
||||
property_class->optional = glade_xml_get_property_boolean (node, GLADE_TAG_OPTIONAL, FALSE);
|
||||
if (property_class->optional) {
|
||||
property_class->optional_default = glade_xml_property_get_boolean (node, GLADE_TAG_OPTIONAL_DEFAULT, FALSE);
|
||||
property_class->optional_default = glade_xml_get_property_boolean (node, GLADE_TAG_OPTIONAL_DEFAULT, FALSE);
|
||||
}
|
||||
|
||||
/* Now get the list of signals that we should listen to */
|
||||
@ -695,7 +719,7 @@ glade_property_class_new_from_node (GladeXmlNode *node, GladeWidgetClass *widget
|
||||
* We can have a property like ... ParamSpec="TRUE">
|
||||
* Or a child like <ParamSpec/>, but this will be deprecated
|
||||
*/
|
||||
if (glade_xml_property_get_boolean (node, GLADE_TAG_PARAM_SPEC, TRUE)) {
|
||||
if (glade_xml_get_property_boolean (node, GLADE_TAG_PARAM_SPEC, TRUE)) {
|
||||
gboolean retval;
|
||||
|
||||
retval = glade_property_class_load_from_param_spec (id, property_class, widget_class, node);
|
||||
@ -735,10 +759,25 @@ glade_property_class_new_from_node (GladeXmlNode *node, GladeWidgetClass *widget
|
||||
|
||||
/* Get the choices */
|
||||
if (property_class->type == GLADE_PROPERTY_TYPE_ENUM) {
|
||||
child = glade_xml_search_child_required (node, GLADE_TAG_ENUM);
|
||||
GValue *gvalue;
|
||||
gchar *type_name;
|
||||
GType type;
|
||||
gchar *default_string;
|
||||
GladeXmlNode *child;
|
||||
child = glade_xml_search_child_required (node, GLADE_TAG_ENUMS);
|
||||
if (child == NULL)
|
||||
return NULL;
|
||||
property_class->choices = glade_choice_list_new_from_node (child);
|
||||
type_name = glade_xml_get_property_string_required (child, "EnumType", NULL);
|
||||
if (type_name == NULL)
|
||||
return NULL;
|
||||
type = g_type_from_name (type_name);
|
||||
g_return_val_if_fail (type != 0, NULL);
|
||||
gvalue = g_new0 (GValue, 1);
|
||||
g_value_init (gvalue, type);
|
||||
default_string = glade_xml_get_property_string (node, GLADE_TAG_DEFAULT);
|
||||
property_class->def = gvalue;
|
||||
return property_class;
|
||||
}
|
||||
|
||||
/* If the property is an object Load it */
|
||||
@ -747,11 +786,10 @@ glade_property_class_new_from_node (GladeXmlNode *node, GladeWidgetClass *widget
|
||||
if (child == NULL)
|
||||
return NULL;
|
||||
property_class->child = glade_widget_class_new_from_node (child);
|
||||
g_print ("Loaded %s\n", property_class->child->name);
|
||||
}
|
||||
|
||||
/* Get the default value */
|
||||
property_class->def = glade_property_class_get_default (node, property_class->type);
|
||||
|
||||
|
||||
return property_class;
|
||||
}
|
||||
@ -849,6 +887,9 @@ glade_property_class_create_label (GladePropertyClass *class)
|
||||
g_free (text);
|
||||
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
|
||||
|
||||
#warning This is not working
|
||||
glade_util_widget_set_tooltip (label, class->tooltip);
|
||||
|
||||
return label;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ typedef enum {
|
||||
</Property>
|
||||
|
||||
|
||||
Choice Type :
|
||||
Enum Type :
|
||||
|
||||
<Property>
|
||||
<Type>Choice</Type>
|
||||
@ -78,6 +78,8 @@ typedef enum {
|
||||
<Parameters>
|
||||
<Parameter Key="Default" Value="GTK_WIN_POS_NONE"/>
|
||||
</Parameters>
|
||||
<Enums>
|
||||
<Enum>String Equiv</Enum>
|
||||
<Choices>
|
||||
<Choice>
|
||||
<Name>None</Name>
|
||||
|
@ -134,6 +134,13 @@ glade_property_new_from_class (GladePropertyClass *class, GladeWidget *widget)
|
||||
|
||||
property->class = class;
|
||||
|
||||
if (class->type == GLADE_PROPERTY_TYPE_OBJECT) {
|
||||
property->child = glade_widget_new_from_class (class->child,
|
||||
widget);
|
||||
return property;
|
||||
}
|
||||
|
||||
/* Create an empty default if the class does not specify a default value */
|
||||
if (!class->def) {
|
||||
property->value = glade_property_class_make_gvalue_from_string (class->type, "");
|
||||
return property;
|
||||
@ -145,49 +152,18 @@ glade_property_new_from_class (GladePropertyClass *class, GladeWidget *widget)
|
||||
case GLADE_PROPERTY_TYPE_FLOAT:
|
||||
property->enabled = class->optional_default;
|
||||
/* Fall thru */
|
||||
case GLADE_PROPERTY_TYPE_ENUM:
|
||||
case GLADE_PROPERTY_TYPE_BOOLEAN:
|
||||
case GLADE_PROPERTY_TYPE_STRING:
|
||||
g_value_init (property->value, class->def->g_type);
|
||||
g_value_copy (class->def, property->value);
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_ENUM:
|
||||
#if 0
|
||||
list = class->choices;
|
||||
if (string != NULL) {
|
||||
for (;list != NULL; list = list->next) {
|
||||
choice = list->data;
|
||||
if (strcmp (choice->symbol, string) == 0)
|
||||
break;
|
||||
}
|
||||
if (list != NULL) {
|
||||
value = g_strdup (string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
list = class->choices;
|
||||
if (list == NULL) {
|
||||
g_warning ("class->choices is NULL. This should not happen\n");
|
||||
value = g_strdup ("ERROR");
|
||||
break;
|
||||
}
|
||||
choice = list->data;
|
||||
g_warning ("Invalid default tag \"%s\" for property \"%s\", setting deafult to %s (%s)",
|
||||
choice->name, class->id,
|
||||
choice->symbol, string);
|
||||
value = g_strdup (choice->symbol);
|
||||
#endif
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_OTHER_WIDGETS:
|
||||
#if 0
|
||||
value = g_strdup ("");
|
||||
#endif
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_OBJECT:
|
||||
#if 0
|
||||
value = NULL;
|
||||
property->child = glade_widget_new_from_class (class->child,
|
||||
widget);
|
||||
#endif
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_ERROR:
|
||||
g_warning ("Invalid Glade property type (%d)\n", class->type);
|
||||
@ -403,14 +379,14 @@ glade_property_set_boolean (GladeProperty *property, gboolean val)
|
||||
}
|
||||
|
||||
void
|
||||
glade_property_set_choice (GladeProperty *property, GladeChoice *choice)
|
||||
glade_property_set_enum (GladeProperty *property, GladeChoice *choice)
|
||||
{
|
||||
#if 0
|
||||
g_return_if_fail (property != NULL);
|
||||
g_return_if_fail (property->value != NULL);
|
||||
g_return_if_fail (choice != NULL);
|
||||
|
||||
g_value_set_enum (property->value, 0);
|
||||
|
||||
g_value_set_enum (property->value, choice->value);
|
||||
|
||||
property->loading = TRUE;
|
||||
if (property->class->set_function == NULL)
|
||||
@ -422,7 +398,6 @@ glade_property_set_choice (GladeProperty *property, GladeChoice *choice)
|
||||
property->loading = FALSE;
|
||||
|
||||
glade_property_emit_changed (property);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -434,8 +409,10 @@ glade_property_set (GladeProperty *property, GValue *value)
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_FLOAT:
|
||||
g_print ("1 %s \n", property->class->name);
|
||||
glade_property_set_float (property,
|
||||
g_value_get_float (value));
|
||||
g_print ("End:1\n");
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_INTEGER:
|
||||
glade_property_set_integer (property,
|
||||
@ -453,7 +430,7 @@ glade_property_set (GladeProperty *property, GValue *value)
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_OBJECT:
|
||||
glade_implement_me ();
|
||||
g_print ("Set adjustment\n");
|
||||
g_print ("Set adjustment ->%d<-\n", GPOINTER_TO_INT (property->child));
|
||||
#if 1
|
||||
g_print ("Set directly \n");
|
||||
#if 0
|
||||
@ -499,7 +476,9 @@ glade_property_get_float (GladeProperty *property)
|
||||
gfloat resp;
|
||||
g_return_val_if_fail (property != NULL, 0.0);
|
||||
g_return_val_if_fail (property->value != NULL, 0.0);
|
||||
|
||||
resp = g_value_get_float (property->value);
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
@ -522,25 +501,24 @@ glade_property_get_boolean (GladeProperty *property)
|
||||
}
|
||||
|
||||
GladeChoice *
|
||||
glade_property_get_choice (GladeProperty *property)
|
||||
glade_property_get_enum (GladeProperty *property)
|
||||
{
|
||||
GladeChoice *choice = NULL;
|
||||
#if 0
|
||||
GList *list;
|
||||
#endif
|
||||
gint value;
|
||||
|
||||
g_return_val_if_fail (property != NULL, NULL);
|
||||
g_return_val_if_fail (property->value != NULL, NULL);
|
||||
#if 0
|
||||
|
||||
value = g_value_get_enum (property->value);
|
||||
list = property->class->choices;
|
||||
for (; list != NULL; list = list->next) {
|
||||
choice = list->data;
|
||||
if (strcmp (choice->symbol, property->value) == 0)
|
||||
if (choice->value == value)
|
||||
break;
|
||||
}
|
||||
if (list == NULL)
|
||||
g_warning ("Cant find the GladePropertyChoice selected\n");
|
||||
#endif
|
||||
|
||||
return choice;
|
||||
}
|
||||
|
@ -79,14 +79,14 @@ void glade_property_set_integer (GladeProperty *property, gint val);
|
||||
void glade_property_set_float (GladeProperty *property, gfloat val);
|
||||
void glade_property_set_double (GladeProperty *property, gdouble val);
|
||||
void glade_property_set_boolean (GladeProperty *property, gboolean val);
|
||||
void glade_property_set_choice (GladeProperty *property, GladeChoice *choice);
|
||||
void glade_property_set_enum (GladeProperty *property, GladeChoice *choice);
|
||||
|
||||
const gchar * glade_property_get_string (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);
|
||||
GladeChoice * glade_property_get_enum (GladeProperty *property);
|
||||
|
||||
|
||||
void glade_property_get_from_widget (GladeProperty *property);
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include <gtk/gtktooltips.h>
|
||||
#include "glade.h"
|
||||
|
||||
#include <gmodule.h>
|
||||
|
||||
|
||||
gboolean
|
||||
@ -44,3 +44,42 @@ glade_util_widget_set_tooltip (GtkWidget *widget, const gchar *str)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
GType
|
||||
glade_util_get_type_from_name (const gchar *name)
|
||||
{
|
||||
static GModule *allsymbols;
|
||||
guint (*get_type) ();
|
||||
GType type;
|
||||
|
||||
if (!allsymbols)
|
||||
allsymbols = g_module_open (NULL, 0);
|
||||
|
||||
if (!g_module_symbol (allsymbols, name,
|
||||
(gpointer) &get_type)) {
|
||||
g_warning (_("We could not find the symbol \"%s\""),
|
||||
name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_assert (get_type);
|
||||
type = get_type ();
|
||||
|
||||
if (type == 0) {
|
||||
g_warning(_("Could not get the type from \"%s"),
|
||||
name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Disabled for GtkAdjustment, but i'd like to check for this somehow. Chema */
|
||||
#if 0
|
||||
if (!g_type_is_a (type, gtk_widget_get_type ())) {
|
||||
g_warning (_("The loaded type is not a GtkWidget, while trying to load \"%s\""),
|
||||
class->name);
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,8 @@ G_BEGIN_DECLS
|
||||
#define glade_implement_me() g_print ("Implement me : %s %d %s\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
gboolean glade_util_path_is_writable (const gchar *full_path);
|
||||
|
||||
void glade_util_widget_set_tooltip (GtkWidget *widget, const gchar *str);
|
||||
void glade_util_widget_set_tooltip (GtkWidget *widget, const gchar *str);
|
||||
GType glade_util_get_type_from_name (const gchar *name);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "glade-choice.h"
|
||||
#include "glade-parameter.h"
|
||||
#include "glade-widget-class.h"
|
||||
#include "glade-packing.h"
|
||||
|
||||
|
||||
static gchar *
|
||||
@ -144,47 +145,25 @@ glade_widget_class_list_signals (GladeWidgetClass *class)
|
||||
static gboolean
|
||||
glade_widget_class_set_type (GladeWidgetClass *class, const gchar *init_function_name)
|
||||
{
|
||||
static GModule *allsymbols;
|
||||
guint (*get_type) ();
|
||||
GType type;
|
||||
|
||||
class->type = 0;
|
||||
|
||||
g_return_val_if_fail (GLADE_IS_WIDGET_CLASS (class), FALSE);
|
||||
g_return_val_if_fail (init_function_name != NULL, FALSE);
|
||||
|
||||
if (!allsymbols)
|
||||
allsymbols = g_module_open (NULL, 0);
|
||||
|
||||
if (!g_module_symbol (allsymbols, init_function_name,
|
||||
(gpointer) &get_type)) {
|
||||
g_warning (_("We could not find the symbol \"%s\" while trying to load \"%s\""),
|
||||
init_function_name, class->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_assert (get_type);
|
||||
type = get_type ();
|
||||
|
||||
if (type == 0) {
|
||||
g_warning(_("Could not get the type from \"%s\" while trying to load \"%s\""),
|
||||
init_function_name, class->name);
|
||||
type = glade_util_get_type_from_name (init_function_name);
|
||||
if (type == 0)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Disabled for GtkAdjustment, but i'd like to check for this somehow. Chema */
|
||||
#if 0
|
||||
if (!g_type_is_a (type, gtk_widget_get_type ())) {
|
||||
g_warning (_("The loaded type is not a GtkWidget, while trying to load \"%s\""),
|
||||
class->name);
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
class->type = type;
|
||||
|
||||
if (type == 0)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
GladeWidgetClass *
|
||||
glade_widget_class_new_from_node (GladeXmlNode *node)
|
||||
@ -290,6 +269,7 @@ glade_widget_class_new_from_name (const gchar *name)
|
||||
return NULL;
|
||||
doc = glade_xml_context_get_doc (context);
|
||||
class = glade_widget_class_new_from_node (glade_xml_doc_get_root (doc));
|
||||
class->xml_file = g_strdup (name);
|
||||
glade_xml_context_free (context);
|
||||
|
||||
if (!glade_widget_class_create_pixmap (class))
|
||||
@ -443,14 +423,15 @@ glade_widget_class_dump_param_specs (GladeWidgetClass *class)
|
||||
GladeWidgetClass *
|
||||
glade_widget_class_get_by_name (const gchar *name)
|
||||
{
|
||||
GladeProjectWindow *gpw;
|
||||
GladeCatalog *catalog;
|
||||
GladeWidgetClass *class;
|
||||
GList *list;
|
||||
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
gpw = glade_project_window_get ();
|
||||
list = gpw->catalog->widgets;
|
||||
catalog = glade_catalog_get ();
|
||||
g_return_val_if_fail (catalog != NULL, NULL);
|
||||
list = catalog->widgets;
|
||||
for (; list != NULL; list = list->next) {
|
||||
class = list->data;
|
||||
g_return_val_if_fail (class->name != NULL, NULL);
|
||||
@ -477,3 +458,73 @@ glade_widget_class_is (GladeWidgetClass *class, const gchar *name)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
glade_widget_class_load_packing_properties_from_node (GladeXmlNode *node,
|
||||
GladeWidgetClass *class)
|
||||
{
|
||||
GladeXmlNode *child;
|
||||
|
||||
if (!glade_xml_node_verify (node, GLADE_TAG_GLADE_WIDGET_CLASS))
|
||||
return;
|
||||
|
||||
child = glade_xml_search_child (node, GLADE_TAG_PACKING_PROPERTIES);
|
||||
if (!child)
|
||||
return;
|
||||
|
||||
child = glade_xml_node_get_children (child);
|
||||
for (; child; child = glade_xml_node_next (child)) {
|
||||
GladePackingProperties *properties;
|
||||
GladeWidgetClass *container_class;
|
||||
GladeXmlNode *child2;
|
||||
GHashTable *hash;
|
||||
gchar *container_name;
|
||||
|
||||
hash = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
child2 = glade_xml_node_get_children (child);
|
||||
for (; child2; child2 = glade_xml_node_next (child2)) {
|
||||
gchar *container_id;
|
||||
gchar *content;
|
||||
|
||||
container_id = glade_xml_get_property_string (child2,
|
||||
GLADE_TAG_ID);
|
||||
content = glade_xml_get_content (child2);
|
||||
g_hash_table_insert (hash, container_id, content);
|
||||
}
|
||||
|
||||
container_name = glade_xml_get_property_string (child,
|
||||
GLADE_TAG_ID);
|
||||
container_class = glade_widget_class_get_by_name (container_name);
|
||||
if (container_class == NULL) {
|
||||
g_warning ("Could not find GladeWidget for %s\n", container_name);
|
||||
return;
|
||||
}
|
||||
g_free (container_name);
|
||||
|
||||
properties = g_new0 (GladePackingProperties, 1);
|
||||
properties->container_class = container_class;
|
||||
properties->properties = hash;
|
||||
class->packing_properties = g_list_prepend (class->packing_properties, properties);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
glade_widget_class_load_packing_properties (GladeWidgetClass *class)
|
||||
{
|
||||
GladeXmlContext *context;
|
||||
GladeXmlDoc *doc;
|
||||
gchar *file_name;
|
||||
|
||||
file_name = g_strconcat (WIDGETS_DIR, "/", class->xml_file, ".xml", NULL);
|
||||
|
||||
context = glade_xml_context_new_from_path (file_name, NULL, GLADE_TAG_GLADE_WIDGET_CLASS);
|
||||
if (context == NULL)
|
||||
return;
|
||||
doc = glade_xml_context_get_doc (context);
|
||||
glade_widget_class_load_packing_properties_from_node (glade_xml_doc_get_root (doc), class);
|
||||
glade_xml_context_free (context);
|
||||
|
||||
g_free (file_name);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ struct _GladeWidgetClass {
|
||||
GType type; /* GType of the widget */
|
||||
|
||||
gchar *name; /* Name of the widget, for example GtkButton */
|
||||
gchar *xml_file; /* Name of the xml file for this type without a path */
|
||||
|
||||
GdkPixmap *pixmap; /* The loaded pixmap for the icon of this widget type */
|
||||
GdkBitmap *mask; /* The mask for the loaded pixmap */
|
||||
@ -53,6 +54,8 @@ struct _GladeWidgetClass {
|
||||
*/
|
||||
|
||||
GList *signals; /* List of GladeWidgetClassSignal objects */
|
||||
|
||||
GList *packing_properties; /* List of Packing GladePackingProperties */
|
||||
|
||||
void (*placeholder_replace) (GtkWidget *current,
|
||||
GtkWidget *new,
|
||||
@ -84,6 +87,9 @@ gboolean glade_widget_class_is (GladeWidgetClass *class, const gchar *name)
|
||||
GParamSpec * glade_widget_class_find_spec (GladeWidgetClass *class, const gchar *name);
|
||||
void glade_widget_class_dump_param_specs (GladeWidgetClass *class);
|
||||
|
||||
/* Packing properties */
|
||||
void glade_widget_class_load_packing_properties (GladeWidgetClass *class);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_WIDGET_CLASS_H__ */
|
||||
|
@ -75,14 +75,14 @@ glade_widget_new_name (GladeProject *project, GladeWidgetClass *class)
|
||||
* Return Value:
|
||||
**/
|
||||
static GladeWidget *
|
||||
glade_widget_new (GladeWidgetClass *class)
|
||||
glade_widget_new (GladeWidgetClass *class, GladeProject *project)
|
||||
{
|
||||
GladeWidget *widget;
|
||||
|
||||
widget = g_new0 (GladeWidget, 1);
|
||||
widget->name = NULL;
|
||||
widget->widget = NULL;
|
||||
widget->project = NULL;
|
||||
widget->project = project;
|
||||
widget->class = class;
|
||||
widget->properties = glade_property_list_new_from_widget_class (class, widget);
|
||||
widget->parent = NULL;
|
||||
@ -273,9 +273,9 @@ glade_widget_button_press (GtkWidget *event_widget, GdkEventButton *event, gpoin
|
||||
|
||||
glade_widget = glade_widget_get_from_event_widget (event_widget, event);
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
g_debug ("button press for a %s\n", glade_widget->class->name);
|
||||
#endif
|
||||
#endif
|
||||
if (!glade_widget) {
|
||||
g_warning ("Button press event but the gladewidget was not found\n");
|
||||
return FALSE;
|
||||
@ -317,7 +317,7 @@ glade_widget_button_release (GtkWidget *widget, GdkEventButton *event, gpointer
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
glade_property_refresh (GladeProperty *property)
|
||||
{
|
||||
switch (property->class->type) {
|
||||
@ -342,18 +342,19 @@ glade_property_refresh (GladeProperty *property)
|
||||
glade_property_get_string (property));
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_ENUM:
|
||||
glade_property_set_choice (property,
|
||||
glade_property_get_choice (property));
|
||||
glade_property_set_enum (property,
|
||||
glade_property_get_enum (property));
|
||||
break;
|
||||
case GLADE_PROPERTY_TYPE_OBJECT:
|
||||
g_print ("Set adjustment\n");
|
||||
g_print ("Set adjustment (refresh) %d\n", GPOINTER_TO_INT (property->child));
|
||||
#if 1
|
||||
g_print ("Set directly \n");
|
||||
#if 0
|
||||
glade_widget_set_default_options_real (property->child, packing);
|
||||
#endif
|
||||
g_print ("Set directly \n");
|
||||
gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (property->widget->widget),
|
||||
GTK_ADJUSTMENT (property->child));
|
||||
g_print ("DONE : Set directly\n");
|
||||
#else
|
||||
gtk_object_set (GTK_OBJECT (property->widget->widget),
|
||||
property->class->id,
|
||||
@ -581,7 +582,7 @@ glade_widget_property_changed_cb (GtkWidget *w)
|
||||
return;
|
||||
|
||||
glade_property_get_from_widget (property);
|
||||
|
||||
|
||||
glade_property_refresh (property);
|
||||
}
|
||||
|
||||
@ -706,11 +707,11 @@ glade_widget_create_gtk_widget (GladeWidget *glade_widget)
|
||||
|
||||
}
|
||||
|
||||
#if 1
|
||||
gtk_timeout_add ( 100, glade_widget_ugly_hack, glade_widget);
|
||||
gtk_timeout_add ( 400, glade_widget_ugly_hack, glade_widget);
|
||||
gtk_timeout_add (1000, glade_widget_ugly_hack, glade_widget);
|
||||
#endif
|
||||
if (g_type_is_a (type, GTK_TYPE_WIDGET)) {
|
||||
gtk_timeout_add ( 100, glade_widget_ugly_hack, glade_widget);
|
||||
gtk_timeout_add ( 400, glade_widget_ugly_hack, glade_widget);
|
||||
gtk_timeout_add (1000, glade_widget_ugly_hack, glade_widget);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -738,8 +739,7 @@ glade_widget_new_full (GladeProject *project,
|
||||
g_return_val_if_fail (GLADE_IS_PROJECT (project), NULL);
|
||||
g_return_val_if_fail (GLADE_IS_WIDGET_CLASS (class), NULL);
|
||||
|
||||
widget = glade_widget_new (class);
|
||||
widget->project = project;
|
||||
widget = glade_widget_new (class, project);
|
||||
widget->name = glade_widget_new_name (project, class);
|
||||
widget->parent = parent;
|
||||
|
||||
@ -776,7 +776,7 @@ glade_widget_new_from_class_full (GladeWidgetClass *class, GladeProject *project
|
||||
|
||||
g_return_val_if_fail (GLADE_IS_WIDGET_CLASS (class), NULL);
|
||||
g_return_val_if_fail (GLADE_IS_PROJECT (project), NULL);
|
||||
|
||||
|
||||
if (glade_widget_class_has_queries (class)) {
|
||||
result = glade_property_query_result_new ();
|
||||
if (glade_project_window_query_properties (class, result))
|
||||
@ -797,7 +797,7 @@ glade_widget_new_from_class_full (GladeWidgetClass *class, GladeProject *project
|
||||
/* ->widget sometimes contains GtkObjects like a GtkAdjustment for example */
|
||||
if (GTK_IS_WIDGET (widget->widget))
|
||||
gtk_widget_show (widget->widget);
|
||||
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
@ -805,7 +805,7 @@ GladeWidget *
|
||||
glade_widget_new_from_class (GladeWidgetClass *class, GladeWidget *parent)
|
||||
{
|
||||
GladeProject *project;
|
||||
|
||||
|
||||
g_return_val_if_fail (GLADE_IS_WIDGET_CLASS (class), NULL);
|
||||
g_return_val_if_fail (GLADE_IS_WIDGET (parent), NULL);
|
||||
g_return_val_if_fail (GLADE_IS_PROJECT (parent->project), NULL);
|
||||
@ -876,7 +876,8 @@ glade_widget_get_property_from_list (GList *list, GladePropertyClass *class, gbo
|
||||
|
||||
if (list == NULL) {
|
||||
if (!silent)
|
||||
g_warning ("Could not find the GladeProperty to load from -%s-",
|
||||
g_warning ("Could not find the GladeProperty %s:%s",
|
||||
class->id,
|
||||
class->name);
|
||||
return NULL;
|
||||
}
|
||||
@ -1126,7 +1127,7 @@ glade_widget_write (GladeXmlContext *context, GladeWidget *widget)
|
||||
child = glade_property_write (context, property);
|
||||
if (child == NULL)
|
||||
continue;
|
||||
glade_xml_append_child (node, child);
|
||||
glade_xml_node_append_child (node, child);
|
||||
}
|
||||
|
||||
/* Signals */
|
||||
@ -1136,7 +1137,7 @@ glade_widget_write (GladeXmlContext *context, GladeWidget *widget)
|
||||
child = glade_signal_write (context, signal);
|
||||
if (child == NULL)
|
||||
return NULL;
|
||||
glade_xml_append_child (node, child);
|
||||
glade_xml_node_append_child (node, child);
|
||||
}
|
||||
|
||||
/* Children */
|
||||
@ -1144,13 +1145,13 @@ glade_widget_write (GladeXmlContext *context, GladeWidget *widget)
|
||||
for (; list != NULL; list = list->next) {
|
||||
child_widget = list->data;
|
||||
child_tag = glade_xml_node_new (context, GLADE_XML_TAG_CHILD);
|
||||
glade_xml_append_child (node, child_tag);
|
||||
glade_xml_node_append_child (node, child_tag);
|
||||
|
||||
/* write the widget */
|
||||
child = glade_widget_write (context, child_widget);
|
||||
if (child == NULL)
|
||||
return NULL;
|
||||
glade_xml_append_child (child_tag, child);
|
||||
glade_xml_node_append_child (child_tag, child);
|
||||
|
||||
/* Append the packing properties */
|
||||
packing = glade_xml_node_new (context, GLADE_XML_TAG_PACKING);
|
||||
@ -1163,9 +1164,9 @@ glade_widget_write (GladeXmlContext *context, GladeWidget *widget)
|
||||
packing_property = glade_property_write (context, property);
|
||||
if (packing_property == NULL)
|
||||
continue;
|
||||
glade_xml_append_child (packing, packing_property);
|
||||
glade_xml_node_append_child (packing, packing_property);
|
||||
}
|
||||
glade_xml_append_child (child_tag, packing);
|
||||
glade_xml_node_append_child (child_tag, packing);
|
||||
/* */
|
||||
|
||||
|
||||
|
@ -274,7 +274,7 @@ glade_xml_get_boolean (GladeXmlNode *node_in, const char *name, gboolean _defaul
|
||||
* the content of a child.
|
||||
*/
|
||||
gboolean
|
||||
glade_xml_property_get_boolean (GladeXmlNode *node_in, const char *name, gboolean _default)
|
||||
glade_xml_get_property_boolean (GladeXmlNode *node_in, const char *name, gboolean _default)
|
||||
{
|
||||
xmlNodePtr node = (xmlNodePtr) node_in;
|
||||
gchar * value;
|
||||
@ -563,7 +563,7 @@ glade_xml_context_free (GladeXmlContext *context)
|
||||
|
||||
|
||||
void
|
||||
glade_xml_append_child (GladeXmlNode *node_in, GladeXmlNode *child_in)
|
||||
glade_xml_node_append_child (GladeXmlNode *node_in, GladeXmlNode *child_in)
|
||||
{
|
||||
xmlNodePtr node = (xmlNodePtr) node_in;
|
||||
xmlNodePtr child = (xmlNodePtr) child_in;
|
||||
|
@ -12,6 +12,12 @@ typedef struct _GladeXmlContext GladeXmlContext;
|
||||
typedef struct _GladeXmlNode GladeXmlNode;
|
||||
typedef struct _GladeXmlDoc GladeXmlDoc;
|
||||
|
||||
/* search child */
|
||||
GladeXmlNode * glade_xml_search_child (GladeXmlNode * node, const char *name);
|
||||
GladeXmlNode * glade_xml_search_child_required (GladeXmlNode * tree, const gchar* name);
|
||||
|
||||
/* content */
|
||||
|
||||
gchar * glade_xml_get_content (GladeXmlNode * node); /* Get the content of the node */
|
||||
void glade_xml_set_content (GladeXmlNode *node_in, const gchar *content);
|
||||
|
||||
@ -25,33 +31,16 @@ gchar * glade_xml_get_value_string_required (GladeXmlNode * node,
|
||||
|
||||
gboolean glade_xml_get_boolean (GladeXmlNode * node, const char *name, gboolean _default);
|
||||
|
||||
GladeXmlNode * glade_xml_search_child (GladeXmlNode * node, const char *name);
|
||||
GladeXmlNode * glade_xml_search_child_required (GladeXmlNode * tree, const gchar* name);
|
||||
|
||||
gboolean glade_xml_node_verify (GladeXmlNode * node, const gchar *name);
|
||||
gboolean glade_xml_node_verify_silent (GladeXmlNode *node_in, const gchar *name);
|
||||
void glade_xml_set_value (GladeXmlNode * node, const char *name, const char *val);
|
||||
|
||||
/* Properties */
|
||||
gchar * glade_xml_get_property_string_required (GladeXmlNode *node_in, const char *name, const char *xtra);
|
||||
gchar * glade_xml_get_property_string (GladeXmlNode *node_in, const gchar *name);
|
||||
gboolean glade_xml_property_get_boolean (GladeXmlNode *node_in, const char *name, gboolean _default);
|
||||
gchar * glade_xml_get_property_string_required (GladeXmlNode *node_in, const char *name, const char *xtra);
|
||||
gchar * glade_xml_get_property_string (GladeXmlNode *node_in, const gchar *name);
|
||||
gboolean glade_xml_get_property_boolean (GladeXmlNode *node_in, const char *name, gboolean _default);
|
||||
|
||||
void glade_xml_node_set_property_string (GladeXmlNode *node_in, const gchar *name, const gchar *string);
|
||||
void glade_xml_node_set_property_boolean (GladeXmlNode *node_in, const gchar *name, gboolean value);
|
||||
|
||||
/* Parse Context */
|
||||
GladeXmlContext * glade_xml_context_new (GladeXmlDoc *doc, const gchar *name_space);
|
||||
void glade_xml_context_destroy (GladeXmlContext *context);
|
||||
void glade_xml_context_free (GladeXmlContext *context);
|
||||
GladeXmlContext * glade_xml_context_new_from_path (const gchar *full_path,
|
||||
const gchar *nspace,
|
||||
const gchar *root_name);
|
||||
GladeXmlDoc * glade_xml_context_get_doc (GladeXmlContext *context);
|
||||
|
||||
|
||||
|
||||
void glade_xml_append_child (GladeXmlNode * node, GladeXmlNode * child);
|
||||
|
||||
/* Hash */
|
||||
GHashTable * glade_xml_utils_new_hash_from_node (GladeXmlNode * tree, const gchar *hash_type);
|
||||
|
||||
@ -63,19 +52,27 @@ GladeXmlNode * glade_xml_utils_hash_write (GladeXmlContext *context,
|
||||
GladeXmlNode * glade_xml_node_new (GladeXmlContext *context, const gchar *name);
|
||||
GladeXmlNode * glade_xml_node_get_children (GladeXmlNode *node);
|
||||
GladeXmlNode * glade_xml_node_next (GladeXmlNode *node_in);
|
||||
|
||||
const gchar * glade_xml_node_get_name (GladeXmlNode *node_in);
|
||||
gboolean glade_xml_node_verify (GladeXmlNode * node, const gchar *name);
|
||||
gboolean glade_xml_node_verify_silent (GladeXmlNode *node_in, const gchar *name);
|
||||
const gchar * glade_xml_node_get_name (GladeXmlNode *node_in);
|
||||
void glade_xml_node_append_child (GladeXmlNode * node, GladeXmlNode * child);
|
||||
|
||||
|
||||
/* Document Operatons */
|
||||
GladeXmlNode * glade_xml_doc_get_root (GladeXmlDoc *doc);
|
||||
GladeXmlDoc * glade_xml_doc_new (void);
|
||||
void glade_xml_doc_set_root (GladeXmlDoc *doc, GladeXmlNode *node);
|
||||
gint glade_xml_doc_save (GladeXmlDoc *doc_in, const gchar *full_path);
|
||||
void glade_xml_doc_free (GladeXmlDoc *doc_in);
|
||||
|
||||
|
||||
GladeXmlDoc * glade_xml_doc_new (void);
|
||||
void glade_xml_doc_set_root (GladeXmlDoc *doc, GladeXmlNode *node);
|
||||
void glade_xml_doc_free (GladeXmlDoc *doc_in);
|
||||
gint glade_xml_doc_save (GladeXmlDoc *doc_in, const gchar *full_path);
|
||||
|
||||
/* Parse Context */
|
||||
GladeXmlContext * glade_xml_context_new (GladeXmlDoc *doc, const gchar *name_space);
|
||||
void glade_xml_context_destroy (GladeXmlContext *context);
|
||||
void glade_xml_context_free (GladeXmlContext *context);
|
||||
GladeXmlContext * glade_xml_context_new_from_path (const gchar *full_path,
|
||||
const gchar *nspace,
|
||||
const gchar *root_name);
|
||||
GladeXmlDoc * glade_xml_context_get_doc (GladeXmlContext *context);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -51,6 +51,8 @@
|
||||
#define GLADE_TAG_PLACEHOLDER "Placeholder"
|
||||
#define GLADE_TAG_ICON "Icon"
|
||||
#define GLADE_TAG_PROPERTIES "Properties"
|
||||
#define GLADE_TAG_PACKING_PROPERTIES "PackingProperties"
|
||||
#define GLADE_TAG_CONTAINER "Container"
|
||||
#define GLADE_TAG_PROPERTY "Property"
|
||||
#define GLADE_TAG_COMMON "Common"
|
||||
#define GLADE_TAG_OPTIONAL "Optional"
|
||||
@ -62,7 +64,7 @@
|
||||
#define GLADE_TAG_PARAMETER "Parameter"
|
||||
#define GLADE_TAG_SYMBOL "Symbol"
|
||||
#define GLADE_TAG_ENUM "Enum"
|
||||
#define GLADE_TAG_CHOICE "Choice"
|
||||
#define GLADE_TAG_ENUMS "Enums"
|
||||
#define GLADE_TAG_FALSE "False"
|
||||
#define GLADE_TAG_TRUE "True"
|
||||
#define GLADE_TAG_YES "Yes"
|
||||
@ -82,7 +84,7 @@
|
||||
#define GLADE_TAG_QUESTION "Question"
|
||||
#define GLADE_TAG_PARAM_SPEC "ParamSpec"
|
||||
#define GLADE_TAG_VISIBLE_LINES "VisibleLines"
|
||||
#define GLADE_CHOICE_DATA_TAG "GladeChoiceDataTag"
|
||||
#define GLADE_ENUM_DATA_TAG "GladeEnumDataTag"
|
||||
#define GLADE_TAG_UPDATE_SIGNALS "UpdateSignals"
|
||||
#define GLADE_TAG_SIGNAL_NAME "SignalName"
|
||||
#define GLADE_TAG_DEFAULT "Default"
|
||||
|
@ -7,9 +7,29 @@
|
||||
|
||||
<Property Id="label"/>
|
||||
<Property Id="relief"/>
|
||||
|
||||
<Property Id="stock" Default="glade-none" ParamSpec="False" Name="Stock Button">
|
||||
<Type>Enum</Type>
|
||||
<Enums EnumType="GtkReliefStyle">
|
||||
<Enum Id="glade-none" Name="None"/>
|
||||
<Enum Id="gtk-ok" Name="Ok"/>
|
||||
<Enum Id="gtk-cancel" Name="Cancel"/>
|
||||
</Enums>
|
||||
<SetFunction>glade_gtk_button_set_stock</SetFunction>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
|
||||
<PackingProperties>
|
||||
<Container Id="GtkTable">
|
||||
<Packing Id="xexpand">True</Packing>
|
||||
<Packing Id="yexpand">True</Packing>
|
||||
<Packing Id="yshrink">False</Packing>
|
||||
<Packing Id="xshrink">False</Packing>
|
||||
<Packing Id="xfill">True</Packing>
|
||||
<Packing Id="yfill">True</Packing>
|
||||
</Container>
|
||||
</PackingProperties>
|
||||
|
||||
</GladeWidgetClass>
|
||||
|
||||
|
||||
|
@ -8,6 +8,17 @@
|
||||
|
||||
</Properties>
|
||||
|
||||
<PackingProperties>
|
||||
<Container Id="GtkTable">
|
||||
<Packing Id="xexpand">True</Packing>
|
||||
<Packing Id="yexpand">True</Packing>
|
||||
<Packing Id="yshrink">False</Packing>
|
||||
<Packing Id="xshrink">False</Packing>
|
||||
<Packing Id="xfill">True</Packing>
|
||||
<Packing Id="yfill">True</Packing>
|
||||
</Container>
|
||||
</PackingProperties>
|
||||
|
||||
</GladeWidgetClass>
|
||||
|
||||
|
||||
|
@ -25,11 +25,11 @@
|
||||
<Properties>
|
||||
<Property ParamSpec="FALSE" Id="minimum" Name="Min" Default="0">
|
||||
<Type>Float</Type>
|
||||
<SetFunction>glade_gtk_adjustment_set_max</SetFunction>
|
||||
<SetFunction>glade_gtk_adjustment_set_min</SetFunction>
|
||||
</Property>
|
||||
<Property ParamSpec="FALSE" Id="maximum" Name="Max" Default="100">
|
||||
<Type>Float</Type>
|
||||
<SetFunction>glade_gtk_adjustment_set_min</SetFunction>
|
||||
<SetFunction>glade_gtk_adjustment_set_max</SetFunction>
|
||||
</Property>
|
||||
<Property ParamSpec="FALSE" Id="step-increment" Name="Step Inc." Default="1">
|
||||
<Type>Float</Type>
|
||||
|
@ -48,5 +48,5 @@
|
||||
<Property Common="True" Id="extension-events"/>
|
||||
|
||||
</Properties>
|
||||
|
||||
|
||||
</GladeWidgetClass>
|
||||
|
@ -7,6 +7,17 @@
|
||||
|
||||
</Properties>
|
||||
|
||||
<PackingProperties>
|
||||
<Container Id="GtkTable">
|
||||
<Packing Id="xexpand">True</Packing>
|
||||
<Packing Id="yexpand">True</Packing>
|
||||
<Packing Id="yshrink">False</Packing>
|
||||
<Packing Id="xshrink">False</Packing>
|
||||
<Packing Id="xfill">True</Packing>
|
||||
<Packing Id="yfill">True</Packing>
|
||||
</Container>
|
||||
</PackingProperties>
|
||||
|
||||
</GladeWidgetClass>
|
||||
|
||||
|
||||
|
@ -11,6 +11,9 @@
|
||||
<Property Id="title"/>
|
||||
<Property Id="type"/>
|
||||
<Property Id="window-position"/>
|
||||
<!--
|
||||
Default="GTK_WIN_POS_CENTER"/>
|
||||
-->
|
||||
<Property Id="modal">
|
||||
<SetFunction>ignore</SetFunction>
|
||||
</Property>
|
||||
|
Loading…
x
Reference in New Issue
Block a user