Commit 5e745a2f authored by Marc-André Lureau's avatar Marc-André Lureau

DFeetApp: add --version

Signed-off-by: Marc-André Lureau's avatarMarc-André Lureau <>
parent fc1ad746
# -*- coding: utf-8 -*-
from __future__ import print_function
from gi.repository import Gtk, Gio, GObject, Gdk
from gi.repository import Gtk, Gio, GObject, Gdk, GLib
from dfeet.window import DFeetWindow
import gettext
import os
......@@ -9,6 +9,20 @@ import os
_ = gettext.gettext
def make_option(long_name, short_name=None, flags=0, arg=GLib.OptionArg.NONE,
arg_data=None, description=None, arg_description=None):
# surely something like this should exist inside PyGObject itself?!
option = GLib.OptionEntry()
option.long_name = long_name.lstrip('-')
option.short_name = 0 if not short_name else short_name.lstrip('-')
option.flags = flags
option.arg = arg
option.arg_data = arg_data
option.description = description
option.arg_description = arg_description
return option
class DFeetApp(Gtk.Application):
def __init__(self, package, version, data_dir):
......@@ -17,6 +31,16 @@ class DFeetApp(Gtk.Application):
self.data_dir = data_dir
Gtk.Application.__init__(self, application_id="org.gnome.dfeet",
make_option("--version", description=_("Show version number and exit")),
def do_handle_local_options(self, options):
self.options = options
if options.contains("version"):
print(_("D-Feet version: {}").format(self.version))
return 0
return -1
# Note that the function in C activate() becomes do_activate() in Python
def do_activate(self):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment