Commit 379eb295 authored by Tristan Van Berkom's avatar Tristan Van Berkom

* gladeui/glade-xml-utils.h, gladeui/glade-widget-adaptor.[ch], gladeui/glade-widget.[ch]:

	  Added <add-child-verify-function> semantics to query the plugin if it's ok to add
	  a said "child" to an adaptors widget "parent" and warn the user about it in context.

	* gladeui/glade-project.c: Check glade_widget_add_verify() when pasting widgets

	* gladeui/glade-command.c: Check glade_widget_add_verify() from glade_command_create()

	* gladeui/glade-popup.c: Allow "Add widget here" action to appear for any project object
	  and rely on glade_command_create() to warn the user via glade_widget_add_verify() if
	  adding the widget fails.

	* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Added <add-child-verify-function> support to
	GtkContainer, GtkMenuShell, GtkMenuItem, GtkToolBar, GtkToolItem, GtkToolPalette, GtkToolItemGroup,
	GtkActionGroup, GtkTextTagTable adaptors.
parent 37e23215
2011-01-28 Tristan Van Berkom <tristanvb@openismus.com>
* gladeui/glade-xml-utils.h, gladeui/glade-widget-adaptor.[ch], gladeui/glade-widget.[ch]:
Added <add-child-verify-function> semantics to query the plugin if it's ok to add
a said "child" to an adaptors widget "parent" and warn the user about it in context.
* gladeui/glade-project.c: Check glade_widget_add_verify() when pasting widgets
* gladeui/glade-command.c: Check glade_widget_add_verify() from glade_command_create()
* gladeui/glade-popup.c: Allow "Add widget here" action to appear for any project object
and rely on glade_command_create() to warn the user via glade_widget_add_verify() if
adding the widget fails.
* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Added <add-child-verify-function> support to
GtkContainer, GtkMenuShell, GtkMenuItem, GtkToolBar, GtkToolItem, GtkToolPalette, GtkToolItemGroup,
GtkActionGroup, GtkTextTagTable adaptors.
2011-01-27 Tristan Van Berkom <tristanvb@openismus.com>
* plugins/gtk+/gtk+.xml.in, plugins/gtk+/glade-gtk.c: Added support for GtkRecentFilter
......
......@@ -1581,6 +1581,13 @@ glade_command_create (GladeWidgetAdaptor * adaptor, GladeWidget * parent,
return NULL;
}
if (parent && !glade_widget_add_verify (parent, widget, TRUE))
{
g_object_ref_sink (widget);
g_object_unref (widget);
return NULL;
}
widgets = g_list_prepend (widgets, widget);
glade_command_push_group (_("Create %s"), glade_widget_get_name (widget));
glade_command_add (widgets, parent, placeholder, project, FALSE);
......
......@@ -58,57 +58,23 @@ glade_popup_select_cb (GtkMenuItem * item, GladeWidget * widget)
glade_widget_get_object (widget), TRUE);
}
static GladePlaceholder *
find_placeholder (GObject * object)
{
GtkContainer *container;
GladePlaceholder *retval = NULL;
GtkWidget *child;
GList *c, *l;
if (!GTK_IS_CONTAINER (object))
return NULL;
container = GTK_CONTAINER (object);
for (c = l = glade_util_container_get_all_children (container);
l; l = g_list_next (l))
{
child = l->data;
if (GLADE_IS_PLACEHOLDER (child))
{
retval = GLADE_PLACEHOLDER (child);
break;
}
}
g_list_free (c);
return retval;
}
static void
glade_popup_placeholder_add_cb (GtkMenuItem * item,
GladePlaceholder * placeholder)
glade_popup_widget_add_cb (GtkMenuItem * item,
GladeWidget * widget)
{
GladeProject *project;
GladeWidgetAdaptor *adaptor;
GladeWidget *parent;
GladeProject *project;
parent = glade_placeholder_get_parent (placeholder);
project = glade_placeholder_get_project (placeholder);
project = glade_widget_get_project (widget);
adaptor = glade_project_get_add_item (project);
g_return_if_fail (adaptor != NULL);
if (!glade_util_check_and_warn_scrollable
(parent, adaptor, glade_app_get_window ()))
(widget, adaptor, glade_app_get_window ()))
{
glade_command_create (adaptor, parent,
placeholder,
project);
if (glade_command_create (adaptor, widget,
NULL, project))
glade_project_set_add_item (project, NULL);
}
......@@ -423,7 +389,6 @@ glade_popup_create_menu (GladeWidget *widget,
GtkWidget *popup_menu;
GtkWidget *separator;
gboolean sensitive;
GladePlaceholder *tmp_placeholder;
GladeWidgetAdaptor *adaptor;
gchar *book;
......@@ -433,21 +398,20 @@ glade_popup_create_menu (GladeWidget *widget,
if (adaptor)
{
GladeWidget *parent;
RootAddData *data = g_new (RootAddData, 1);
parent = placeholder ? glade_placeholder_get_parent (placeholder) : widget;
data->adaptor = adaptor;
data->project = project;
g_object_set_data_full (G_OBJECT (popup_menu), "root-data-destroy-me",
data, (GDestroyNotify)g_free);
tmp_placeholder = placeholder;
if (!tmp_placeholder && widget)
tmp_placeholder = find_placeholder (glade_widget_get_object (widget));
glade_popup_append_item (popup_menu, NULL, _("_Add widget here"),
NULL, tmp_placeholder != NULL,
glade_popup_placeholder_add_cb,
tmp_placeholder);
NULL, parent != NULL,
glade_popup_widget_add_cb,
parent);
glade_popup_append_item (popup_menu, NULL, _("Add widget as _toplevel"),
NULL, TRUE, glade_popup_root_add_cb, data);
......
......@@ -4619,6 +4619,19 @@ glade_project_command_paste (GladeProject *project,
return;
}
/* Check that the underlying adaptor allows the paste */
if (parent)
{
for (list = glade_clipboard_widgets (clipboard); list && list->data; list = list->next)
{
widget = list->data;
if (!glade_widget_add_verify (parent, widget, TRUE))
return;
}
}
/* Check that we have compatible heirarchies */
for (list = glade_clipboard_widgets (clipboard); list && list->data; list = list->next)
{
......@@ -4637,6 +4650,8 @@ glade_project_command_paste (GladeProject *project,
/* A GladeWidget that doesnt use placeholders can only paste one
* at a time
*
* XXX: Not sure if this has to be true.
*/
if (GTK_IS_WIDGET (glade_widget_get_object (widget)) &&
parent && !GWA_USE_PLACEHOLDERS (glade_widget_get_adaptor (parent)) &&
......
......@@ -812,6 +812,20 @@ glade_widget_adaptor_object_construct_object (GladeWidgetAdaptor * adaptor,
return g_object_newv (adaptor->priv->type, n_parameters, parameters);
}
static gboolean
glade_widget_adaptor_object_add_verify (GladeWidgetAdaptor *adaptor,
GObject *parent,
GObject *child,
gboolean user_feedback)
{
if (user_feedback)
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO, NULL,
_("%s does not support adding any children."),
adaptor->priv->title);
return FALSE;
}
static void
glade_widget_adaptor_object_set_property (GladeWidgetAdaptor * adaptor,
......@@ -1208,6 +1222,7 @@ glade_widget_adaptor_class_init (GladeWidgetAdaptorClass * adaptor_class)
adaptor_class->verify_property = NULL;
adaptor_class->set_property = glade_widget_adaptor_object_set_property;
adaptor_class->get_property = glade_widget_adaptor_object_get_property;
adaptor_class->add_verify = glade_widget_adaptor_object_add_verify;
adaptor_class->add = NULL;
adaptor_class->remove = NULL;
adaptor_class->replace_child = NULL;
......@@ -1409,6 +1424,10 @@ gwa_extend_with_node_load_sym (GladeWidgetAdaptorClass * klass,
GLADE_TAG_VERIFY_FUNCTION, &symbol))
klass->verify_property = symbol;
if (glade_xml_load_sym_from_node (node, module,
GLADE_TAG_ADD_CHILD_VERIFY_FUNCTION, &symbol))
klass->add_verify = symbol;
if (glade_xml_load_sym_from_node (node, module,
GLADE_TAG_ADD_CHILD_FUNCTION, &symbol))
klass->add = symbol;
......@@ -3063,6 +3082,36 @@ glade_widget_adaptor_verify_property (GladeWidgetAdaptor * adaptor,
return TRUE;
}
/**
* glade_widget_adaptor_add_verify:
* @adaptor: A #GladeWidgetAdaptor
* @parent: A #GObject container
* @child: A #GObject child
* @user_feedback: whether a notification dialog should be
* presented in the case that the child cannot not be added.
*
* Checks whether @child can be added to @parent.
*
* If @user_feedback is %TRUE and @child cannot be
* added then this shows a notification dialog to the user
* explaining why.
*
* Returns: whether @child can be added to @parent.
*/
gboolean
glade_widget_adaptor_add_verify (GladeWidgetAdaptor *adaptor,
GObject *container,
GObject *child,
gboolean user_feedback)
{
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), FALSE);
g_return_val_if_fail (G_IS_OBJECT (container), FALSE);
g_return_val_if_fail (G_IS_OBJECT (child), FALSE);
g_return_val_if_fail (g_type_is_a (G_OBJECT_TYPE (container), adaptor->priv->type), FALSE);
return GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->add_verify (adaptor, container, child, user_feedback);
}
/**
* glade_widget_adaptor_add:
* @adaptor: A #GladeWidgetAdaptor
......
......@@ -295,9 +295,30 @@ typedef gboolean (* GladeChildVerifyPropertyFunc) (GladeWidgetAdaptor *adaptor,
const gchar *property_name,
const GValue *value);
/**
* GladeAddChildVerifyFunc:
* @adaptor: A #GladeWidgetAdaptor
* @parent: A #GObject container
* @child: A #GObject child
* @user_feedback: whether a notification dialog should be
* presented in the case that the child cannot not be added.
*
* Checks whether @child can be added to @parent.
*
* If @user_feedback is %TRUE and @child cannot be
* added then this shows a notification dialog to the user
* explaining why.
*
* Returns: whether @child can be added to @parent.
*/
typedef gboolean (* GladeAddChildVerifyFunc) (GladeWidgetAdaptor *adaptor,
GObject *parent,
GObject *child,
gboolean user_feedback);
/**
* GladeGetChildrenFunc:
* @adaptor: A #GladeWidgetAdaptor
* @container: A #GObject container
*
* A function called to get @containers children.
......@@ -309,6 +330,7 @@ typedef GList *(* GladeGetChildrenFunc) (GladeWidgetAdaptor *adaptor,
/**
* GladeAddChildFunc:
* @adaptor: A #GladeWidgetAdaptor
* @parent: A #GObject container
* @child: A #GObject child
*
......@@ -317,8 +339,10 @@ typedef GList *(* GladeGetChildrenFunc) (GladeWidgetAdaptor *adaptor,
typedef void (* GladeAddChildFunc) (GladeWidgetAdaptor *adaptor,
GObject *parent,
GObject *child);
/**
* GladeRemoveChildFunc:
* @adaptor: A #GladeWidgetAdaptor
* @parent: A #GObject container
* @child: A #GObject child
*
......@@ -330,6 +354,7 @@ typedef void (* GladeRemoveChildFunc) (GladeWidgetAdaptor *adaptor,
/**
* GladeReplaceChildFunc:
* @adaptor: A #GladeWidgetAdaptor
* @container: A #GObject container
* @old_obj: The old #GObject child
* @new_obj: The new #GObject child to take its place
......@@ -364,6 +389,7 @@ typedef GObject *(* GladeConstructObjectFunc) (GladeWidgetAdaptor *adaptor,
/**
* GladePostCreateFunc:
* @adaptor: A #GladeWidgetAdaptor
* @object: a #GObject
* @reason: a #GladeCreateReason
*
......@@ -376,6 +402,7 @@ typedef void (* GladePostCreateFunc) (GladeWidgetAdaptor *adaptor,
/**
* GladeGetInternalFunc:
* @adaptor: A #GladeWidgetAdaptor
* @parent: A #GObject composite object
* @name: A string identifier
*
......@@ -601,6 +628,7 @@ struct _GladeWidgetAdaptorClass
*/
GladeGetPropertyFunc get_property;
GladeAddChildVerifyFunc add_verify; /* Checks if a child can be added */
GladeAddChildFunc add; /* Adds a new child of this type */
GladeRemoveChildFunc remove; /* Removes a child from the container */
GladeGetChildrenFunc get_children; /* Returns a list of direct children for
......@@ -713,6 +741,10 @@ gboolean glade_widget_adaptor_verify_property (GladeWidgetAdapto
GObject *object,
const gchar *property_name,
const GValue *value);
gboolean glade_widget_adaptor_add_verify (GladeWidgetAdaptor *adaptor,
GObject *container,
GObject *child,
gboolean user_feedback);
void glade_widget_adaptor_add (GladeWidgetAdaptor *adaptor,
GObject *container,
GObject *child);
......
......@@ -2304,6 +2304,36 @@ glade_widget_copy_properties (GladeWidget * widget,
}
}
/**
* glade_widget_add_verify:
* @widget: A #GladeWidget
* @child: The child #GladeWidget to add
* @user_feedback: whether a notification dialog should be
* presented in the case that the child cannot not be added.
*
* Checks whether @child can be added to @parent.
*
* If @user_feedback is %TRUE and @child cannot be
* added then this shows a notification dialog to the user
* explaining why.
*
* Returns: whether @child can be added to @widget.
*/
gboolean
glade_widget_add_verify (GladeWidget *widget,
GladeWidget *child,
gboolean user_feedback)
{
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (GLADE_IS_WIDGET (child), FALSE);
return glade_widget_adaptor_add_verify (widget->priv->adaptor,
widget->priv->object,
child->priv->object,
user_feedback);
}
/**
* glade_widget_add_child:
* @parent: A #GladeWidget
......
......@@ -69,6 +69,10 @@ GType glade_widget_get_type (void);
GladeWidget *glade_widget_get_from_gobject (gpointer object);
gboolean glade_widget_add_verify (GladeWidget *parent,
GladeWidget *child,
gboolean user_feedback);
void glade_widget_add_child (GladeWidget *parent,
GladeWidget *child,
gboolean at_mouse);
......
......@@ -93,6 +93,7 @@ typedef struct _GladeProject GladeProject;
#define GLADE_TAG_POST_CREATE_FUNCTION "post-create-function"
#define GLADE_TAG_GET_INTERNAL_CHILD_FUNCTION "get-internal-child-function"
#define GLADE_TAG_ADD_CHILD_FUNCTION "add-child-function"
#define GLADE_TAG_ADD_CHILD_VERIFY_FUNCTION "add-child-verify-function"
#define GLADE_TAG_REMOVE_CHILD_FUNCTION "remove-child-function"
#define GLADE_TAG_GET_CHILDREN_FUNCTION "get-children-function"
#define GLADE_TAG_CHILD_SET_PROP_FUNCTION "child-set-property-function"
......
......@@ -1071,6 +1071,50 @@ glade_gtk_container_post_create (GladeWidgetAdaptor * adaptor,
}
}
gboolean
glade_gtk_container_add_verify (GladeWidgetAdaptor *adaptor,
GtkWidget *container,
GtkWidget *child,
gboolean user_feedback)
{
GladeWidget *gwidget = glade_widget_get_from_gobject (container);
if (GTK_IS_WINDOW (child))
{
if (user_feedback)
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO, NULL,
_("Cannot add a toplevel window to a containter."));
return FALSE;
}
else if (!GTK_IS_WIDGET (child) ||
GTK_IS_TOOL_ITEM (child) ||
GTK_IS_MENU_ITEM (child))
{
if (user_feedback)
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO, NULL,
_("Only widgets can be added to a %s."),
glade_widget_adaptor_get_title (adaptor));
return FALSE;
}
else if (GWA_USE_PLACEHOLDERS (adaptor) &&
glade_util_count_placeholders (gwidget) == 0)
{
if (user_feedback)
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO, NULL,
_("This %s has no placeholders available to add children."),
glade_widget_adaptor_get_title (adaptor));
return FALSE;
}
return TRUE;
}
void
glade_gtk_container_replace_child (GladeWidgetAdaptor * adaptor,
GtkWidget * container,
......@@ -6045,6 +6089,32 @@ glade_gtk_menu_constructor (GType type,
}
/* ----------------------------- GtkMenuShell ------------------------------ */
gboolean
glade_gtk_menu_shell_add_verify (GladeWidgetAdaptor *adaptor,
GtkWidget *container,
GtkWidget *child,
gboolean user_feedback)
{
if (!GTK_IS_MENU_ITEM (child))
{
if (user_feedback)
{
GladeWidgetAdaptor *menu_item_adaptor =
glade_widget_adaptor_get_by_type (GTK_TYPE_MENU_ITEM);
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO, NULL,
_("Only a %s can be added to a %s."),
glade_widget_adaptor_get_title (menu_item_adaptor),
glade_widget_adaptor_get_title (adaptor));
}
return FALSE;
}
return TRUE;
}
void
glade_gtk_menu_shell_add_child (GladeWidgetAdaptor * adaptor,
GObject * object, GObject * child)
......@@ -6645,6 +6715,44 @@ glade_gtk_menu_item_get_children (GladeWidgetAdaptor * adaptor,
return list;
}
gboolean
glade_gtk_menu_item_add_verify (GladeWidgetAdaptor *adaptor,
GtkWidget *container,
GtkWidget *child,
gboolean user_feedback)
{
if (!GTK_IS_MENU (child))
{
if (user_feedback)
{
GladeWidgetAdaptor *menu_adaptor =
glade_widget_adaptor_get_by_type (GTK_TYPE_MENU);
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO, NULL,
_("Only a %s can be added to a %s."),
glade_widget_adaptor_get_title (menu_adaptor),
glade_widget_adaptor_get_title (adaptor));
}
return FALSE;
}
else if (GTK_IS_SEPARATOR_MENU_ITEM (container))
{
if (user_feedback)
{
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO, NULL,
_("A %s cannot have any children."),
glade_widget_adaptor_get_title (adaptor));
}
return FALSE;
}
return TRUE;
}
void
glade_gtk_menu_item_add_child (GladeWidgetAdaptor * adaptor,
GObject * object, GObject * child)
......@@ -6724,48 +6832,6 @@ glade_gtk_menu_item_set_property (GladeWidgetAdaptor * adaptor,
}
/* ----------------------------- GtkImageMenuItem ------------------------------ */
GList *
glade_gtk_image_menu_item_get_children (GladeWidgetAdaptor * adaptor,
GObject * object)
{
GList *list = NULL;
GtkWidget *child;
GladeWidget *gitem;
gitem = glade_widget_get_from_gobject (object);
if ((child = gtk_menu_item_get_submenu (GTK_MENU_ITEM (object))))
list = g_list_append (list, child);
return list;
}
void
glade_gtk_image_menu_item_add_child (GladeWidgetAdaptor * adaptor,
GObject * object, GObject * child)
{
g_return_if_fail (GTK_IS_MENU_ITEM (object));
if (GTK_IS_IMAGE (child))
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (object),
GTK_WIDGET (child));
else
GWA_GET_CLASS (GTK_TYPE_MENU_ITEM)->add (adaptor, object, child);
}
void
glade_gtk_image_menu_item_remove_child (GladeWidgetAdaptor * adaptor,
GObject * object, GObject * child)
{
g_return_if_fail (GTK_IS_MENU_ITEM (object));
if (GTK_IS_IMAGE (child))
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (object), NULL);
else
GWA_GET_CLASS (GTK_TYPE_MENU_ITEM)->remove (adaptor, object, child);
}
static void
glade_gtk_image_menu_item_set_use_stock (GObject * object, const GValue * value)
{
......@@ -7248,6 +7314,32 @@ glade_gtk_toolbar_set_child_property (GladeWidgetAdaptor * adaptor,
property_name, value);
}
gboolean
glade_gtk_toolbar_add_verify (GladeWidgetAdaptor *adaptor,
GtkWidget *container,
GtkWidget *child,
gboolean user_feedback)
{
if (!GTK_IS_TOOL_ITEM (child))
{
if (user_feedback)
{
GladeWidgetAdaptor *tool_item_adaptor =
glade_widget_adaptor_get_by_type (GTK_TYPE_TOOL_ITEM);
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO, NULL,
_("Only a %s can be added to a %s."),
glade_widget_adaptor_get_title (tool_item_adaptor),
glade_widget_adaptor_get_title (adaptor));
}
return FALSE;
}
return TRUE;
}
void
glade_gtk_toolbar_add_child (GladeWidgetAdaptor * adaptor,
GObject * object, GObject * child)
......@@ -7416,6 +7508,32 @@ glade_gtk_tool_palette_set_child_property (GladeWidgetAdaptor * adaptor,
property_name, value);
}
gboolean
glade_gtk_tool_palette_add_verify (GladeWidgetAdaptor *adaptor,
GtkWidget *container,
GtkWidget *child,
gboolean user_feedback)
{
if (!GTK_IS_TOOL_ITEM_GROUP (child))
{
if (user_feedback)
{
GladeWidgetAdaptor *tool_item_group_adaptor =
glade_widget_adaptor_get_by_type (GTK_TYPE_TOOL_ITEM_GROUP);
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO, NULL,
_("Only a %s can be added to a %s."),
glade_widget_adaptor_get_title (tool_item_group_adaptor),
glade_widget_adaptor_get_title (adaptor));
}
return FALSE;
}
return TRUE;
}
void
glade_gtk_tool_palette_add_child (GladeWidgetAdaptor * adaptor,
GObject * object, GObject * child)
......@@ -7521,6 +7639,32 @@ glade_gtk_tool_palette_action_activate (GladeWidgetAdaptor * adaptor,
}
/* ----------------------------- GtkToolItemGroup ------------------------------ */
gboolean
glade_gtk_tool_item_group_add_verify (GladeWidgetAdaptor *adaptor,
GtkWidget *container,
GtkWidget *child,
gboolean user_feedback)
{
if (!GTK_IS_TOOL_ITEM (child))
{
if (user_feedback)
{
GladeWidgetAdaptor *tool_item_adaptor =
glade_widget_adaptor_get_by_type (GTK_TYPE_TOOL_ITEM);
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO, NULL,
_("Only a %s can be added to a %s."),
glade_widget_adaptor_get_title (tool_item_adaptor),
glade_widget_adaptor_get_title (adaptor));
}
return FALSE;
}
return TRUE;
}
void
glade_gtk_tool_item_group_add_child (GladeWidgetAdaptor * adaptor,
GObject * object, GObject * child)
......@@ -7890,6 +8034,32 @@ glade_gtk_menu_tool_button_get_children (GladeWidgetAdaptor * adaptor,
return list;
}
gboolean
glade_gtk_menu_tool_button_add_verify (GladeWidgetAdaptor *adaptor,
GtkWidget *container,
GtkWidget *child,
gboolean user_feedback)
{
if (!GTK_IS_MENU (child))
{
if (user_feedback)
{
GladeWidgetAdaptor *menu_adaptor =
glade_widget_adaptor_get_by_type (GTK_TYPE_MENU);
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO, NULL,
_("Only a %s can be added to a %s."),
glade_widget_adaptor_get_title (menu_adaptor),
glade_widget_adaptor_get_title (adaptor));
}
return FALSE;
}
return TRUE;
}
void
glade_gtk_menu_tool_button_add_child (GladeWidgetAdaptor * adaptor,
GObject * object, GObject * child)
......@@ -7901,8 +8071,6 @@ glade_gtk_menu_tool_button_add_child (GladeWidgetAdaptor * adaptor,
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (object),
GTK_WIDGET (child));
}
else
GWA_GET_CLASS (GTK_TYPE_TOOL_BUTTON)->add (adaptor, object, child);
}
void
......@@ -7915,8 +8083,6 @@ glade_gtk_menu_tool_button_remove_child (GladeWidgetAdaptor * adaptor,
g_object_set_data (child, "special-child-type", NULL);
}
else
GWA_GET_CLASS (GTK_TYPE_TOOL_BUTTON)->remove (adaptor, object, child);
}
void
......@@ -10939,6 +11105,32 @@ glade_gtk_cell_renderer_read_widget (GladeWidgetAdaptor * adaptor,
}
/*--------------------------- GtkCellLayout ---------------------------------*/
gboolean
glade_gtk_cell_layout_add_verify (GladeWidgetAdaptor *adaptor,
GtkWidget *container,
GtkWidget *child,
gboolean user_feedback)
{
if (!GTK_IS_CELL_RENDERER (child))
{
if (user_feedback)
{
GladeWidgetAdaptor *cell_adaptor =
glade_widget_adaptor_get_by_type (GTK_TYPE_CELL_RENDERER);
glade_util_ui_message (glade_app_get_window (),
GLADE_UI_INFO, NULL,
_("Only a %s can be added to a %s."),
glade_widget_adaptor_get_title (cell_adaptor),
glade_widget_adaptor_get_title (adaptor));
}
return FALSE;
}
return TRUE;
}
void
glade_gtk_cell_layout_add_child (GladeWidgetAdaptor * adaptor,
GObject * container, GObject * child)
......@@ -11659,6 +11851,32 @@ glade_gtk_action_post_create (GladeWidgetAdaptor * adaptor,
}
/*--------------------------- GtkActionGroup ---------------------------------*/