summaryrefslogtreecommitdiff
path: root/gladeui
diff options
context:
space:
mode:
authorCorentin Noël <corentin@elementary.io>2019-06-18 07:35:25 +0000
committerAlberto Fanjul <albertofanjul@gmail.com>2019-06-18 07:35:25 +0000
commit3fabe72401e8c179249feef3450031f389bce83f (patch)
tree3a9b1bc2c0fd5dca730689b4e3c5821129b9fc96 /gladeui
parenta543e99069b693d96e68eb8e00a2dce00a1946a7 (diff)
downloadglade-3fabe72401e8c179249feef3450031f389bce83f.tar.gz
Rename GWActionClass to GladeWidgetActionDef to use the right namespace
Diffstat (limited to 'gladeui')
-rw-r--r--gladeui/glade-popup.c22
-rw-r--r--gladeui/glade-widget-action.c98
-rw-r--r--gladeui/glade-widget-action.h48
-rw-r--r--gladeui/glade-widget-adaptor.c46
-rw-r--r--gladeui/glade-widget.c10
5 files changed, 113 insertions, 111 deletions
diff --git a/gladeui/glade-popup.c b/gladeui/glade-popup.c
index 7745b0ad..adcde18b 100644
--- a/gladeui/glade-popup.c
+++ b/gladeui/glade-popup.c
@@ -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
diff --git a/gladeui/glade-widget-action.c b/gladeui/glade-widget-action.c
index 8535bc61..1d6f404b 100644
--- a/gladeui/glade-widget-action.c
+++ b/gladeui/glade-widget-action.c
@@ -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;
}
diff --git a/gladeui/glade-widget-action.h b/gladeui/glade-widget-action.h
index b320d5b3..d40677f2 100644
--- a/gladeui/glade-widget-action.h
+++ b/gladeui/glade-widget-action.h
@@ -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
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index f3f0200d..992e7959 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -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));
}
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index fbce9f2b..646c9558 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -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;
}