Commit 3fabe724 authored by Corentin Noël's avatar Corentin Noël Committed by Alberto Fanjul
Browse files

Rename GWActionClass to GladeWidgetActionDef to use the right namespace

parent a543e990
......@@ -1485,7 +1485,7 @@ GLADE_ENUM_DATA_TAG
<TITLE>GladeWidgetAction</TITLE>
GladeWidgetAction
glade_widget_action_get_children
glade_widget_action_get_class
glade_widget_action_get_def
glade_widget_action_set_sensitive
glade_widget_action_get_sensitive
glade_widget_action_get_visible
......@@ -1502,16 +1502,18 @@ GladeWidgetActionPrivate
</SECTION>
<SECTION>
<FILE>gw-action-class</FILE>
<TITLE>GWActionClass</TITLE>
GWActionClass
glade_widget_action_class_new
glade_widget_action_class_free
glade_widget_action_class_clone
glade_widget_action_class_set_important
glade_widget_action_class_set_label
glade_widget_action_class_set_stock
<FILE>glade-widget-action-def</FILE>
<TITLE>GladeWidgetActionDef</TITLE>
GladeWidgetActionDef
glade_widget_action_def_new
glade_widget_action_def_free
glade_widget_action_def_clone
glade_widget_action_def_set_important
glade_widget_action_def_set_label
glade_widget_action_def_set_stock
<SUBSECTION Standard>
GLADE_WIDGET_ACTION_DEF
glade_widget_action_def_get_type
</SECTION>
<SECTION>
......
......@@ -237,10 +237,10 @@ glade_popup_action_populate_menu_real (GtkWidget *menu,
for (list = actions; list; list = g_list_next (list))
{
GladeWidgetAction *action = list->data;
GWActionClass *aclass = glade_widget_action_get_class (action);
GList *children = glade_widget_action_get_children (action);
GtkWidget *submenu = NULL;
GladeWidgetAction *action = list->data;
GladeWidgetActionDef *adef = glade_widget_action_get_def (action);
GList *children = glade_widget_action_get_children (action);
GtkWidget *submenu = NULL;
if (!glade_widget_action_get_visible (action))
continue;
......@@ -256,12 +256,12 @@ glade_popup_action_populate_menu_real (GtkWidget *menu,
else
submenu = glade_widget_adaptor_action_submenu (glade_widget_get_adaptor (gwidget),
glade_widget_get_object (gwidget),
aclass->path);
adef->path);
item = glade_popup_append_item (menu, aclass->label, TRUE,
item = glade_popup_append_item (menu, adef->label, TRUE,
(children) ? NULL : callback,
(children) ? NULL : aclass->path);
(children) ? NULL : adef->path);
g_object_set_data (G_OBJECT (item), "gwa-data", data);
......@@ -302,10 +302,10 @@ glade_popup_action_populate_menu (GtkWidget *menu,
if (action)
{
GWActionClass *aclass = glade_widget_action_get_class (action);
GList *children = glade_widget_action_get_children (action);
GladeWidgetActionDef *adef = glade_widget_action_get_def (action);
GList *children = glade_widget_action_get_children (action);
if (glade_widget_get_action (widget, aclass->path) &&
if (glade_widget_get_action (widget, adef->path) &&
glade_widget_action_get_visible (action))
return glade_popup_action_populate_menu_real (menu,
widget,
......@@ -314,7 +314,7 @@ glade_popup_action_populate_menu (GtkWidget *menu,
(glade_popup_menuitem_activated),
widget);
if (glade_widget_get_pack_action (widget, aclass->path) &&
if (glade_widget_get_pack_action (widget, adef->path) &&
glade_widget_action_get_visible (action))
return glade_popup_action_populate_menu_real (menu,
glade_widget_get_parent
......
......@@ -37,7 +37,7 @@ enum
{
PROP_0,
PROP_CLASS,
PROP_DEFINITION,
PROP_SENSITIVE,
PROP_VISIBLE,
N_PROPERTIES
......@@ -45,16 +45,16 @@ enum
struct _GladeWidgetActionPrivate
{
GWActionClass *klass; /* The action class */
GList *actions; /* List of actions */
guint sensitive : 1; /* If this action is sensitive or not */
guint visible : 1; /* If this action is visible or not */
GladeWidgetActionDef *def; /* The action class */
GList *actions; /* List of actions */
guint sensitive : 1; /* If this action is sensitive or not */
guint visible : 1; /* If this action is visible or not */
};
static GParamSpec *properties[N_PROPERTIES];
G_DEFINE_TYPE_WITH_PRIVATE (GladeWidgetAction, glade_widget_action, G_TYPE_OBJECT);
G_DEFINE_BOXED_TYPE (GWActionClass, glade_widget_action_class, glade_widget_action_class_clone, glade_widget_action_class_free);
G_DEFINE_BOXED_TYPE (GladeWidgetActionDef, glade_widget_action_def, glade_widget_action_def_clone, glade_widget_action_def_free);
static void
glade_widget_action_init (GladeWidgetAction *object)
......@@ -94,17 +94,17 @@ glade_widget_action_constructor (GType type,
action = GLADE_WIDGET_ACTION (object);
if (action->priv->klass == NULL)
if (action->priv->def == NULL)
{
g_warning ("GladeWidgetAction constructed without class property");
g_warning ("GladeWidgetAction constructed without definition property");
return object;
}
for (l = action->priv->klass->actions; l; l = g_list_next (l))
for (l = action->priv->def->actions; l; l = g_list_next (l))
{
GWActionClass *action_class = l->data;
GladeWidgetActionDef *action_def = l->data;
GObject *obj = g_object_new (GLADE_TYPE_WIDGET_ACTION,
"class", action_class,
"definition", action_def,
NULL);
action->priv->actions = g_list_prepend (action->priv->actions,
......@@ -128,8 +128,8 @@ glade_widget_action_set_property (GObject *object,
switch (prop_id)
{
case PROP_CLASS:
action->priv->klass = g_value_get_pointer (value);
case PROP_DEFINITION:
action->priv->def = g_value_get_pointer (value);
break;
case PROP_SENSITIVE:
glade_widget_action_set_sensitive (action, g_value_get_boolean (value));
......@@ -155,8 +155,8 @@ glade_widget_action_get_property (GObject *object,
switch (prop_id)
{
case PROP_CLASS:
g_value_set_pointer (value, action->priv->klass);
case PROP_DEFINITION:
g_value_set_pointer (value, action->priv->def);
break;
case PROP_SENSITIVE:
g_value_set_boolean (value, action->priv->sensitive);
......@@ -180,10 +180,10 @@ glade_widget_action_class_init (GladeWidgetActionClass *klass)
object_class->set_property = glade_widget_action_set_property;
object_class->get_property = glade_widget_action_get_property;
properties[PROP_CLASS] =
g_param_spec_pointer ("class",
_("class"),
_("GladeWidgetActionClass structure pointer"),
properties[PROP_DEFINITION] =
g_param_spec_pointer ("definition",
_("Definition"),
_("GladeWidgetActionDef structure pointer"),
G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE);
properties[PROP_SENSITIVE] =
......@@ -252,7 +252,7 @@ glade_widget_action_get_visible (GladeWidgetAction *action)
* glade_widget_action_get_children:
* @action: a #GladeWidgetAction
*
* Returns: (transfer none) (element-type GWActionClass): a list of #GWActionClass
* Returns: (transfer none) (element-type GladeWidgetActionDef): a list of #GladeWidgetActionDef
*/
GList *
glade_widget_action_get_children (GladeWidgetAction *action)
......@@ -262,16 +262,16 @@ glade_widget_action_get_children (GladeWidgetAction *action)
return action->priv->actions;
}
GWActionClass *
glade_widget_action_get_class (GladeWidgetAction *action)
GladeWidgetActionDef *
glade_widget_action_get_def (GladeWidgetAction *action)
{
g_return_val_if_fail (GLADE_IS_WIDGET_ACTION (action), NULL);
return action->priv->klass;
return action->priv->def;
}
/***************************************************************
* GWActionClass *
* GladeWidgetActionDef *
***************************************************************/
static const gchar *
gwa_action_path_get_id (const gchar *action_path)
......@@ -285,17 +285,17 @@ gwa_action_path_get_id (const gchar *action_path)
}
/**
* glade_widget_action_class_new:
* glade_widget_action_def_new:
* @path: the action path
*
* Returns: a newlly created #GWActionClass for @path.
* Returns: a newlly created #GladeWidgetActionDef for @path.
*/
GWActionClass *
glade_widget_action_class_new (const gchar *path)
GladeWidgetActionDef *
glade_widget_action_def_new (const gchar *path)
{
GWActionClass *action;
GladeWidgetActionDef *action;
action = g_slice_new0 (GWActionClass);
action = g_slice_new0 (GladeWidgetActionDef);
action->path = g_strdup (path);
action->id = gwa_action_path_get_id (action->path);
......@@ -303,27 +303,27 @@ glade_widget_action_class_new (const gchar *path)
}
/**
* glade_widget_action_class_clone:
* @action: a GWActionClass
* glade_widget_action_def_clone:
* @action: a GladeWidgetActionDef
*
* Returns: a newlly allocated copy of @action.
*/
GWActionClass *
glade_widget_action_class_clone (GWActionClass *action)
GladeWidgetActionDef *
glade_widget_action_def_clone (GladeWidgetActionDef *action)
{
GWActionClass *copy;
GladeWidgetActionDef *copy;
GList *l;
g_return_val_if_fail (action != NULL, NULL);
copy = glade_widget_action_class_new (action->path);
copy = glade_widget_action_def_new (action->path);
copy->label = g_strdup (action->label);
copy->stock = g_strdup (action->stock);
copy->important = action->important;
for (l = action->actions; l; l = g_list_next (l))
{
GWActionClass *child = glade_widget_action_class_clone (l->data);
GladeWidgetActionDef *child = glade_widget_action_def_clone (l->data);
copy->actions = g_list_prepend (copy->actions, child);
}
......@@ -333,17 +333,17 @@ glade_widget_action_class_clone (GWActionClass *action)
}
/**
* glade_widegt_action_class_free:
* @action: a GWActionClass
* glade_widget_action_def_free:
* @action: a GladeWidgetActionDef
*
* Frees a GWActionClass.
* Frees a GladeWidgetActionDef.
*/
void
glade_widget_action_class_free (GWActionClass *action)
glade_widget_action_def_free (GladeWidgetActionDef *action)
{
if (action->actions)
{
g_list_free_full (action->actions, (GDestroyNotify) glade_widget_action_class_free);
g_list_free_full (action->actions, (GDestroyNotify) glade_widget_action_def_free);
action->actions = NULL;
}
......@@ -352,28 +352,28 @@ glade_widget_action_class_free (GWActionClass *action)
g_clear_pointer (&action->label, g_free);
g_clear_pointer (&action->stock, g_free);
g_slice_free (GWActionClass, action);
g_slice_free (GladeWidgetActionDef, action);
}
void
glade_widget_action_class_set_label (GWActionClass *action,
const gchar *label)
glade_widget_action_def_set_label (GladeWidgetActionDef *action,
const gchar *label)
{
g_free (action->label);
action->label = g_strdup (label);
}
void
glade_widget_action_class_set_stock (GWActionClass *action,
const gchar *stock)
glade_widget_action_def_set_stock (GladeWidgetActionDef *action,
const gchar *stock)
{
g_free (action->stock);
action->stock = g_strdup (stock);
}
void
glade_widget_action_class_set_important (GWActionClass *action,
gboolean important)
glade_widget_action_def_set_important (GladeWidgetActionDef *action,
gboolean important)
{
action->important = important;
}
......@@ -32,13 +32,14 @@ G_BEGIN_DECLS
#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))
#define GLADE_TYPE_WIDGET_ACTION_DEF glade_widget_action_def_get_type ()
typedef struct _GladeWidgetActionClass GladeWidgetActionClass;
typedef struct _GladeWidgetAction GladeWidgetAction;
typedef struct _GladeWidgetActionPrivate GladeWidgetActionPrivate;
typedef struct _GWActionClass GWActionClass;
typedef struct _GladeWidgetActionDef GladeWidgetActionDef;
struct _GWActionClass
struct _GladeWidgetActionDef
{
const gchar *id; /* The identifier of this action in the action tree */
gchar *path; /* Full action path */
......@@ -68,27 +69,28 @@ struct _GladeWidgetActionClass
};
GType glade_widget_action_get_type (void) G_GNUC_CONST;
void glade_widget_action_set_sensitive (GladeWidgetAction *action,
gboolean sensitive);
gboolean glade_widget_action_get_sensitive (GladeWidgetAction *action);
void glade_widget_action_set_visible (GladeWidgetAction *action,
gboolean visible);
gboolean glade_widget_action_get_visible (GladeWidgetAction *action);
GList *glade_widget_action_get_children (GladeWidgetAction *action);
GWActionClass *glade_widget_action_get_class (GladeWidgetAction *action);
GWActionClass *glade_widget_action_class_new (const gchar *path);
GWActionClass *glade_widget_action_class_clone (GWActionClass *action);
void glade_widget_action_class_free (GWActionClass *action);
void glade_widget_action_class_set_label (GWActionClass *action,
const gchar *label);
void glade_widget_action_class_set_stock (GWActionClass *action,
const gchar *stock);
void glade_widget_action_class_set_important (GWActionClass *action,
gboolean important);
GType glade_widget_action_get_type (void) G_GNUC_CONST;
void glade_widget_action_set_sensitive (GladeWidgetAction *action,
gboolean sensitive);
gboolean glade_widget_action_get_sensitive (GladeWidgetAction *action);
void glade_widget_action_set_visible (GladeWidgetAction *action,
gboolean visible);
gboolean glade_widget_action_get_visible (GladeWidgetAction *action);
GList *glade_widget_action_get_children (GladeWidgetAction *action);
GladeWidgetActionDef *glade_widget_action_get_def (GladeWidgetAction *action);
GType glade_widget_action_def_get_type (void) G_GNUC_CONST;
GladeWidgetActionDef *glade_widget_action_def_new (const gchar *path);
GladeWidgetActionDef *glade_widget_action_def_clone (GladeWidgetActionDef *action);
void glade_widget_action_def_free (GladeWidgetActionDef *action);
void glade_widget_action_def_set_label (GladeWidgetActionDef *action,
const gchar *label);
void glade_widget_action_def_set_stock (GladeWidgetActionDef *action,
const gchar *stock);
void glade_widget_action_def_set_important (GladeWidgetActionDef *action,
gboolean important);
G_END_DECLS
......
......@@ -84,8 +84,8 @@ struct _GladeWidgetAdaptorPrivate
*/
GList *signals; /* List of GladeSignalDef objects */
GList *child_packings; /* Default packing property values */
GList *actions; /* A list of GWActionClass */
GList *packing_actions; /* A list of GWActionClass for child objects */
GList *actions; /* A list of GladeWidgetActionDef */
GList *packing_actions; /* A list of GladeWidgetActionDef for child objects */
GList *internal_children; /* A list of GladeInternalChild */
gchar *catalog; /* The name of the widget catalog this class
* was declared by.
......@@ -662,7 +662,7 @@ glade_widget_adaptor_constructor (GType type,
{
for (l = parent_adaptor->priv->actions; l; l = g_list_next (l))
{
GWActionClass *child = glade_widget_action_class_clone (l->data);
GladeWidgetActionDef *child = glade_widget_action_def_clone (l->data);
adaptor->priv->actions = g_list_prepend (adaptor->priv->actions, child);
}
adaptor->priv->actions = g_list_reverse (adaptor->priv->actions);
......@@ -672,7 +672,7 @@ glade_widget_adaptor_constructor (GType type,
{
for (l = parent_adaptor->priv->packing_actions; l; l = g_list_next (l))
{
GWActionClass *child = glade_widget_action_class_clone (l->data);
GladeWidgetActionDef *child = glade_widget_action_def_clone (l->data);
adaptor->priv->packing_actions =
g_list_prepend (adaptor->priv->packing_actions, child);
}
......@@ -758,14 +758,14 @@ glade_widget_adaptor_finalize (GObject *object)
if (adaptor->priv->actions)
{
g_list_free_full (adaptor->priv->actions,
(GDestroyNotify) glade_widget_action_class_free);
(GDestroyNotify) glade_widget_action_def_free);
adaptor->priv->actions = NULL;
}
if (adaptor->priv->packing_actions)
{
g_list_free_full (adaptor->priv->packing_actions,
(GDestroyNotify) glade_widget_action_class_free);
(GDestroyNotify) glade_widget_action_def_free);
adaptor->priv->packing_actions = NULL;
}
......@@ -3892,14 +3892,14 @@ gwa_action_path_get_id (const gchar *action_path)
return action_path;
}
static GWActionClass *
static GladeWidgetActionDef *
gwa_action_lookup (GList *actions, const gchar *action_id)
{
GList *l;
for (l = actions; l; l = g_list_next (l))
{
GWActionClass *action = l->data;
GladeWidgetActionDef *action = l->data;
if (strcmp (action->id, action_id) == 0)
return action;
}
......@@ -3907,11 +3907,11 @@ gwa_action_lookup (GList *actions, const gchar *action_id)
return NULL;
}
static GWActionClass *
static GladeWidgetActionDef *
gwa_action_get_last_group (GList *actions, const gchar *action_path)
{
gchar **tokens = g_strsplit (action_path, "/", 0);
GWActionClass *group = NULL;
GladeWidgetActionDef *group = NULL;
gint i;
for (i = 0; tokens[i] && tokens[i + 1]; i++)
......@@ -3935,7 +3935,7 @@ glade_widget_adaptor_action_add_real (GList **list,
const gchar *stock,
gboolean important)
{
GWActionClass *action, *group;
GladeWidgetActionDef *action, *group;
const gchar *id;
id = gwa_action_path_get_id (action_path);
......@@ -3951,14 +3951,14 @@ glade_widget_adaptor_action_add_real (GList **list,
if ((action = gwa_action_lookup (*list, id)) == NULL)
{
/* New Action */
action = glade_widget_action_class_new (action_path);
action = glade_widget_action_def_new (action_path);
*list = g_list_append (*list, action);
}
glade_widget_action_class_set_label (action, label);
glade_widget_action_class_set_stock (action, stock);
glade_widget_action_class_set_important (action, important);
glade_widget_action_def_set_label (action, label);
glade_widget_action_def_set_stock (action, stock);
glade_widget_action_def_set_important (action, important);
return TRUE;
}
......@@ -4023,7 +4023,7 @@ static gboolean
glade_widget_adaptor_action_remove_real (GList **list,
const gchar *action_path)
{
GWActionClass *action, *group;
GladeWidgetActionDef *action, *group;
const gchar *id;
id = gwa_action_path_get_id (action_path);
......@@ -4036,7 +4036,7 @@ glade_widget_adaptor_action_remove_real (GList **list,
*list = g_list_remove (*list, action);
glade_widget_action_class_free (action);
glade_widget_action_def_free (action);
return TRUE;
}
......@@ -4098,9 +4098,9 @@ glade_widget_adaptor_actions_new (GladeWidgetAdaptor *adaptor)
for (l = adaptor->priv->actions; l; l = g_list_next (l))
{
GWActionClass *action = l->data;
GObject *obj = g_object_new (GLADE_TYPE_WIDGET_ACTION,
"class", action, NULL);
GladeWidgetActionDef *action = l->data;
GObject *obj = g_object_new (GLADE_TYPE_WIDGET_ACTION,
"definition", action, NULL);
list = g_list_prepend (list, GLADE_WIDGET_ACTION (obj));
}
......@@ -4124,9 +4124,9 @@ glade_widget_adaptor_pack_actions_new (GladeWidgetAdaptor *adaptor)
for (l = adaptor->priv->packing_actions; l; l = g_list_next (l))
{
GWActionClass *action = l->data;
GObject *obj = g_object_new (GLADE_TYPE_WIDGET_ACTION,
"class", action, NULL);
GladeWidgetActionDef *action = l->data;
GObject *obj = g_object_new (GLADE_TYPE_WIDGET_ACTION,
"definition", action, NULL);
list = g_list_prepend (list, GLADE_WIDGET_ACTION (obj));
}
......
......@@ -4592,15 +4592,15 @@ glade_widget_action_lookup (GList *actions, const gchar *path)
for (l = actions; l; l = g_list_next (l))
{
GladeWidgetAction *action = l->data;
GWActionClass *aclass = glade_widget_action_get_class (action);
GList *children = glade_widget_action_get_children (action);
GladeWidgetAction *action = l->data;
GladeWidgetActionDef *adef = glade_widget_action_get_def (action);
GList *children = glade_widget_action_get_children (action);
if (strcmp (aclass->path, path) == 0)
if (strcmp (adef->path, path) == 0)
return action;
if (children &&
g_str_has_prefix (path, aclass->path) &&
g_str_has_prefix (path, adef->path) &&
(action = glade_widget_action_lookup (children, path)))
return action;
}
......
......@@ -263,7 +263,7 @@ glade_gtk_header_bar_set_use_custom_title (GObject *object,
for (l = list; l; l = l->next)
{
GladeWidgetAction *gwa = l->data;
if (!strcmp (glade_widget_action_get_class (gwa)->id, "remove_slot"))
if (!strcmp (glade_widget_action_get_def (gwa)->id, "remove_slot"))
glade_widget_action_set_visible (gwa, FALSE);
}
}
......
......@@ -222,13 +222,13 @@ update_default_path (GladeWindow *window, const gchar *filename)
static void
activate_action (GtkToolButton *toolbutton, GladeWidgetAction *action)
{
GladeWidget *widget;
GWActionClass *aclass = glade_widget_action_get_class (action);
GladeWidget *widget;
GladeWidgetActionDef *adef = glade_widget_action_get_def (action);
if ((widget = g_object_get_data (G_OBJECT (toolbutton), "glade-widget")))
glade_widget_adaptor_action_activate (glade_widget_get_adaptor (widget),
glade_widget_get_object (widget),
aclass->path);
adef->path);
}
static void
......@@ -277,10 +277,10 @@ add_actions (GladeWindow *window, GladeWidget *widget, GList *actions)
for (l = actions; l; l = g_list_next (l))
{
GladeWidgetAction *action = l->data;
GWActionClass *aclass = glade_widget_action_get_class (action);
GladeWidgetAction *action = l->data;
GladeWidgetActionDef *adef = glade_widget_action_get_def (action);
if (!aclass->important || !glade_widget_action_get_visible (action))
if (!adef->important || !glade_widget_action_get_visible (action))
continue;
if (glade_widget_action_get_children (action))
......@@ -289,12 +289,12 @@ add_actions (GladeWindow *window, GladeWidget *widget, GList *actions)
continue;
}
item = gtk_tool_button_new (NULL, aclass->label);
item = gtk_tool_button_new (NULL, adef->label);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item),
(aclass->stock) ? aclass->stock : "system-run");
(adef->stock) ? adef->stock : "system-run");
if (aclass->label)
gtk_widget_set_tooltip_text (GTK_WIDGET (item), aclass->label);
if (adef->label)
gtk_widget_set_tooltip_text (GTK_WIDGET (item), adef->label);
g_object_s