Commit 6aa59c7b authored by Tristan Van Berkom's avatar Tristan Van Berkom

Now works like a pure widget, uses gtk_widget_size_allocate() to resize


	* gladeui/glade-design-layout.[ch]: 
	  Now works like a pure widget, uses gtk_widget_size_allocate() to resize 
	  children and gtk_widget_queue_resize() to resize itself (removed default
	  size control for now).

	* gladeui/glade-xml-utils.[ch], gladeui/glade-widget.[ch], 
	  gladeui/glade-widget-adaptor.[ch], plugins/gtk/gtk+.xml.in,
	  plugins/gtk/glade-gtk.c, plugins/gnome/glade-gnome.c: 
	  - Added glade_xml_get_property_int()
	  - Added default-width/height to catalog/GWA
	  - Added toplevel-width/height properties to GladeWidget
	  - Use default-width/height in catalogs instead of gtk_window_set_default_size()
	    in plugin code.


svn path=/trunk/; revision=1061
parent 5d923661
......@@ -10,6 +10,20 @@
* src/glade-project-window.c: Re-Implemented hack for accelerators to
work cooperatively with text entries in the editor. (fixes bug 396447)
* gladeui/glade-design-layout.[ch]:
Now works like a pure widget, uses gtk_widget_size_allocate() to resize
children and gtk_widget_queue_resize() to resize itself (removed default
size control for now).
* gladeui/glade-xml-utils.[ch], gladeui/glade-widget.[ch],
gladeui/glade-widget-adaptor.[ch], plugins/gtk/gtk+.xml.in,
plugins/gtk/glade-gtk.c, plugins/gnome/glade-gnome.c:
- Added glade_xml_get_property_int()
- Added default-width/height to catalog/GWA
- Added toplevel-width/height properties to GladeWidget
- Use default-width/height in catalogs instead of gtk_window_set_default_size()
in plugin code.
2007-01-27 Tristan Van Berkom <tvb@gnome.org>
* gladeui/glade-command.c: Set project properly in glade_command_remove()
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* glade-design-layout.c
*
......@@ -168,225 +169,201 @@ child_size_request_handler (GtkWidget *widget,
}
static void
glade_design_layout_handle_event (GladeDesignLayout *layout, GdkEvent* ev)
static gboolean
glade_design_layout_leave_notify_event (GtkWidget *widget, GdkEventCrossing *ev)
{
GtkWidget *child;
GladeDesignLayoutPrivate *priv;
GtkWidget *widget;
GtkWidget *child;
GtkAllocation allocation;
GladeWidget *child_glade_widget;
GladePointerRegion region;
gint x, y;
gint new_width, new_height;
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (layout);
widget = GTK_WIDGET (layout);
child = gtk_bin_get_child (GTK_BIN (layout));
if (child == NULL)
return;
switch (ev->type)
{
case GDK_MOTION_NOTIFY:
if (((GdkEventMotion *)ev)->is_hint)
gdk_window_get_pointer (priv->event_window, &x, &y, NULL);
else {
x = (int) ((GdkEventMotion *)ev)->x;
y = (int) ((GdkEventMotion *)ev)->y;
}
child_glade_widget = glade_widget_get_from_gobject (child);
allocation = child->allocation;
if (priv->activity == GLADE_ACTIVITY_RESIZE_WIDTH)
{
new_width = x - priv->dx - PADDING - OUTLINE_WIDTH;
if (new_width < priv->current_size_request->width)
new_width = priv->current_size_request->width;
/* FIXME: use size_allocate and emit a signal, let the
* glade core handle widget properties at a more appropriate
* place, also, it might be a little agressive to change property
* values automaticly by default, maybe we should check if
* "default width" is enabled and set that, else check if
* "width request" is enabled, and set that, or not set any
* properties at all.
*/
/* allocation.width = new_width; */
/* gtk_widget_size_allocate (child, &allocation); */
glade_widget_property_set_enabled (child_glade_widget, "default-width", TRUE);
glade_widget_property_set (child_glade_widget, "default-width", new_width, NULL);
}
else if (priv->activity == GLADE_ACTIVITY_RESIZE_HEIGHT)
{
new_height = y - priv->dy - PADDING - OUTLINE_WIDTH;
if (new_height < priv->current_size_request->height)
new_height = priv->current_size_request->height;
/* allocation.height = new_height; */
/* gtk_widget_size_allocate (child, &allocation); */
glade_widget_property_set_enabled (child_glade_widget, "default-height", TRUE);
glade_widget_property_set (child_glade_widget, "default-height", new_height, NULL);
}
else if (priv->activity == GLADE_ACTIVITY_RESIZE_WIDTH_AND_HEIGHT)
{
new_width = x - priv->dx - PADDING - OUTLINE_WIDTH;
new_height = y - priv->dy - PADDING - OUTLINE_WIDTH;
if (new_width < priv->current_size_request->width)
new_width = priv->current_size_request->width;
if (new_height < priv->current_size_request->height)
new_height = priv->current_size_request->height;
/* allocation.height = new_height; */
/* allocation.width = new_width; */
/* gtk_widget_size_allocate (child, &allocation); */
glade_widget_property_set_enabled (child_glade_widget, "default-width", TRUE);
glade_widget_property_set_enabled (child_glade_widget, "default-height", TRUE);
glade_widget_property_set (child_glade_widget, "default-width", new_width, NULL);
glade_widget_property_set (child_glade_widget, "default-height", new_height, NULL);
}
else
{
region = glade_design_layout_get_pointer_region (layout, x, y);
if (region == GLADE_REGION_EAST)
gdk_window_set_cursor (widget->window, priv->cursor_resize_right);
else if (region == GLADE_REGION_SOUTH)
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom);
if ((child = GTK_BIN (widget)->child) == NULL)
return FALSE;
else if (region == GLADE_REGION_SOUTH_EAST ||
region == GLADE_REGION_WEST_OF_SOUTH_EAST ||
region == GLADE_REGION_NORTH_OF_SOUTH_EAST)
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom_right);
else
gdk_window_set_cursor (widget->window, NULL);
}
break;
case GDK_BUTTON_PRESS:
x = (int) ((GdkEventButton *) ev)->x;
y = (int) ((GdkEventButton *) ev)->y;
region = glade_design_layout_get_pointer_region (layout, x, y);
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
if (((GdkEventButton *) ev)->button == 1) {
if (priv->activity == GLADE_ACTIVITY_NONE)
gdk_window_set_cursor (widget->window, NULL);
return FALSE;
}
priv->dx = x - (child->allocation.x + child->allocation.width);
priv->dy = y - (child->allocation.y + child->allocation.height);
if (region == GLADE_REGION_EAST) {
priv->activity = GLADE_ACTIVITY_RESIZE_WIDTH;
gdk_window_set_cursor (widget->window, priv->cursor_resize_right);
}
if (region == GLADE_REGION_SOUTH) {
priv->activity = GLADE_ACTIVITY_RESIZE_HEIGHT;
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom);
}
if (region == GLADE_REGION_SOUTH_EAST) {
priv->activity = GLADE_ACTIVITY_RESIZE_WIDTH_AND_HEIGHT;
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom_right);
}
if (region == GLADE_REGION_WEST_OF_SOUTH_EAST) {
priv->activity = GLADE_ACTIVITY_RESIZE_WIDTH_AND_HEIGHT;
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom_right);
}
if (region == GLADE_REGION_NORTH_OF_SOUTH_EAST) {
priv->activity = GLADE_ACTIVITY_RESIZE_WIDTH_AND_HEIGHT;
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom_right);
}
}
break;
case GDK_BUTTON_RELEASE:
priv->activity = GLADE_ACTIVITY_NONE;
gdk_window_set_cursor (widget->window, NULL);
static void
glade_design_layout_update_child (GladeDesignLayout *layout,
GtkWidget *child,
GtkAllocation *allocation)
{
GladeDesignLayoutPrivate *priv;
GladeWidget *gchild;
break;
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (layout);
case GDK_LEAVE_NOTIFY:
/* Update GladeWidget metadata */
gchild = glade_widget_get_from_gobject (child);
g_object_set (gchild,
"toplevel-width", allocation->width,
"toplevel-height", allocation->height,
NULL);
if (priv->activity == GLADE_ACTIVITY_NONE)
gdk_window_set_cursor (widget->window, NULL);
break;
gtk_widget_size_allocate (child, allocation);
default:
break;
}
gtk_widget_queue_resize (GTK_WIDGET (layout));
}
static gboolean
glade_design_layout_leave_notify_event (GtkWidget *widget, GdkEventCrossing *ev)
glade_design_layout_motion_notify_event (GtkWidget *widget, GdkEventMotion *ev)
{
GtkWidget *child;
GtkWidget *child;
GladeDesignLayoutPrivate *priv;
GladeWidget *child_glade_widget;
GladePointerRegion region;
GtkAllocation allocation;
gint x, y;
gint new_width, new_height;
if ((child = GTK_BIN (widget)->child) == NULL)
return FALSE;
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
child = ((GtkBin *) widget)->child;
if (((GdkEventMotion *)ev)->is_hint)
gdk_window_get_pointer (priv->event_window, &x, &y, NULL);
else
{
x = (int) ((GdkEventMotion *)ev)->x;
y = (int) ((GdkEventMotion *)ev)->y;
}
if (child && GTK_IS_WINDOW (child))
glade_design_layout_handle_event (GLADE_DESIGN_LAYOUT (widget), (GdkEvent *) ev);
child_glade_widget = glade_widget_get_from_gobject (child);
allocation = child->allocation;
return FALSE;
}
if (priv->activity == GLADE_ACTIVITY_RESIZE_WIDTH)
{
new_width = x - priv->dx - PADDING - OUTLINE_WIDTH;
if (new_width < priv->current_size_request->width)
new_width = priv->current_size_request->width;
allocation.width = new_width;
static gboolean
glade_design_layout_motion_notify_event (GtkWidget *widget, GdkEventMotion *ev)
{
GtkWidget *child;
glade_design_layout_update_child (GLADE_DESIGN_LAYOUT (widget),
child, &allocation);
}
else if (priv->activity == GLADE_ACTIVITY_RESIZE_HEIGHT)
{
new_height = y - priv->dy - PADDING - OUTLINE_WIDTH;
if (new_height < priv->current_size_request->height)
new_height = priv->current_size_request->height;
allocation.height = new_height;
child = ((GtkBin *) widget)->child;
if (child && GTK_IS_WINDOW (child))
glade_design_layout_handle_event (GLADE_DESIGN_LAYOUT (widget), (GdkEvent *) ev);
glade_design_layout_update_child (GLADE_DESIGN_LAYOUT (widget),
child, &allocation);
}
else if (priv->activity == GLADE_ACTIVITY_RESIZE_WIDTH_AND_HEIGHT)
{
new_width = x - priv->dx - PADDING - OUTLINE_WIDTH;
new_height = y - priv->dy - PADDING - OUTLINE_WIDTH;
if (new_width < priv->current_size_request->width)
new_width = priv->current_size_request->width;
if (new_height < priv->current_size_request->height)
new_height = priv->current_size_request->height;
allocation.height = new_height;
allocation.width = new_width;
glade_design_layout_update_child (GLADE_DESIGN_LAYOUT (widget),
child, &allocation);
}
else
{
region = glade_design_layout_get_pointer_region (GLADE_DESIGN_LAYOUT (widget), x, y);
if (region == GLADE_REGION_EAST)
gdk_window_set_cursor (widget->window, priv->cursor_resize_right);
else if (region == GLADE_REGION_SOUTH)
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom);
else if (region == GLADE_REGION_SOUTH_EAST ||
region == GLADE_REGION_WEST_OF_SOUTH_EAST ||
region == GLADE_REGION_NORTH_OF_SOUTH_EAST)
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom_right);
else
gdk_window_set_cursor (widget->window, NULL);
}
return FALSE;
}
static gboolean
glade_design_layout_button_press_event (GtkWidget *widget, GdkEventButton *ev)
{
GtkWidget *child;
GtkWidget *child;
GladePointerRegion region;
GladeDesignLayoutPrivate *priv;
gint x, y;
if ((child = GTK_BIN (widget)->child) == NULL)
return FALSE;
child = ((GtkBin *) widget)->child;
x = (int) ((GdkEventButton *) ev)->x;
y = (int) ((GdkEventButton *) ev)->y;
if (child && GTK_IS_WINDOW (child))
glade_design_layout_handle_event (GLADE_DESIGN_LAYOUT (widget), (GdkEvent *) ev);
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
region = glade_design_layout_get_pointer_region (GLADE_DESIGN_LAYOUT (widget), x, y);
if (((GdkEventButton *) ev)->button == 1)
{
priv->dx = x - (child->allocation.x + child->allocation.width);
priv->dy = y - (child->allocation.y + child->allocation.height);
if (region == GLADE_REGION_EAST)
{
priv->activity = GLADE_ACTIVITY_RESIZE_WIDTH;
gdk_window_set_cursor (widget->window, priv->cursor_resize_right);
}
if (region == GLADE_REGION_SOUTH)
{
priv->activity = GLADE_ACTIVITY_RESIZE_HEIGHT;
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom);
}
if (region == GLADE_REGION_SOUTH_EAST)
{
priv->activity = GLADE_ACTIVITY_RESIZE_WIDTH_AND_HEIGHT;
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom_right);
}
if (region == GLADE_REGION_WEST_OF_SOUTH_EAST)
{
priv->activity = GLADE_ACTIVITY_RESIZE_WIDTH_AND_HEIGHT;
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom_right);
}
if (region == GLADE_REGION_NORTH_OF_SOUTH_EAST)
{
priv->activity = GLADE_ACTIVITY_RESIZE_WIDTH_AND_HEIGHT;
gdk_window_set_cursor (widget->window, priv->cursor_resize_bottom_right);
}
}
return FALSE;
}
static gboolean
glade_design_layout_button_release_event (GtkWidget *widget, GdkEventButton *ev)
{
GtkWidget *child;
GladeDesignLayoutPrivate *priv;
GtkWidget *child;
child = ((GtkBin *) widget)->child;
if (child && GTK_IS_WINDOW (child))
glade_design_layout_handle_event (GLADE_DESIGN_LAYOUT (widget), (GdkEvent *) ev);
if ((child = GTK_BIN (widget)->child) == NULL)
return FALSE;
priv = GLADE_DESIGN_LAYOUT_GET_PRIVATE (widget);
priv->activity = GLADE_ACTIVITY_NONE;
gdk_window_set_cursor (widget->window, NULL);
return FALSE;
}
......@@ -397,6 +374,7 @@ glade_design_layout_size_request (GtkWidget *widget, GtkRequisition *requisition
GladeDesignLayoutPrivate *priv;
GtkRequisition child_requisition;
GtkWidget *child;
GladeWidget *gchild;
gint child_width = 0;
gint child_height = 0;
......@@ -406,15 +384,21 @@ glade_design_layout_size_request (GtkWidget *widget, GtkRequisition *requisition
requisition->height = 0;
child = GTK_BIN (widget)->child;
if (child && GTK_WIDGET_VISIBLE (child))
{
gchild = glade_widget_get_from_gobject (child);
g_assert (gchild);
gtk_widget_size_request (child, &child_requisition);
if (GTK_IS_WINDOW (child))
gtk_window_get_default_size (GTK_WINDOW (child), &child_width, &child_height);
g_object_get (gchild,
"toplevel-width", &child_width,
"toplevel-height", &child_height,
NULL);
child_width = MAX (child_width, child_requisition.width);
child_height = MAX (child_height, child_requisition.height);
child_height = MAX (child_height, child_requisition.height);
requisition->width = MAX (requisition->width,
2 * PADDING + child_width + 2 * OUTLINE_WIDTH);
......@@ -425,13 +409,13 @@ glade_design_layout_size_request (GtkWidget *widget, GtkRequisition *requisition
requisition->width += GTK_CONTAINER (widget)->border_width * 2;
requisition->height += GTK_CONTAINER (widget)->border_width * 2;
}
static void
glade_design_layout_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
GladeDesignLayoutPrivate *priv;
GladeWidget *gchild;
GtkRequisition child_requisition;
GtkAllocation child_allocation;
GtkWidget *child;
......@@ -456,22 +440,21 @@ glade_design_layout_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
}
child = GTK_BIN (widget)->child;
if (child && GTK_WIDGET_VISIBLE (child))
{
gchild = glade_widget_get_from_gobject (child);
g_assert (gchild);
gtk_widget_get_child_requisition (child, &child_requisition);
if (GTK_IS_WINDOW (child))
{
gtk_window_get_default_size (GTK_WINDOW (child), &child_width, &child_height);
child_width = MAX (child_width, priv->current_size_request->width);
child_height = MAX (child_height, priv->current_size_request->height);
}
else
{
child_width = child_requisition.width;
child_height = child_requisition.height;
}
g_object_get (gchild,
"toplevel-width", &child_width,
"toplevel-height", &child_height,
NULL);
child_width = MAX (child_width, child_requisition.width);
child_height = MAX (child_height, child_requisition.height);
child_allocation.x = widget->allocation.x + border_width + PADDING + OUTLINE_WIDTH;
child_allocation.y = widget->allocation.y + border_width + PADDING + OUTLINE_WIDTH;
......
......@@ -170,8 +170,8 @@ glade_design_view_new (GladeProject *project)
g_return_val_if_fail (GLADE_IS_PROJECT (project), NULL);
view = g_object_new (GLADE_TYPE_DESIGN_VIEW,
"project", project,
NULL);
"project", project,
NULL);
return GTK_WIDGET (view);
}
......
......@@ -882,6 +882,13 @@ glade_widget_adaptor_class_init (GladeWidgetAdaptorClass *adaptor_class)
adaptor_class->action_activated = gwa_action_activated_impl;
/* Base defaults here */
adaptor_class->fixed = FALSE;
adaptor_class->toplevel = FALSE;
adaptor_class->use_placeholders = FALSE;
adaptor_class->default_width = -1;
adaptor_class->default_height = -1;
/**
* GladeWidgetAdaptor::action-activated:
* @adaptor: the GladeWidgetAdaptor which received the signal.
......@@ -1488,6 +1495,14 @@ gwa_extend_with_node (GladeWidgetAdaptor *adaptor,
glade_xml_get_property_boolean
(node, GLADE_TAG_USE_PLACEHOLDERS, adaptor_class->use_placeholders);
/* Check default size when used as a toplevel in the GladeDesignView */
adaptor_class->default_width =
glade_xml_get_property_int
(node, GLADE_TAG_DEFAULT_WIDTH, adaptor_class->default_width);
adaptor_class->default_height =
glade_xml_get_property_int
(node, GLADE_TAG_DEFAULT_HEIGHT, adaptor_class->default_height);
/* Override the special-child-type here */
if ((child_type =
glade_xml_get_value_string (node, GLADE_TAG_SPECIAL_CHILD_TYPE)) != NULL)
......
......@@ -57,6 +57,28 @@ typedef struct _GladeSignalClass GladeSignalClass;
#define GWA_USE_PLACEHOLDERS(obj) \
((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->use_placeholders : FALSE)
/**
* GWA_DEFAULT_WIDTH:
* @obj: A #GladeWidgetAdaptor
*
* Returns the default width to be used when this widget
* is toplevel in the GladeDesignLayout
*/
#define GWA_DEFAULT_WIDTH(obj) \
((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->default_width : -1)
/**
* GWA_DEFAULT_HEIGHT:
* @obj: A #GladeWidgetAdaptor
*
* Returns the default width to be used when this widget
* is toplevel in the GladeDesignLayout
*/
#define GWA_DEFAULT_HEIGHT(obj) \
((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->default_height : -1)
/**
* GWA_GET_CLASS:
* @type: A #GType
......@@ -370,6 +392,9 @@ struct _GladeWidgetAdaptorClass
* to interface with child widgets.
*/
gint default_width; /* Default width in GladeDesignLayout */
gint default_height; /* Default height in GladeDesignLayout */
GladePostCreateFunc post_create; /* Executed after widget creation:
* plugins use this to setup various
* support codes.
......
......@@ -94,7 +94,9 @@ enum
PROP_INTERNAL_NAME,
PROP_TEMPLATE,
PROP_INFO,
PROP_REASON
PROP_REASON,
PROP_TOPLEVEL_WIDTH,
PROP_TOPLEVEL_HEIGHT
};
static guint glade_widget_signals[LAST_SIGNAL] = {0};
......@@ -814,6 +816,10 @@ glade_widget_constructor (GType type,
glade_widget_set_object (gwidget, object);
}
/* Setup width/height */
gwidget->width = GWA_DEFAULT_WIDTH (gwidget->adaptor);
gwidget->height = GWA_DEFAULT_HEIGHT (gwidget->adaptor);
/* Introspect object properties before passing it to post_create,
* but only when its freshly created (depend on glade file at
* load time and copying properties at dup time).
......@@ -942,6 +948,12 @@ glade_widget_set_real_property (GObject *object,
case PROP_REASON:
widget->construct_reason = g_value_get_int (value);
break;
case PROP_TOPLEVEL_WIDTH:
widget->width = g_value_get_int (value);
break;
case PROP_TOPLEVEL_HEIGHT:
widget->height = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -984,6 +996,12 @@ glade_widget_get_real_property (GObject *object,
case PROP_PARENT:
g_value_set_object (value, widget->parent);
break;
case PROP_TOPLEVEL_WIDTH:
g_value_set_int (value, widget->width);
break;
case PROP_TOPLEVEL_HEIGHT:
g_value_set_int (value, widget->height);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -1025,6 +1043,10 @@ glade_widget_init (GladeWidget *widget)
(g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) free_signals);
/* Initial invalid values */
widget->width = -1;
widget->height = -1;
}
static void
......@@ -1150,7 +1172,27 @@ glade_widget_class_init (GladeWidgetClass *klass)
GLADE_CREATE_REASONS - 1,
GLADE_CREATE_USER,
G_PARAM_CONSTRUCT_ONLY|G_PARAM_WRITABLE));
g_object_class_install_property
(object_class, PROP_TOPLEVEL_WIDTH,
g_param_spec_int ("toplevel-width", _("Toplevel Width"),
_("The width of the widget when toplevel in "
"the GladeDesignLayout"),
-1,
G_MAXINT,
-1,
G_PARAM_READWRITE));
g_object_class_install_property
(object_class, PROP_TOPLEVEL_HEIGHT,
g_param_spec_int ("toplevel-height", _("Toplevel Height"),
_("The height of the widget when toplevel in "
"the GladeDesignLayout"),
-1,
G_MAXINT,
-1,
G_PARAM_READWRITE));
/**
* GladeWidget::add-signal-handler:
* @gladewidget: the #GladeWidget which received the signal.
......
......@@ -84,6 +84,10 @@ struct _GladeWidget
* added/removed from the project).
*/
gint width; /* Current size used in the UI, this is only */
gint height; /* usefull for parentless widgets in the
* GladeDesignLayout */
/* Construct parameters: */
GladeWidget *construct_template;
GladeWidgetInfo *construct_info;
......
......@@ -358,6 +358,8 @@ glade_xml_get_property_double (GladeXmlNode *node_in,
if ((value = glade_xml_get_property (node, name)) == NULL)
return _default;
errno = 0;
retval = g_ascii_strtod (value, NULL);
if (errno)
......@@ -372,6 +374,25 @@ glade_xml_get_property_double (GladeXmlNode *node_in,
}
}
gint
glade_xml_get_property_int (GladeXmlNode *node_in,
const gchar *name,
gint _default)
{
xmlNodePtr node = (xmlNodePtr) node_in;
gint retval;
gchar *value;
if ((value = glade_xml_get_property (node, name)) == NULL)
return _default;
retval = atoi (value);
g_free (value);
return retval;
}
void
glade_xml_node_set_property_boolean (GladeXmlNode *node_in,
const gchar *name,
......
......@@ -103,6 +103,8 @@ typedef struct _GladeXmlDoc GladeXmlDoc;
#define GLADE_TAG_GET_TYPE_FUNCTION "get-type-function"
#define GLADE_TAG_TOPLEVEL "toplevel"
#define GLADE_TAG_USE_PLACEHOLDERS "use-placeholders"
#define GLADE_TAG_DEFAULT_WIDTH "default-width"
#define GLADE_TAG_DEFAULT_HEIGHT "default-height"
#define GLADE_TAG_EVENT_HANDLER_CONNECTED "EventHandlerConnected"
#define GLADE_TAG_FALSE "False"
#define GLADE_TAG_TRUE "True"
......@@ -137,6 +139,7 @@ gchar * glade_xml_get_property_string_required (GladeXmlNode *node_in, const gc
gchar * glade_xml_get_property_string (GladeXmlNode *node_in, const gchar *name);
gboolean glade_xml_get_property_boolean (GladeXmlNode *node_in, const gchar *name, gboolean _default);
gdouble glade_xml_get_property_double (GladeXmlNode *node_in, const gchar *name, gdouble _default);
gint glade_xml_get_property_int (GladeXmlNode *node_in, const gchar *name, gint _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);
......
......@@ -105,8 +105,6 @@ glade_gnome_app_post_create (GladeWidgetAdaptor *adaptor,
GladeProject *project = glade_widget_get_project (gapp);
GladeWidget *gdock, *gdock_item, *gmenubar;
gtk_window_set_default_size (GTK_WINDOW (object), 440, 250);
/* Add BonoboDock */
gdock = glade_widget_adaptor_create_internal