Skip to content
  • Luca Bacci's avatar
    port-to-gtk3: Use Gdk::AppLaunchContext to launch yelp (#7) · 2953778a
    Luca Bacci authored and Mike Fleetwood's avatar Mike Fleetwood committed
    gdk_spawn_command_line_on_screen() is not present in Gtk3.  The
    documentation from Gtkmm 2.24 states [1]:
    
        gdk_spawn_command_line_on_screen has been deprecated since version
        2.24 and should not be used in newly-written code.  This function is
        being removed in 3.0.  Use either g_spawn_command_line_sync(),
        g_spawn_command_line_async() or GdkAppLaunchContext instead.
    
    g_spawn_command_line_sync() and g_spawn_command_line_async() are screen
    / display agnostic, as such we would loose functionality.  There is a
    workaround, which involves setting the DISPLAY environment variable [2],
    but it's a weak solution (and I don't know if it works on backends
    other than X11).
    
    GdkAppLaunchContext is an implementation of GIO's GAppLaunchContext that
    handles launching an application in a graphical context [3].  Therefore
    use GdkAppLaunchContext and GIO's GAppInfo.
    
    GdkAppLaunchContext was introduced in Gtk2 version 2.14.  The C++
    wrapper Gdk::AppLaunchContext was introduced only in Gtkmm3 version 3.4
    [4].  Bump the minimum required version of Gtkmm to 3.4.0 for this
    requirement.
    
    GAppInfo was introduced in GLib version 2.16.  The C++ wrapper
    Gio::AppInfo was introduced in Giomm version 2.16.  Note that the
    minimum required version for glibmm is already 2.32.
    
    [1] GDK 2 Reference Manual, GdkScreen, gdk_spawn_on_screen()
        https://developer.gnome.org/gdk2/2.24/GdkScreen.html#gdk-spawn-on-screen
    
    [2] Migrating from GTK+ 2.x to GTK+ 3 - "Use GIO for launching applications"
        https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html#id-1.6.3.3.7
    
    [3] GDK 3 Reference Manual - "Application launching"
        https://developer.gnome.org/gdk3/stable/gdk3-Application-launching.html
    
    [4] Gtkmm 3.4 Gdk::AppLaunchContext Class Reference, Detailed Description
        https://developer.gnome.org/gtkmm/3.4/classGdk_1_1AppLaunchContext.html#details
    
    Closes #7 - Port to Gtk3
    2953778a