[glib/wip/menus: 23/61] Make GMenu final
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/menus: 23/61] Make GMenu final
- Date: Thu, 17 Nov 2011 23:36:38 +0000 (UTC)
commit acdda6e73c4f850599194d2d687c23e6cf5f4386
Author: Ryan Lortie <desrt desrt ca>
Date: Mon Jul 11 03:02:43 2011 +0200
Make GMenu final
docs/reference/gio/gio-sections.txt | 6 ----
gio/gmenu.c | 49 ++++++++++++++++++-----------------
gio/gmenu.h | 26 ------------------
3 files changed, 25 insertions(+), 56 deletions(-)
---
diff --git a/docs/reference/gio/gio-sections.txt b/docs/reference/gio/gio-sections.txt
index f792d03..328d799 100644
--- a/docs/reference/gio/gio-sections.txt
+++ b/docs/reference/gio/gio-sections.txt
@@ -3575,16 +3575,10 @@ g_menu_get_type
G_TYPE_MENU
G_MENU
G_IS_MENU
-G_MENU_CLASS
-G_IS_MENU_CLASS
-G_MENU_GET_CLASS
G_TYPE_MENU_ITEM
G_MENU_ITEM
G_IS_MENU_ITEM
-G_MENU_ITEM_CLASS
-G_IS_MENU_ITEM_CLASS
-G_MENU_ITEM_GET_CLASS
</SECTION>
<SECTION>
diff --git a/gio/gmenu.c b/gio/gmenu.c
index e6ef55f..c336170 100644
--- a/gio/gmenu.c
+++ b/gio/gmenu.c
@@ -35,6 +35,16 @@ struct _GMenuItem
typedef GObjectClass GMenuItemClass;
+struct _GMenu
+{
+ GMenuModel parent_instance;
+
+ GArray *items;
+ gboolean mutable;
+};
+
+typedef GMenuModelClass GMenuClass;
+
G_DEFINE_TYPE (GMenu, g_menu, G_TYPE_MENU_MODEL)
G_DEFINE_TYPE (GMenuItem, g_menu_item, G_TYPE_OBJECT)
@@ -44,18 +54,12 @@ struct item
GHashTable *links;
};
-struct _GMenuPrivate
-{
- GArray *items;
- gboolean mutable;
-};
-
static gboolean
g_menu_is_mutable (GMenuModel *model)
{
GMenu *menu = G_MENU (model);
- return menu->priv->mutable;
+ return menu->mutable;
}
static gint
@@ -63,7 +67,7 @@ g_menu_get_n_items (GMenuModel *model)
{
GMenu *menu = G_MENU (model);
- return menu->priv->items->len;
+ return menu->items->len;
}
static void
@@ -75,7 +79,7 @@ g_menu_get_item_attributes (GMenuModel *model,
{
GMenu *menu = G_MENU (model);
- *quark_table = g_array_index (menu->priv->items, struct item, position).attributes;
+ *quark_table = g_array_index (menu->items, struct item, position).attributes;
}
static void
@@ -86,7 +90,7 @@ g_menu_get_item_links (GMenuModel *model,
{
GMenu *menu = G_MENU (model);
- *quark_table = g_array_index (menu->priv->items, struct item, position).links;
+ *quark_table = g_array_index (menu->items, struct item, position).links;
}
/**
@@ -123,15 +127,15 @@ g_menu_insert_item (GMenu *menu,
g_return_if_fail (G_IS_MENU (menu));
g_return_if_fail (G_IS_MENU_ITEM (item));
- if (position < 0 || position > menu->priv->items->len)
- position = menu->priv->items->len;
+ if (position < 0 || position > menu->items->len)
+ position = menu->items->len;
new_item.attributes = g_hash_table_ref (item->attributes);
new_item.links = g_hash_table_ref (item->links);
item->cow = TRUE;
- g_array_insert_val (menu->priv->items, position, new_item);
+ g_array_insert_val (menu->items, position, new_item);
g_menu_model_items_changed (G_MENU_MODEL (menu), position, 0, 1);
}
@@ -185,7 +189,7 @@ g_menu_freeze (GMenu *menu)
{
g_return_if_fail (G_IS_MENU (menu));
- menu->priv->mutable = FALSE;
+ menu->mutable = FALSE;
}
/**
@@ -416,10 +420,10 @@ g_menu_remove (GMenu *menu,
gint index_)
{
g_return_if_fail (G_IS_MENU (menu));
- g_return_if_fail (0 <= index_ && index_ < menu->priv->items->len);
+ g_return_if_fail (0 <= index_ && index_ < menu->items->len);
- g_menu_clear_item (&g_array_index (menu->priv->items, struct item, index_));
- g_array_remove_index (menu->priv->items, index_);
+ g_menu_clear_item (&g_array_index (menu->items, struct item, index_));
+ g_array_remove_index (menu->items, index_);
g_menu_model_items_changed (G_MENU_MODEL (menu), index_, 1, 0);
}
@@ -431,8 +435,8 @@ g_menu_finalize (GObject *object)
gint n_items;
gint i;
- n_items = menu->priv->items->len;
- items = (struct item *) g_array_free (menu->priv->items, FALSE);
+ n_items = menu->items->len;
+ items = (struct item *) g_array_free (menu->items, FALSE);
for (i = 0; i < n_items; i++)
g_menu_clear_item (&items[i]);
g_free (items);
@@ -444,9 +448,8 @@ g_menu_finalize (GObject *object)
static void
g_menu_init (GMenu *menu)
{
- menu->priv = G_TYPE_INSTANCE_GET_PRIVATE (menu, G_TYPE_MENU, GMenuPrivate);
- menu->priv->items = g_array_new (FALSE, FALSE, sizeof (struct item));
- menu->priv->mutable = TRUE;
+ menu->items = g_array_new (FALSE, FALSE, sizeof (struct item));
+ menu->mutable = TRUE;
}
static void
@@ -461,8 +464,6 @@ g_menu_class_init (GMenuClass *class)
model_class->get_n_items = g_menu_get_n_items;
model_class->get_item_attributes = g_menu_get_item_attributes;
model_class->get_item_links = g_menu_get_item_links;
-
- g_type_class_add_private (class, sizeof (GMenuPrivate));
}
diff --git a/gio/gmenu.h b/gio/gmenu.h
index 4a56236..8cbc57a 100644
--- a/gio/gmenu.h
+++ b/gio/gmenu.h
@@ -15,44 +15,18 @@ G_BEGIN_DECLS
#define G_TYPE_MENU (g_menu_get_type ())
#define G_MENU(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
G_TYPE_MENU, GMenu))
-#define G_MENU_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
- G_TYPE_MENU, GMenuClass))
#define G_IS_MENU(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
G_TYPE_MENU))
-#define G_IS_MENU_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
- G_TYPE_MENU))
-#define G_MENU_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
- G_TYPE_MENU, GMenuClass))
#define G_TYPE_MENU_ITEM (g_menu_item_get_type ())
#define G_MENU_ITEM(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
G_TYPE_MENU_ITEM, GMenuItem))
-#define G_MENU_ITEM_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
- G_TYPE_MENU_ITEM, GMenuItemClass))
#define G_IS_MENU_ITEM(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
G_TYPE_MENU_ITEM))
-#define G_IS_MENU_ITEM_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
- G_TYPE_MENU_ITEM))
-#define G_MENU_ITEM_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
- G_TYPE_MENU_ITEM, GMenuItemClass))
typedef struct _GMenuItem GMenuItem;
-
-typedef struct _GMenuPrivate GMenuPrivate;
-typedef struct _GMenuClass GMenuClass;
typedef struct _GMenu GMenu;
-struct _GMenu
-{
- GMenuModel parent_instance;
- GMenuPrivate *priv;
-};
-
-struct _GMenuClass
-{
- GMenuModelClass parent_class;
-};
-
GType g_menu_get_type (void) G_GNUC_CONST;
GMenu * g_menu_new (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]