Title: [261047] trunk/Source/WebKit
Revision
261047
Author
[email protected]
Date
2020-05-02 05:54:36 -0700 (Sat, 02 May 2020)

Log Message

[GTK] Specify action group name when binding context menu models
https://bugs.webkit.org/show_bug.cgi?id=211288

Reviewed by Carlos Garcia Campos.

No new tests needed.

* UIProcess/gtk/WebContextMenuProxyGtk.cpp:
(WebKit::WebContextMenuProxyGtk::append): Use the action name directly for the menu item.
(WebKit::WebContextMenuProxyGtk::populate): Indicate the action group name when binding the
menu model, which automatically adds the group name as action name prefix without needing
to specify it by hand when adding menu items.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (261046 => 261047)


--- trunk/Source/WebKit/ChangeLog	2020-05-02 09:34:30 UTC (rev 261046)
+++ trunk/Source/WebKit/ChangeLog	2020-05-02 12:54:36 UTC (rev 261047)
@@ -1,3 +1,18 @@
+2020-05-02  Adrian Perez de Castro  <[email protected]>
+
+        [GTK] Specify action group name when binding context menu models
+        https://bugs.webkit.org/show_bug.cgi?id=211288
+
+        Reviewed by Carlos Garcia Campos.
+
+        No new tests needed.
+
+        * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
+        (WebKit::WebContextMenuProxyGtk::append): Use the action name directly for the menu item.
+        (WebKit::WebContextMenuProxyGtk::populate): Indicate the action group name when binding the
+        menu model, which automatically adds the group name as action name prefix without needing
+        to specify it by hand when adding menu items.
+
 2020-05-02  Devin Rousso  <[email protected]>
 
         [CSS Easing 1] implement `jump-*` step positions

Modified: trunk/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp (261046 => 261047)


--- trunk/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp	2020-05-02 09:34:30 UTC (rev 261046)
+++ trunk/Source/WebKit/UIProcess/gtk/WebContextMenuProxyGtk.cpp	2020-05-02 12:54:36 UTC (rev 261047)
@@ -72,9 +72,8 @@
     switch (menuItem.type()) {
     case ActionType:
     case CheckableActionType: {
-        GUniquePtr<char> actionName(g_strdup_printf("%s.%s", gContextMenuItemGroup, g_action_get_name(action)));
         gMenuItem = adoptGRef(g_menu_item_new(menuItem.title().utf8().data(), nullptr));
-        g_menu_item_set_action_and_target_value(gMenuItem.get(), actionName.get(), menuItem.gActionTarget());
+        g_menu_item_set_action_and_target_value(gMenuItem.get(), g_action_get_name(action), menuItem.gActionTarget());
 
         if (menuItem.action() < ContextMenuItemBaseApplicationTag) {
             g_object_set_data(G_OBJECT(action), gContextMenuActionId, GINT_TO_POINTER(menuItem.action()));
@@ -128,7 +127,7 @@
 void WebContextMenuProxyGtk::populate(const Vector<WebContextMenuItemGlib>& items)
 {
     GRefPtr<GMenu> menu = buildMenu(items);
-    gtk_popover_bind_model(m_menu, G_MENU_MODEL(menu.get()), nullptr);
+    gtk_popover_bind_model(m_menu, G_MENU_MODEL(menu.get()), gContextMenuItemGroup);
 }
 
 void WebContextMenuProxyGtk::populate(const Vector<Ref<WebContextMenuItem>>& items)
@@ -156,7 +155,7 @@
         }
         }
     }
-    gtk_popover_bind_model(m_menu, G_MENU_MODEL(menu.get()), nullptr);
+    gtk_popover_bind_model(m_menu, G_MENU_MODEL(menu.get()), gContextMenuItemGroup);
 }
 
 void WebContextMenuProxyGtk::show()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to