[gtk-vnc] gvncviewer.py: Fix PyGTKDeprecationWarning in Gtk.MenuItem()



commit 93df522fe5a016cbf790603e0aeb8631c060ea8f
Author: Dr. Matthias St. Pierre <matthias st pierre ncp-e com>
Date:   Thu Oct 22 17:53:52 2020 +0200

    gvncviewer.py: Fix PyGTKDeprecationWarning in Gtk.MenuItem()
    
    Calling Gtk.MenuItem() with a string argument yields the following
    deprecation warning:
    
      PyGTKDeprecationWarning: Using positional arguments with the
      GObject constructor has been deprecated. Please specify
      keyword(s) for "label" or use a class specific constructor.
      See: https://wiki.gnome.org/PyGObject/InitializerDeprecations
    
    As recommended, use Gtk.MenuItem.new_with_mnemonic() instead.

 examples/gvncviewer.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/examples/gvncviewer.py b/examples/gvncviewer.py
index bd3aeb2..3eab1b2 100755
--- a/examples/gvncviewer.py
+++ b/examples/gvncviewer.py
@@ -160,14 +160,14 @@ layout = Gtk.VBox()
 window.add(layout)
 
 menubar = Gtk.MenuBar()
-sendkeys = Gtk.MenuItem("_Send keys")
+sendkeys = Gtk.MenuItem.new_with_mnemonic("_Send keys")
 menubar.append(sendkeys)
 
 buttons = Gtk.HBox()
-caf1 = Gtk.MenuItem("Ctrl+Alt+F_1")
-caf7 = Gtk.MenuItem("Ctrl+Alt+F_7")
-cad = Gtk.MenuItem("Ctrl+Alt+_Del")
-cab = Gtk.MenuItem("Ctrl+Alt+_Backspace")
+caf1 = Gtk.MenuItem.new_with_mnemonic("Ctrl+Alt+F_1")
+caf7 = Gtk.MenuItem.new_with_mnemonic("Ctrl+Alt+F_7")
+cad = Gtk.MenuItem.new_with_mnemonic("Ctrl+Alt+_Del")
+cab = Gtk.MenuItem.new_with_mnemonic("Ctrl+Alt+_Backspace")
 
 submenu = Gtk.Menu()
 submenu.append(caf1)


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