[gparted] Ensure running GParted is named correctly under GNOME Shell (#705323)



commit 73a80db912a7f4f51173b0176e11336ce019ca57
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Fri Aug 2 13:06:14 2013 +0100

    Ensure running GParted is named correctly under GNOME Shell (#705323)
    
    Under GNOME Shell a running instance of GParted was getting named
    "Gpartedbin".  Ultimately GNOME Shell [1] uses the WM_CLASS X Window
    property [2], which GDK defaults from the executable name.
    
        $ xprop WM_NAME WM_CLASS
        (Click on running GParted window)
        WM_NAME(STRING) = "/dev/sda - GParted"
        WM_CLASS(STRING) = "gpartedbin", "Gpartedbin"
    
    Set the Class name, second string of the WM_CLASS X Window property, to
    "GParted".  (This prevents the use of the '--class' GTK+/GDK common
    command line option [3] to override the class name, but I expect nobody
    ever uses the option.  GNOME Terminal has the same limitation.  It also
    has the same change setting the Class name [4]).
    
    References:
    
    [1] Application Based GNOME 3
        https://wiki.gnome.org/GnomeShell/ApplicationBased
    
    [2] WM_CLASS Property, Inter-Client Communication Conventions Manual
        http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.2.5
    
    [3] Running GTK+ Applications, Common command line options
        https://developer.gnome.org/gtk3/stable/gtk-running.html
    
    [4] Bug #685742 - Window class of terminals doesn't match the desktop
        file name
        https://bugzilla.gnome.org/show_bug.cgi?id=685742
        https://git.gnome.org/browse/gnome-terminal/commit/?id=3370c0e51159f5be476b909e94ac05e5362dd28a
    
    Closes Bug #705323 - Shows up as 'Gpartedbin' in GNOME Shell

 src/main.cc |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/main.cc b/src/main.cc
index 7f611fc..c0642f0 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -26,9 +26,12 @@ int main( int argc, char *argv[] )
        //initialize thread system
        Glib::thread_init() ;
        GParted::GParted_Core::mainthread = Glib::Thread::self();
-       
+
        Gtk::Main kit( argc, argv ) ;
-                
+
+       //Set WM_CLASS X Window property for correct naming under GNOME Shell
+       gdk_set_program_class( "GParted" ) ;
+
        //i18n
        bindtextdomain( GETTEXT_PACKAGE, GNOMELOCALEDIR ) ;
        bind_textdomain_codeset( GETTEXT_PACKAGE, "UTF-8" ) ;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]