From b447070d7d861ef533d1da6ab44a63d52945da3b Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 31 Jan 2010 20:38:56 +0100 Subject: [PATCH] Use new GtkActivatable API in MidoriBrowser --- midori/midori-browser.c | 22 +++++++++++++++++----- midori/sokoke.h | 5 +++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 2572b350..779ab4c8 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -2324,7 +2324,11 @@ _action_compact_add_activate (GtkAction* action, g_free (label); gtk_widget_set_name (button, "GtkButton-thumb"); gtk_box_pack_start (box, button, TRUE, TRUE, 4); + #if GTK_CHECK_VERSION (2, 16, 0) + gtk_activatable_set_related_action (GTK_ACTIVATABLE (button), action); + #else gtk_action_connect_proxy (action, button); + #endif g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), dialog); } @@ -2664,7 +2668,9 @@ _midori_browser_save_toolbar_items (MidoriBrowser* browser) children = gtk_container_get_children (GTK_CONTAINER (browser->navigationbar)); for (; children != NULL; children = g_list_next (children)) { - GtkAction* action = gtk_widget_get_action (GTK_WIDGET (children->data)); + GtkAction* action; + + action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (children->data)); /* If a widget has no action that is actually a bug, so warn about it */ g_warn_if_fail (action != NULL); if (action) @@ -2740,8 +2746,11 @@ static void midori_browser_menu_item_select_cb (GtkWidget* menuitem, MidoriBrowser* browser) { - GtkAction* action = gtk_widget_get_action (menuitem); - gchar* tooltip = action ? katze_object_get_string (action, "tooltip") : NULL; + GtkAction* action; + gchar* tooltip; + + action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (menuitem)); + tooltip = action ? katze_object_get_string (action, "tooltip") : NULL; if (!tooltip) { /* This is undocumented object data, used by KatzeArrayAction. */ @@ -3195,7 +3204,8 @@ _action_menubar_activate (GtkToggleAction* action, for (; children != NULL; children = g_list_next (children)) { GtkAction* action_; - action_ = gtk_widget_get_action (GTK_WIDGET (children->data)); + + action_ = gtk_activatable_get_related_action (GTK_ACTIVATABLE (children->data)); if (action_ == menu_action) { gtk_container_remove (navigationbar, @@ -4240,7 +4250,9 @@ midori_browser_menu_item_middle_click_event_cb (GtkWidget* toolitem, { if (event->button == 2) { - GtkAction* action = gtk_widget_get_action (toolitem); + GtkAction* action; + + action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (toolitem)); return midori_browser_menu_middle_click_on_navigation_action (browser, action); } diff --git a/midori/sokoke.h b/midori/sokoke.h index 6435f6f7..0896ce7d 100644 --- a/midori/sokoke.h +++ b/midori/sokoke.h @@ -29,6 +29,11 @@ (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB) #endif +#if !GTK_CHECK_VERSION (2, 16, 0) + #define GTK_ACTIVATABLE GTK_WIDGET + #define gtk_activatable_get_related_action gtk_widget_get_action +#endif + #if !GTK_CHECK_VERSION (2, 18, 0) #define gtk_widget_is_toplevel(widget) GTK_WIDGET_TOPLEVEL (widget) #define gtk_widget_has_focus(widget) GTK_WIDGET_HAS_FOCUS (widget) -- 2.39.5