Bug 162603 - [GTK] Switch to use GMenu internally in the context menu implementation
Summary: [GTK] Switch to use GMenu internally in the context menu implementation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on: 162776
Blocks: 159631
  Show dependency treegraph
 
Reported: 2016-09-27 03:50 PDT by Carlos Garcia Campos
Modified: 2016-09-30 02:22 PDT (History)
3 users (show)

See Also:


Attachments
Patch (25.46 KB, patch)
2016-09-27 04:03 PDT, Carlos Garcia Campos
mcatanzaro: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2016-09-27 03:50:23 PDT
I always resisted to do this because GtkAction is superior and by far a lot easier to use than all GAction and GMenu APIs, but soon GTK+ will remove all deprecated APIs, so we need a solution for GtkAction.
Comment 1 Carlos Garcia Campos 2016-09-27 04:03:24 PDT
Created attachment 289933 [details]
Patch
Comment 2 Michael Catanzaro 2016-09-27 05:54:51 PDT
Comment on attachment 289933 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=289933&action=review

Thank you!

> Source/WebKit2/ChangeLog:8
> +        Switch to use GAction instead of GtkAtion internally, but still keeping a GtkAction associated to the GAction,

GtkAtion -> GtkAction

> Source/WebKit2/Shared/gtk/WebContextMenuItemGtk.cpp:160
> +    GUniquePtr<char> actionName(g_strdup_printf("action-%" G_GUINT64_FORMAT, ++actionID));

Nit: since it's a uint64_t rather than a guint64, I would print it with PRIu64

> Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.h:64
> +    HashMap<unsigned long, void*> m_signalHandlers;

I don't understand, why use void* instead of GAction*? GAction* would obviously be safer.
Comment 3 Carlos Garcia Campos 2016-09-28 00:15:54 PDT
(In reply to comment #2)
> Comment on attachment 289933 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=289933&action=review
> 
> Thank you!
> 
> > Source/WebKit2/ChangeLog:8
> > +        Switch to use GAction instead of GtkAtion internally, but still keeping a GtkAction associated to the GAction,
> 
> GtkAtion -> GtkAction
> 
> > Source/WebKit2/Shared/gtk/WebContextMenuItemGtk.cpp:160
> > +    GUniquePtr<char> actionName(g_strdup_printf("action-%" G_GUINT64_FORMAT, ++actionID));
> 
> Nit: since it's a uint64_t rather than a guint64, I would print it with
> PRIu64
> 
> > Source/WebKit2/UIProcess/gtk/WebContextMenuProxyGtk.h:64
> > +    HashMap<unsigned long, void*> m_signalHandlers;
> 
> I don't understand, why use void* instead of GAction*? GAction* would
> obviously be safer.

To avoid casts between GAction - GSimpleAction. I don't think there any risk in using void*, g_signal_handler_disconnect expects a gpointer, and this is used privately only.
Comment 4 Carlos Garcia Campos 2016-09-28 00:51:35 PDT
Committed r206505: <http://trac.webkit.org/changeset/206505>
Comment 5 Michael Catanzaro 2016-09-28 00:57:26 PDT
(In reply to comment #3)
> To avoid casts between GAction - GSimpleAction. I don't think there any risk
> in using void*, g_signal_handler_disconnect expects a gpointer, and this is
> used privately only.

Well it's your choice, but I would use casts there as usual.