[gtk+] Adapt to api changes in GMenuModel
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Adapt to api changes in GMenuModel
- Date: Mon, 19 Dec 2011 17:55:18 +0000 (UTC)
commit 95d9a5e3688767dcd2794ae4027be02ccc084746
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Nov 19 00:02:09 2011 -0500
Adapt to api changes in GMenuModel
gtk/gtkapplication.c | 20 +++++++++-----------
tests/testgmenu.c | 20 +++++++++-----------
2 files changed, 18 insertions(+), 22 deletions(-)
---
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c
index 247eac8..38d2e9c 100644
--- a/gtk/gtkapplication.c
+++ b/gtk/gtkapplication.c
@@ -458,8 +458,9 @@ radio_state_changed (GActionGroup *group,
}
static GtkWidget *
-create_menuitem_from_model (GMenuModelItem *item,
- GActionGroup *group)
+create_menuitem_from_model (GMenuModel *model,
+ gint item,
+ GActionGroup *group)
{
GtkWidget *w;
gchar *label;
@@ -470,10 +471,10 @@ create_menuitem_from_model (GMenuModelItem *item,
const GVariantType *type;
GVariant *v;
- g_menu_model_item_get_attribute (item, G_MENU_ATTRIBUTE_LABEL, "s", &label);
+ g_menu_model_get_item_attribute (model, item, G_MENU_ATTRIBUTE_LABEL, "s", &label);
action = NULL;
- g_menu_model_item_get_attribute (item, G_MENU_ATTRIBUTE_ACTION, "s", &action);
+ g_menu_model_get_item_attribute (model, item, G_MENU_ATTRIBUTE_ACTION, "s", &action);
if (action != NULL)
type = g_action_group_get_action_state_type (group, action);
@@ -528,7 +529,7 @@ create_menuitem_from_model (GMenuModelItem *item,
a->state_changed_id = g_signal_connect (group, s,
G_CALLBACK (radio_state_changed), w);
g_free (s);
- g_menu_model_item_get_attribute (item, G_MENU_ATTRIBUTE_TARGET, "s", &target);
+ g_menu_model_get_item_attribute (model, item, G_MENU_ATTRIBUTE_TARGET, "s", &target);
a->target = g_strdup (target);
v = g_action_group_get_action_state (group, action);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (w),
@@ -561,7 +562,6 @@ append_items_from_model (GtkMenuShell *menu,
GtkWidget *w;
GtkWidget *menuitem;
GtkWidget *submenu;
- GMenuModelItem item;
GMenuModel *m;
n = g_menu_model_get_n_items (model);
@@ -577,18 +577,16 @@ append_items_from_model (GtkMenuShell *menu,
for (i = 0; i < n; i++)
{
- g_menu_model_get_item (model, i, &item);
-
- if ((m = g_menu_model_item_get_link (&item, G_MENU_LINK_SECTION)))
+ if ((m = g_menu_model_get_item_link (model, i, G_MENU_LINK_SECTION)))
{
append_items_from_model (menu, m, group, need_separator);
g_object_unref (m);
continue;
}
- menuitem = create_menuitem_from_model (&item, group);
+ menuitem = create_menuitem_from_model (model, i, group);
- if ((m = g_menu_model_item_get_link (&item, G_MENU_LINK_SUBMENU)))
+ if ((m = g_menu_model_get_item_link (model, i, G_MENU_LINK_SUBMENU)))
{
submenu = gtk_menu_new ();
populate_menu_from_model (GTK_MENU_SHELL (submenu), m, group);
diff --git a/tests/testgmenu.c b/tests/testgmenu.c
index 71006ad..1908402 100644
--- a/tests/testgmenu.c
+++ b/tests/testgmenu.c
@@ -193,8 +193,9 @@ radio_item_toggled (GtkCheckMenuItem *w,
/* GtkMenu construction {{{2 */
static GtkWidget *
-create_menuitem_from_model (GMenuModelItem *item,
- GActionGroup *group)
+create_menuitem_from_model (GMenuModel *model,
+ gint item,
+ GActionGroup *group)
{
GtkWidget *w;
gchar *label;
@@ -205,10 +206,10 @@ create_menuitem_from_model (GMenuModelItem *item,
const GVariantType *type;
GVariant *v;
- g_menu_model_item_get_attribute (item, G_MENU_ATTRIBUTE_LABEL, "s", &label);
+ g_menu_model_get_item_attribute (model, item, G_MENU_ATTRIBUTE_LABEL, "s", &label);
action = NULL;
- g_menu_model_item_get_attribute (item, G_MENU_ATTRIBUTE_ACTION, "s", &action);
+ g_menu_model_get_item_attribute (model, item, G_MENU_ATTRIBUTE_ACTION, "s", &action);
if (action != NULL)
type = g_action_group_get_action_state_type (group, action);
@@ -263,7 +264,7 @@ create_menuitem_from_model (GMenuModelItem *item,
a->state_changed_id = g_signal_connect (group, s,
G_CALLBACK (radio_state_changed), w);
g_free (s);
- g_menu_model_item_get_attribute (item, G_MENU_ATTRIBUTE_TARGET, "s", &target);
+ g_menu_model_get_item_attribute (model, item, G_MENU_ATTRIBUTE_TARGET, "s", &target);
a->target = g_strdup (target);
v = g_action_group_get_action_state (group, action);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (w),
@@ -295,7 +296,6 @@ append_items_from_model (GtkWidget *menu,
GtkWidget *w;
GtkWidget *menuitem;
GtkWidget *submenu;
- GMenuModelItem item;
GMenuModel *m;
n = g_menu_model_get_n_items (model);
@@ -311,18 +311,16 @@ append_items_from_model (GtkWidget *menu,
for (i = 0; i < n; i++)
{
- g_menu_model_get_item (model, i, &item);
-
- if ((m = g_menu_model_item_get_link (&item, G_MENU_LINK_SECTION)))
+ if ((m = g_menu_model_get_item_link (model, i, G_MENU_LINK_SECTION)))
{
append_items_from_model (menu, m, group, need_separator);
g_object_unref (m);
continue;
}
- menuitem = create_menuitem_from_model (&item, group);
+ menuitem = create_menuitem_from_model (model, i, group);
- if ((m = g_menu_model_item_get_link (&item, G_MENU_LINK_SUBMENU)))
+ if ((m = g_menu_model_get_item_link (model, i, G_MENU_LINK_SUBMENU)))
{
submenu = create_menu_from_model (m, group);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]