Commit a70b7edb authored by Chema Celorio's avatar Chema Celorio Committed by Jose Maria Celorio

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.
parent 5edecc74
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 Marn <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.
......
......@@ -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
\ No newline at end of file
......@@ -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;
}