mate applet: Add an about window, use more appropriate install locations,
move build replacement strings to a separate imported file.
Michael Webster
3 years ago
1 | 1 | usr/bin/ |
2 | 2 | usr/share/icons |
3 | 3 | usr/share/locale |
4 | usr/libexec/xapps | |
4 | usr/libexec/xapps/mate-panel | |
5 | 5 | usr/share/mate-panel/applets |
6 | 6 | usr/share/dbus-1/services⏎ |
1 | 1 | |
2 | 2 | rm -f xapp.pot |
3 | 3 | touch xapp.pot |
4 | xgettext --language=C --keyword=_ --keyword=N_ --output=xapp.pot libxapp/*.c | |
4 | xgettext --language=C --add-comments --keyword=_ --keyword=N_ --output=xapp.pot libxapp/*.c | |
5 | xgettext --language=Python --add-comments --keyword=_ --join-existing --output=xapp.pot status-applets/*/*.py | |
5 | 6 | xgettext --language=Desktop --join-existing --add-comments \ |
6 | 7 | -k --keyword=Name --keyword=Description --output=xapp.pot status-applets/*/*.in |
7 | 8 |
11 | 11 | gi.require_version('MatePanelApplet', '4.0') |
12 | 12 | from gi.repository import Gtk, GdkPixbuf, Gdk, GObject, Gio, XApp, GLib, MatePanelApplet |
13 | 13 | |
14 | import applet_constants | |
15 | ||
14 | 16 | # Rename the process |
15 | 17 | setproctitle.setproctitle('mate-xapp-status-applet') |
16 | 18 | |
17 | 19 | # i18n |
18 | gettext.install("xapp", "@locale@") | |
19 | locale.bindtextdomain("xapp", "@locale@") | |
20 | gettext.install("xapp", applet_constants.LOCALEDIR) | |
21 | locale.bindtextdomain("xapp", applet_constants.LOCALEDIR) | |
20 | 22 | locale.textdomain("xapp") |
21 | 23 | |
22 | 24 | ICON_SIZE_REDUCTION = 2 |
235 | 237 | self.applet.set_can_focus(False) |
236 | 238 | self.applet.set_background_widget(self.applet) |
237 | 239 | |
240 | self.add_about() | |
241 | ||
238 | 242 | button_css = Gtk.CssProvider() |
239 | 243 | |
240 | 244 | if button_css.load_from_data(statusicon_css_string.encode()): |
245 | 249 | |
246 | 250 | self.indicators = {} |
247 | 251 | self.monitor = None |
252 | ||
253 | def add_about(self): | |
254 | group = Gtk.ActionGroup(name="xapp-status-applet-group") | |
255 | group.set_translation_domain("xapp") | |
256 | ||
257 | about_action = Gtk.Action(name="ShowAbout", | |
258 | icon_name="info", | |
259 | label=_("About"), | |
260 | visible=True) | |
261 | ||
262 | about_action.connect("activate", self.show_about) | |
263 | group.add_action(about_action) | |
264 | ||
265 | xml = '\ | |
266 | <menuitem name="ShowDesktopAboutItem" action="ShowAbout"/> \ | |
267 | ' | |
268 | ||
269 | self.applet.setup_menu(xml, group) | |
270 | ||
271 | def show_about(self, action, data=None): | |
272 | dialog = Gtk.AboutDialog.new() | |
273 | ||
274 | dialog.set_program_name("XApp Status Applet") | |
275 | dialog.set_version(applet_constants.PKGVERSION) | |
276 | dialog.set_license_type(Gtk.License.GPL_3_0) | |
277 | dialog.set_website("https://github.com/linuxmint/xapps") | |
278 | dialog.set_logo_icon_name("panel-applets") | |
279 | dialog.set_comments(_("An applet for displaying XApp application status icons")) | |
280 | ||
281 | dialog.run() | |
282 | dialog.destroy() | |
248 | 283 | |
249 | 284 | def on_applet_realized(self, widget, data=None): |
250 | 285 | self.indicator_box = Gtk.Box(visible=True) |
1 | 1 | |
2 | 2 | conf = configuration_data() |
3 | 3 | conf.set('locale', join_paths(get_option('prefix'), get_option('localedir'))) |
4 | conf.set('pkgversion', meson.project_version()) | |
4 | 5 | |
5 | applet_file = configure_file( | |
6 | input : 'mate-xapp-status-applet.py', | |
7 | output: 'mate-xapp-status-applet.py', | |
6 | # Put replacements in a separate file, and import the file into the applet. | |
7 | # This is mainly to make testing/dev easier - if you put the conf replacement | |
8 | # strings inside the applet itself, you have to build each time to get a valid | |
9 | # file (with all replacements made). With this, you can just copy from source, | |
10 | # and your replacements are already there in this file. | |
11 | constants_file = configure_file( | |
12 | input : 'applet_constants.py.in', | |
13 | output: 'applet_constants.py', | |
8 | 14 | configuration: conf, |
9 | 15 | ) |
10 | 16 | |
11 | install_data(applet_file, | |
12 | install_dir: join_paths(get_option('libexecdir'), 'xapps') | |
17 | libexec_files = [ | |
18 | constants_file, | |
19 | 'mate-xapp-status-applet.py' | |
20 | ] | |
21 | ||
22 | install_data(libexec_files, | |
23 | install_dir: join_paths(get_option('libexecdir'), 'xapps', 'mate-panel') | |
13 | 24 | ) |
14 | 25 | |
15 | 26 | ## DBus service file |