diff --git a/debian/xapps-common.install b/debian/xapps-common.install index d0284cf..2491036 100644 --- a/debian/xapps-common.install +++ b/debian/xapps-common.install @@ -2,6 +2,6 @@ usr/bin/ usr/share/icons usr/share/locale -usr/libexec/xapps +usr/libexec/xapps/mate-panel usr/share/mate-panel/applets usr/share/dbus-1/servicesdiff --git a/makepot b/makepot index b52c1c4..8b97ab5 100755 --- a/makepot +++ b/makepot @@ -2,7 +2,8 @@ rm -f xapp.pot touch xapp.pot -xgettext --language=C --keyword=_ --keyword=N_ --output=xapp.pot libxapp/*.c +xgettext --language=C --add-comments --keyword=_ --keyword=N_ --output=xapp.pot libxapp/*.c +xgettext --language=Python --add-comments --keyword=_ --join-existing --output=xapp.pot status-applets/*/*.py xgettext --language=Desktop --join-existing --add-comments \ -k --keyword=Name --keyword=Description --output=xapp.pot status-applets/*/*.in diff --git a/status-applets/mate/applet_constants.py.in b/status-applets/mate/applet_constants.py.in new file mode 100644 index 0000000..c485123 --- /dev/null +++ b/status-applets/mate/applet_constants.py.in @@ -0,0 +1,2 @@ +LOCALEDIR = "@locale@" +PKGVERSION = "@pkgversion@" \ No newline at end of file diff --git a/status-applets/mate/mate-xapp-status-applet.py b/status-applets/mate/mate-xapp-status-applet.py index 89665aa..4c74638 100755 --- a/status-applets/mate/mate-xapp-status-applet.py +++ b/status-applets/mate/mate-xapp-status-applet.py @@ -12,12 +12,14 @@ gi.require_version('MatePanelApplet', '4.0') from gi.repository import Gtk, GdkPixbuf, Gdk, GObject, Gio, XApp, GLib, MatePanelApplet +import applet_constants + # Rename the process setproctitle.setproctitle('mate-xapp-status-applet') # i18n -gettext.install("xapp", "@locale@") -locale.bindtextdomain("xapp", "@locale@") +gettext.install("xapp", applet_constants.LOCALEDIR) +locale.bindtextdomain("xapp", applet_constants.LOCALEDIR) locale.textdomain("xapp") ICON_SIZE_REDUCTION = 2 @@ -236,6 +238,8 @@ self.applet.set_can_focus(False) self.applet.set_background_widget(self.applet) + self.add_about() + button_css = Gtk.CssProvider() if button_css.load_from_data(statusicon_css_string.encode()): @@ -246,6 +250,37 @@ self.indicators = {} self.monitor = None + + def add_about(self): + group = Gtk.ActionGroup(name="xapp-status-applet-group") + group.set_translation_domain("xapp") + + about_action = Gtk.Action(name="ShowAbout", + icon_name="info", + label=_("About"), + visible=True) + + about_action.connect("activate", self.show_about) + group.add_action(about_action) + + xml = '\ + \ + ' + + self.applet.setup_menu(xml, group) + + def show_about(self, action, data=None): + dialog = Gtk.AboutDialog.new() + + dialog.set_program_name("XApp Status Applet") + dialog.set_version(applet_constants.PKGVERSION) + dialog.set_license_type(Gtk.License.GPL_3_0) + dialog.set_website("https://github.com/linuxmint/xapps") + dialog.set_logo_icon_name("panel-applets") + dialog.set_comments(_("An applet for displaying XApp application status icons")) + + dialog.run() + dialog.destroy() def on_applet_realized(self, widget, data=None): self.indicator_box = Gtk.Box(visible=True) diff --git a/status-applets/mate/meson.build b/status-applets/mate/meson.build index baf1dfd..54d01f7 100644 --- a/status-applets/mate/meson.build +++ b/status-applets/mate/meson.build @@ -2,15 +2,26 @@ conf = configuration_data() conf.set('locale', join_paths(get_option('prefix'), get_option('localedir'))) +conf.set('pkgversion', meson.project_version()) -applet_file = configure_file( - input : 'mate-xapp-status-applet.py', - output: 'mate-xapp-status-applet.py', +# Put replacements in a separate file, and import the file into the applet. +# This is mainly to make testing/dev easier - if you put the conf replacement +# strings inside the applet itself, you have to build each time to get a valid +# file (with all replacements made). With this, you can just copy from source, +# and your replacements are already there in this file. +constants_file = configure_file( + input : 'applet_constants.py.in', + output: 'applet_constants.py', configuration: conf, ) -install_data(applet_file, - install_dir: join_paths(get_option('libexecdir'), 'xapps') +libexec_files = [ + constants_file, + 'mate-xapp-status-applet.py' +] + +install_data(libexec_files, + install_dir: join_paths(get_option('libexecdir'), 'xapps', 'mate-panel') ) ## DBus service file