Commit b9d02962 authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte

added gladeui/glade-widget-action.[ch]

* gladeui/Makefile.am: added gladeui/glade-widget-action.[ch]

* gladeui/glade-popup.[ch]:
  - added glade_popup_action_populate_menu()

  - adapted popup code to reflect action changes.

* gladeui/glade-widget-action.[ch]: GladeWidgetAction GObject sources.

* gladeui/glade-widget-adaptor.[ch]:

  - action-activated signal removed

  - added GladeActionActivateFunc

  - added glade_widget_adaptor_action_add() and glade_widget_adaptor_action_remove()

  - glade_widget_adaptor_action_activate() reworked. 

  - load symbol and other catalog stuff in gwa_derived_class_init()

  - added the posibility to override GObject constructor from the catalog.
    This is a good place to add/remove actions, use GWA_GET_OCLASS() to chain up.

* gladeui/glade-widget.[ch]:
  - removed action-activated signal

  - added glade_widget_get_action (), glade_widget_remove_action() and
    glade_widget_create_action_menu()

* gladeui/glade-xml-utils.h: added GLADE_TAG_ACTION_ACTIVATE_FUNCTION and 
  GLADE_TAG_CONSTRUCTOR_FUNCTION tags

* plugins/gtk+/glade-gtk.c:
  - added glade_gtk_menu_shell_action_activate() glade_gtk_menu_item_action_activate()
    and glade_gtk_toolbar_action_activate()

  - removed glade_gtk_menu_post_create() and glade_gtk_menu_launch_editor_action()

* plugins/gtk+/gtk+.xml.in:
  - glade_gtk_menu_post_create() removed

  - added action-activate-function for MenuShell MenuItem and Toolbar.


svn path=/trunk/; revision=1325
parent 4e6685d2
2007-05-23 Juan Pablo Ugarte <juanpablougarte@gmail.com>
* gladeui/Makefile.am: added gladeui/glade-widget-action.[ch]
* gladeui/glade-popup.[ch]:
- added glade_popup_action_populate_menu()
- adapted popup code to reflect action changes.
* gladeui/glade-widget-action.[ch]: GladeWidgetAction GObject sources.
* gladeui/glade-widget-adaptor.[ch]:
- action-activated signal removed
- added GladeActionActivateFunc
- added glade_widget_adaptor_action_add() and glade_widget_adaptor_action_remove()
- glade_widget_adaptor_action_activate() reworked.
- load symbol and other catalog stuff in gwa_derived_class_init()
- added the posibility to override GObject constructor from the catalog.
This is a good place to add/remove actions, use GWA_GET_OCLASS() to chain up.
* gladeui/glade-widget.[ch]:
- removed action-activated signal
- added glade_widget_get_action (), glade_widget_remove_action() and
glade_widget_create_action_menu()
* gladeui/glade-xml-utils.h: added GLADE_TAG_ACTION_ACTIVATE_FUNCTION and
GLADE_TAG_CONSTRUCTOR_FUNCTION tags
* plugins/gtk+/glade-gtk.c:
- added glade_gtk_menu_shell_action_activate() glade_gtk_menu_item_action_activate()
and glade_gtk_toolbar_action_activate()
- removed glade_gtk_menu_post_create() and glade_gtk_menu_launch_editor_action()
* plugins/gtk+/gtk+.xml.in:
- glade_gtk_menu_post_create() removed
- added action-activate-function for MenuShell MenuItem and Toolbar.
2007-05-18 Juan Pablo Ugarte <juanpablougarte@gmail.com>
* Patch reaplied with the missing '}' :S (bug 435912)
......
......@@ -63,7 +63,8 @@ libgladeui_1_la_SOURCES = \
glade-popup.h \
glade-catalog.h \
glade-marshallers.h \
glade-accumulators.h
glade-accumulators.h \
glade-widget-action.c
libgladeui_1_la_CPPFLAGS = \
$(common_defines) \
......@@ -113,6 +114,7 @@ libgladeuiinclude_HEADERS = \
glade-parser.h \
glade-signal.h \
glade-cursor.h \
glade-widget-action.h \
fixed_bg.xpm
......
......@@ -176,62 +176,81 @@ glade_popup_append_item (GtkWidget *popup_menu,
static void
glade_popup_menuitem_activated (GtkMenuItem *item, GladeWidget *widget)
glade_popup_menuitem_activated (GtkMenuItem *item, const gchar *action_path)
{
gchar *detail;
GladeWidget *widget;
if ((detail = g_object_get_data (G_OBJECT (item), "menuitem_detail")))
glade_widget_adaptor_action_activate (widget, detail);
if ((widget = g_object_get_data (G_OBJECT (item), "glade-widget")))
glade_widget_adaptor_action_activate (widget->adaptor,
widget->object,
action_path);
}
static void
glade_popup_add_actions_recurse (GtkWidget *menu, GladeWidget *widget, GList *actions)
static gint
glade_popup_action_populate_menu_real (GtkWidget *menu,
GladeWidget *widget,
GladeWidgetAction *action)
{
GList *list;
GtkWidget *item;
GList *list;
gint n = 0;
for (list = widget->adaptor->actions; list; list = g_list_next (list))
for (list = (action) ? action->actions : widget->actions;
list;
list = g_list_next (list))
{
GWAAction *action = list->data;
GladeWidgetAction *a = list->data;
GtkWidget *submenu = NULL;
if (action->actions)
if (a->actions)
{
submenu = gtk_menu_new ();
glade_popup_add_actions_recurse (submenu, widget, action->actions);
n += glade_popup_action_populate_menu (submenu, widget, a);
}
if (action->is_a_group && submenu == NULL) continue;
item = glade_popup_append_item (menu,
action->stock,
action->label, TRUE,
(action->is_a_group) ? NULL : glade_popup_menuitem_activated,
(action->is_a_group) ? NULL : widget);
if (action->is_a_group == FALSE)
g_object_set_data (G_OBJECT (item), "menuitem_detail", action->id);
a->klass->stock,
a->klass->label, TRUE,
(a->actions) ? NULL : glade_popup_menuitem_activated,
(a->actions) ? NULL : a->klass->path);
g_object_set_data (G_OBJECT (item), "glade-widget", widget);
gtk_widget_set_sensitive (item, a->sensitive);
if (submenu)
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
n++;
}
return n;
}
static void
glade_popup_add_actions (GtkWidget *menu, GladeWidget *widget)
/*
* glade_popup_action_populate_menu:
* @menu: a GtkMenu to put the actions menu items.
* @widget: A #GladeWidget
* @action: a @widget subaction or NULL to include all actions.
*
* Populate a GtkMenu with widget's actions
*
* Returns the number of action appended to the menu.
*/
gint
glade_popup_action_populate_menu (GtkWidget *menu,
GladeWidget *widget,
GladeWidgetAction *action)
{
GtkWidget *separator;
if (widget->adaptor->actions)
g_return_val_if_fail (GTK_IS_MENU (menu), 0);
g_return_val_if_fail (GLADE_IS_WIDGET (widget), 0);
if (action)
{
separator = gtk_menu_item_new ();
gtk_widget_show (separator);
gtk_menu_shell_append (GTK_MENU_SHELL (menu),
separator);
glade_popup_add_actions_recurse (menu, widget, widget->adaptor->actions);
g_return_val_if_fail (GLADE_IS_WIDGET_ACTION (action), 0);
if (action != glade_widget_get_action (widget, action->klass->path))
return 0;
}
return glade_popup_action_populate_menu_real (menu, widget, action);
}
static GtkWidget *
......@@ -256,7 +275,14 @@ glade_popup_create_menu (GladeWidget *widget)
glade_popup_append_item (popup_menu, GTK_STOCK_DELETE, NULL, TRUE,
glade_popup_delete_cb, widget);
glade_popup_add_actions (popup_menu, widget);
if (widget->actions)
{
GtkWidget *separator = gtk_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), separator);
gtk_widget_show (separator);
glade_popup_action_populate_menu (popup_menu, widget, NULL);
}
return popup_menu;
}
......
......@@ -7,6 +7,7 @@ G_BEGIN_DECLS
void glade_popup_widget_pop (GladeWidget *widget, GdkEventButton *event);
void glade_popup_placeholder_pop (GladePlaceholder *placeholder, GdkEventButton *event);
void glade_popup_clipboard_pop (GladeWidget *widget, GdkEventButton *event);
gint glade_popup_action_populate_menu (GtkWidget *menu, GladeWidget *widget, GladeWidgetAction *action);
G_END_DECLS
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2007 Juan Pablo Ugarte.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Authors:
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
*/
#include "glade-widget-action.h"
enum
{
PROP_0,
PROP_KLASS,
PROP_SENSITIVE
};
static GObjectClass* parent_class = NULL;
G_DEFINE_TYPE (GladeWidgetAction, glade_widget_action, G_TYPE_OBJECT);
static void
glade_widget_action_init (GladeWidgetAction *object)
{
object->sensitive = TRUE;
object->actions = NULL;
}
static void
glade_widget_action_finalize (GObject *object)
{
GladeWidgetAction *action = GLADE_WIDGET_ACTION (object);
if (action->actions)
{
g_list_foreach (action->actions, (GFunc)g_object_unref, NULL);
g_list_free (action->actions);
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static GObject *
glade_widget_action_constructor(GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
GladeWidgetAction *action;
GObject *object;
GList *l;
object = G_OBJECT_CLASS (parent_class)->constructor (type,
n_construct_properties,
construct_properties);
action = GLADE_WIDGET_ACTION (object);
if (action->klass == NULL)
{
g_warning ("GLadeWidgetAction constructed without klass properties");
return object;
}
for (l = action->klass->actions; l; l = g_list_next (l))
{
GWActionClass *action_class = l->data;
GObject *obj = g_object_new (GLADE_TYPE_WIDGET_ACTION,
"klass", action_class,
NULL);
action->actions = g_list_prepend (action->actions,
GLADE_WIDGET_ACTION (obj));
}
action->actions = g_list_reverse (action->actions);
return object;
}
static void
glade_widget_action_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
GladeWidgetAction *action = GLADE_WIDGET_ACTION (object);
g_return_if_fail (GLADE_IS_WIDGET_ACTION (object));
switch (prop_id)
{
case PROP_KLASS:
action->klass = g_value_get_pointer (value);
break;
case PROP_SENSITIVE:
action->sensitive = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
glade_widget_action_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
GladeWidgetAction *action = GLADE_WIDGET_ACTION (object);
g_return_if_fail (GLADE_IS_WIDGET_ACTION (object));
switch (prop_id)
{
case PROP_KLASS:
g_value_set_pointer (value, action->klass);
break;
case PROP_SENSITIVE:
g_value_set_boolean (value, action->sensitive);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
glade_widget_action_class_init (GladeWidgetActionClass *klass)
{
GObjectClass* object_class = G_OBJECT_CLASS (klass);
parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
object_class->constructor = glade_widget_action_constructor;
object_class->finalize = glade_widget_action_finalize;
object_class->set_property = glade_widget_action_set_property;
object_class->get_property = glade_widget_action_get_property;
g_object_class_install_property (object_class,
PROP_KLASS,
g_param_spec_pointer ("klass",
"class",
"GladeWidgetActionClass",
G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_SENSITIVE,
g_param_spec_boolean ("sensitive",
"Sensitive",
"Wheater or not this action is sensitive",
TRUE,
G_PARAM_READABLE | G_PARAM_WRITABLE));
}
/**
* glade_widegt_action_class_free:
* @action: a GWActionClass
*
* Frees a GWActionClass.
*/
void
glade_widget_action_class_free (GWActionClass *action)
{
if (action->actions)
g_list_foreach (action->actions, (GFunc)glade_widget_action_class_free, NULL);
/*Dont free id since it points to path*/
g_free (action->path);
g_free (action->label);
g_free (action->stock);
g_free (action);
}
/**
* glade_widget_action_class_clone:
* @action: a GWActionClass
*
* Returns: a newlly allocated copy of @action.
*/
GWActionClass *
glade_widget_action_class_clone (GWActionClass *action)
{
GWActionClass *copy;
GList *l;
g_return_val_if_fail (action != NULL, NULL);
copy = g_new0 (GWActionClass, 1);
copy->id = g_strdup (action->id);
copy->label = g_strdup (action->label);
copy->stock = g_strdup (action->stock);
for (l = action->actions; l; l = g_list_next (l))
{
GWActionClass *child = glade_widget_action_class_clone (l->data);
copy->actions = g_list_append (copy->actions, child);
}
return copy;
}
/**
* glade_widget_action_remove:
* @action: a #GladeWidgetAction
* @child: a #GladeWidgetAction
*
* Remove an action.
*
* Returns: whether or not @child was removed from @action.
*/
gboolean
glade_widget_action_remove (GladeWidgetAction *action,
GladeWidgetAction *child)
{
GList *l;
g_return_val_if_fail (GLADE_IS_WIDGET_ACTION (action), FALSE);
g_return_val_if_fail (GLADE_IS_WIDGET_ACTION (child), FALSE);
for (l = action->actions; l; l = g_list_next (l))
{
if (child == l->data)
{
action->actions = g_list_remove (action->actions, child);
return TRUE;
}
}
return FALSE;
}
/**
* glade_widget_action_set_sensitive:
* @action: a #GladeWidgetAction
* @sensitive:
*
* Set whether or not this action is sensitive.
*
*/
void
glade_widget_action_set_sensitive (GladeWidgetAction *action, gboolean sensitive)
{
g_return_if_fail (GLADE_IS_WIDGET_ACTION (action));
g_object_set (G_OBJECT (action), "sensitive", sensitive, NULL);
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2007 Juan Pablo Ugarte.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Authors:
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
*/
#ifndef _GLADE_WIDGET_ACTION_H_
#define _GLADE_WIDGET_ACTION_H_
#include <glib-object.h>
G_BEGIN_DECLS
#define GLADE_TYPE_WIDGET_ACTION (glade_widget_action_get_type ())
#define GLADE_WIDGET_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_WIDGET_ACTION, GladeWidgetAction))
#define GLADE_WIDGET_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_WIDGET_ACTION, GladeWidgetActionClass))
#define GLADE_IS_WIDGET_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_WIDGET_ACTION))
#define GLADE_IS_WIDGET_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_WIDGET_ACTION))
#define GLADE_WIDGET_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_WIDGET_ACTION, GladeWidgetActionClass))
typedef struct _GladeWidgetActionClass GladeWidgetActionClass;
typedef struct _GladeWidgetAction GladeWidgetAction;
typedef struct _GWActionClass GWActionClass;
struct _GWActionClass
{
gchar *id; /* The identifier of this action in the action tree */
gchar *path; /* Full action path */
gchar *label; /* A translated label to show in the UI for this action */
gchar *stock; /* If set, this stock item will be shown in the UI along side
* the label */
GList *actions; /* Recursive list of child actions */
};
struct _GladeWidgetActionClass
{
GObjectClass parent_class;
};
struct _GladeWidgetAction
{
GObject parent_instance;
GWActionClass *klass; /* The action class */
gboolean sensitive; /* If this action is sensitive or not */
GList *actions; /* List of actions */
};
GType glade_widget_action_get_type (void) G_GNUC_CONST;
void glade_widget_action_class_free (GWActionClass *action);
GWActionClass *glade_widget_action_class_clone (GWActionClass *action);
gboolean glade_widget_action_remove (GladeWidgetAction *action,
GladeWidgetAction *child);
G_END_DECLS
#endif /* _GLADE_WIDGET_ACTION_H_ */
This diff is collapsed.
......@@ -26,7 +26,6 @@ typedef struct _GladeWidgetAdaptor GladeWidgetAdaptor;
typedef struct _GladeWidgetAdaptorPrivate GladeWidgetAdaptorPrivate;
typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
typedef struct _GladeSignalClass GladeSignalClass;
typedef struct _GWAAction GWAAction;
/**
* GWA_IS_FIXED:
......@@ -92,6 +91,14 @@ typedef struct _GWAAction GWAAction;
(GladeWidgetAdaptorClass *)g_type_class_peek (GLADE_TYPE_WIDGET_ADAPTOR) : \
GLADE_WIDGET_ADAPTOR_GET_CLASS (glade_widget_adaptor_get_by_type(type)))
/**
* GWA_GET_OCLASS:
* @type: A #GType.
*
* Same as GWA_GET_CLASS but casted to GObjectClass
*/
#define GWA_GET_OCLASS(type) ((GObjectClass*)GWA_GET_CLASS(type))
#define GLADE_VALID_CREATE_REASON(reason) (reason >= 0 && reason < GLADE_CREATE_REASONS)
......@@ -302,6 +309,18 @@ typedef GObject *(* GladeGetInternalFunc) (GladeWidgetAdaptor *adaptor,
GObject *parent,
const gchar *name);
/**
* GladeActionActivatedFunc:
* @adaptor: A #GladeWidgetAdaptor
* @object: The #GObject
* @action_id: The action identifier
*
* This delagate function is used to catch actions from the core.
*
*/
typedef void (* GladeActionActivateFunc) (GladeWidgetAdaptor *adaptor,
GObject *object,
const gchar *action_id);
/* GladeSignalClass contains all the info we need for a given signal, such as
* the signal name, and maybe more in the future
......@@ -316,17 +335,6 @@ struct _GladeSignalClass
};
struct _GWAAction
{
gchar *id; /* The identifier of this action in the action tree */
gchar *label; /* A translated label to show in the UI for this action */
gchar *stock; /* If set, this stock item will be shown in the UI along side
* the label */
gboolean is_a_group; /* Marks whether this action is a group and can have children */
GList *actions; /* Recursive list of child actions */
};
/* Note that everything that must be processed at the creation of
* every instance is managed on the instance structure, and everywhere
* that we want to take advantage of inheritance is handled in the class
......@@ -369,7 +377,7 @@ struct _GladeWidgetAdaptor
GList *child_packings; /* Default packing property values */
GList *actions; /* A list of GWAAction */
GList *actions; /* A list of GWActionClass */
GladeWidgetAdaptorPrivate *priv;
......@@ -442,8 +450,8 @@ struct _GladeWidgetAdaptorClass
* replace a placeholder with
* a widget and viceversa.
*/
/* Signals */
gboolean (*action_activated) (GladeWidgetAdaptor *, GladeWidget *, const gchar *);
GladeActionActivateFunc action_activate; /* This method is used to catch actions */
};
#define glade_widget_adaptor_create_widget(adaptor, query, ...) \
......@@ -564,13 +572,19 @@ gchar *glade_widget_adaptor_get_packing_default(GladeWidgetAdaptor
GladeWidgetAdaptor *parent_adaptor,
const gchar *propert_id);
void glade_widget_adaptor_action_activate (GladeWidget *widget,
const gchar *action_id);
gboolean glade_widget_adaptor_is_container (GladeWidgetAdaptor *adaptor);
gboolean glade_widget_adaptor_action_add (GladeWidgetAdaptor *adaptor,
const gchar *action_path,
const gchar *label,
const gchar *stock);
gboolean glade_widget_adaptor_action_remove (GladeWidgetAdaptor *adaptor,
const gchar *action_path);
void glade_widget_adaptor_action_activate (GladeWidgetAdaptor *adaptor,
GObject *object,
const gchar *action_path);
G_END_DECLS
#endif /* __GLADE_WIDGET_ADAPTOR_H__ */
......@@ -45,6 +45,7 @@
#include "glade-editor.h"
#include "glade-app.h"
#include "glade-design-view.h"
#include "glade-widget-action.h"
......@@ -74,7 +75,6 @@ enum
BUTTON_PRESS_EVENT,
BUTTON_RELEASE_EVENT,
MOTION_NOTIFY_EVENT,
ACTION_ACTIVATED,
LAST_SIGNAL
};
......@@ -754,6 +754,12 @@ glade_widget_dispose (GObject *object)
g_list_foreach (widget->packing_properties, (GFunc)g_object_unref, NULL);
g_list_free (widget->packing_properties);
}
if (widget->actions)
{
g_list_foreach (widget->actions, (GFunc)g_object_unref, NULL);
g_list_free (widget->actions);
}
if (G_OBJECT_CLASS(parent_class)->dispose)
G_OBJECT_CLASS(parent_class)->dispose(object);
......@@ -1149,27 +1155,6 @@ glade_widget_class_init (GladeWidgetClass *klass)
glade_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* GladeWidget::action-activated:
* @widget: the #GladeWidget which received the signal.
* @action_id: the action id (signal detail) or NULL.
*
* Use this to catch up actions. This signal is proxied from
* GladeWidgetAdaptor's "action-emited" signal default handler.
*
* Returns TRUE to stop others handlers being invoked.
*
*/
glade_widget_signals [ACTION_ACTIVATED] =
g_signal_new ("action-activated",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
G_STRUCT_OFFSET (GladeWidgetClass, action_activated),
glade_boolean_handled_accumulator, NULL,
glade_marshal_BOOLEAN__STRING,
G_TYPE_BOOLEAN, 1, G_TYPE_STRING);
}
GType
......@@ -1641,6 +1626,23 @@ glade_widget_set_properties (GladeWidget *widget, GList *properties)
}
}
static void
glade_widget_set_actions (GladeWidget *widget, GladeWidgetAdaptor *adaptor)
{
GList *l;
for (l = adaptor->actions; l; l = g_list_next (l))
{
GWActionClass *action = l->data;
GObject *obj = g_object_new (GLADE_TYPE_WIDGET_ACTION,
"klass", action, NULL);
widget->actions = g_list_prepend (widget->actions,
GLADE_WIDGET_ACTION (obj));
}
widget->actions = g_list_reverse (widget->actions);
}
static void
glade_widget_set_adaptor (GladeWidget *widget, GladeWidgetAdaptor *adaptor)
{
......@@ -1674,6 +1676,9 @@ glade_widget_set_adaptor (GladeWidget *widget, GladeWidgetAdaptor *adaptor)
}
widget->properties = g_list_reverse (widget->properties);
}
/* Create actions from adaptor */
glade_widget_set_actions (widget, adaptor);
}
/* Connects a signal handler to the 'event' signal for a widget and
......@@ -3809,6 +3814,96 @@ glade_widget_placeholder_relation (GladeWidget *parent,
GWA_USE_PLACEHOLDERS (parent->adaptor));
}
static GladeWidgetAction *
glade_widget_action_lookup (GList **actions, const gchar *path, gboolean remove)
{
GList *l;
for (l = *actions; l; l = g_list_next (l))
{
GladeWidgetAction *action = l->data;
if (strcmp (action->klass->path, path) == 0)