[gnome-break-timer/dylanmccall/meson-build: 8/25] Fix errors with desktop files and service names



commit 9c1870bffd75f7829ee8f2f21653c89a253dff89
Author: Dylan McCall <dylan dylanmccall com>
Date:   Mon Dec 31 23:46:33 2018 -0800

    Fix errors with desktop files and service names

 .buildconfig                                       |  4 ++--
 autogen.sh                                         | 28 ----------------------
 common/IBreakHelper.vala                           |  4 ----
 config.vapi                                        |  3 +++
 data/meson.build                                   | 21 ++++++++--------
 ...g.gnome.BreakTimer.Helper-autostart.desktop.in} |  0
 ...p.in => org.gnome.BreakTimer.Helper.desktop.in} |  0
 ...sktop.in => org.gnome.BreakTimer.desktop.in.in} |  2 +-
 data/org.gnome.BreakTimer.service.in               |  3 ---
 flatpak/org.gnome.BreakTimer.json                  | 17 +++++++++----
 helper/BreakManager.vala                           |  4 ++--
 helper/HelperApplication.vala                      |  6 ++---
 helper/break/TimerBreakType.vala                   |  4 ++--
 meson.build                                        |  7 ++++--
 settings/BreakManager.vala                         |  6 ++---
 settings/SettingsApplication.vala                  |  2 +-
 settings/TimerBreakType.vala                       |  6 ++---
 17 files changed, 47 insertions(+), 70 deletions(-)
---
diff --git a/.buildconfig b/.buildconfig
index 1de2df6..20ebbb4 100644
--- a/.buildconfig
+++ b/.buildconfig
@@ -1,10 +1,10 @@
 [default]
 name=Default
-runtime=flatpak:org.gnome.Platform/x86_64/3.28
+runtime=flatpak:org.gnome.Platform/x86_64/3.30
 config-opts=
 run-opts=
 prefix=/app
 app-id=
 postbuild=
 prebuild=
-default=true
+toolchain=default
diff --git a/common/IBreakHelper.vala b/common/IBreakHelper.vala
index fce367b..32b4503 100644
--- a/common/IBreakHelper.vala
+++ b/common/IBreakHelper.vala
@@ -17,10 +17,6 @@
 
 namespace BreakTimer {
 
-public const string HELPER_BUS_NAME = "org.gnome.BreakTimer";
-public const string HELPER_OBJECT_PATH = "/org/gnome/BreakTimer";
-public const string HELPER_BREAK_OBJECT_BASE_PATH = "/org/gnome/BreakTimer/";
-
 [DBus (name = "org.gnome.BreakTimer")]
 public interface IBreakHelper : Object {
        /** Returns the ID of the break that is currently focused and activated, if any. */
diff --git a/config.vapi b/config.vapi
index 328d656..ccde408 100644
--- a/config.vapi
+++ b/config.vapi
@@ -7,4 +7,7 @@ namespace Config {
        public const string VERSION;
        public const string HELPER_DESKTOP_ID;
        public const string SETTINGS_DESKTOP_ID;
+       public const string HELPER_BUS_NAME;
+       public const string HELPER_OBJECT_PATH;
+       public const string HELPER_BREAK_OBJECT_BASE_PATH;
 }
diff --git a/data/meson.build b/data/meson.build
index be0cd64..d5745e9 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,7 +1,16 @@
 subdir('icons')
 
+desktop_conf = configuration_data()
+desktop_conf.set('bindir', bindir)
+
+desktop_in_file = configure_file(
+    input: 'org.gnome.BreakTimer.desktop.in.in',
+    output: 'org.gnome.BreakTimer.desktop.in',
+    configuration: desktop_conf
+)
+
 i18n.merge_file(
-    input: 'org.gnome.BreakTimer.desktop.in',
+    input: desktop_in_file,
     output: 'org.gnome.BreakTimer.desktop',
     type: 'desktop',
     po_dir: po_dir,
@@ -27,16 +36,6 @@ i18n.merge_file(
 
 gnome.compile_schemas()
 
-service_conf = configuration_data()
-service_conf.set('bindir', bindir)
-
-configure_file(
-    input: 'org.gnome.BreakTimer.service.in',
-    output: 'org.gnome.BreakTimer.service',
-    configuration: service_conf,
-    install_dir: join_paths(datadir, 'dbus-1', 'services')
-)
-
 break_timer_resources = gnome.compile_resources(
     'resources',
     'org.gnome.BreakTimer.gresource.xml',
diff --git a/data/gnome-break-timer-autostart.desktop.in 
b/data/org.gnome.BreakTimer.Helper-autostart.desktop.in
similarity index 100%
rename from data/gnome-break-timer-autostart.desktop.in
rename to data/org.gnome.BreakTimer.Helper-autostart.desktop.in
diff --git a/data/gnome-break-timer-service.desktop.in b/data/org.gnome.BreakTimer.Helper.desktop.in
similarity index 100%
rename from data/gnome-break-timer-service.desktop.in
rename to data/org.gnome.BreakTimer.Helper.desktop.in
diff --git a/data/org.gnome.BreakTimer.desktop.in b/data/org.gnome.BreakTimer.desktop.in.in
similarity index 85%
rename from data/org.gnome.BreakTimer.desktop.in
rename to data/org.gnome.BreakTimer.desktop.in.in
index cb8bec5..0f8b120 100644
--- a/data/org.gnome.BreakTimer.desktop.in
+++ b/data/org.gnome.BreakTimer.desktop.in.in
@@ -6,5 +6,5 @@ Keywords=break;micro;rest;timer;
 X-Ubuntu-Gettext-Domain=gnome-break-timer
 Categories=GNOME;GTK;Utility;Settings;
 Icon=org.gnome.BreakTimer
-Exec=gapplication launch org.gnome.BreakTimer
+Exec=@bindir@/gnome-break-timer-settings
 StartupNotify=true
diff --git a/flatpak/org.gnome.BreakTimer.json b/flatpak/org.gnome.BreakTimer.json
index 8d201d6..d389499 100644
--- a/flatpak/org.gnome.BreakTimer.json
+++ b/flatpak/org.gnome.BreakTimer.json
@@ -1,16 +1,23 @@
 {
     "id" : "org.gnome.BreakTimer",
     "runtime" : "org.gnome.Platform",
-    "runtime-version" : "master",
+    "runtime-version" : "3.28",
     "sdk" : "org.gnome.Sdk",
     "command" : "gnome-break-timer-settings",
-    "finish-args": [
-        "--share=ipc", "--socket=x11",
+    "finish-args" : [
+        "--share=ipc",
+        "--socket=x11",
         "--socket=wayland",
         "--talk-name=org.gnome.Shell",
         "--filesystem=/usr/share/glib-2.0/schemas:ro",
-        "--filesystem=xdg-run/dconf", "--filesystem=~/.config/dconf:rw",
-        "--talk-name=ca.desrt.dconf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
+        "--filesystem=xdg-run/dconf",
+        "--filesystem=~/.config/dconf:rw",
+        "--own-name=org.gnome.BreakTimer",
+        "--talk-name=org.gnome.BreakTimer",
+        "--own-name=org.gnome.BreakTimer.*",
+        "--talk-name=org.gnome.BreakTimer.*",
+        "--talk-name=ca.desrt.dconf",
+        "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
     ],
     "build-options" : {
         "cflags" : "-O2 -g",
diff --git a/helper/BreakManager.vala b/helper/BreakManager.vala
index ccc15bb..9ca2c76 100644
--- a/helper/BreakManager.vala
+++ b/helper/BreakManager.vala
@@ -40,7 +40,7 @@ public class BreakManager : Object {
                try {
                        DBusConnection connection = Bus.get_sync (BusType.SESSION, null);
                        connection.register_object (
-                               HELPER_OBJECT_PATH,
+                               Config.HELPER_OBJECT_PATH,
                                this.break_helper_server
                        );
                } catch (IOError error) {
@@ -141,4 +141,4 @@ public class BreakHelperServer : Object, IBreakHelper {
                BreakType? break_type = this.break_manager.get_break_type_for_name (break_name);
                if (break_type != null) break_type.break_controller.activate ();
        }
-}
\ No newline at end of file
+}
diff --git a/helper/HelperApplication.vala b/helper/HelperApplication.vala
index 79e4486..1db261a 100644
--- a/helper/HelperApplication.vala
+++ b/helper/HelperApplication.vala
@@ -16,7 +16,7 @@
  */
 
 public class HelperApplication : Gtk.Application {
-       const string app_id = HELPER_BUS_NAME+".Helper";
+       const string app_id = Config.HELPER_DESKTOP_ID;
        const string app_name = _("GNOME Break Timer");
        const int DATA_VERSION = 0;
        
@@ -114,7 +114,7 @@ public class HelperApplication : Gtk.Application {
 
                var connection = this.get_dbus_connection ();
                if (connection != null) {
-                       Bus.own_name_on_connection (connection, HELPER_BUS_NAME, BusNameOwnerFlags.REPLACE, 
null, null);
+                       Bus.own_name_on_connection (connection, Config.HELPER_BUS_NAME, 
BusNameOwnerFlags.REPLACE, null, null);
                }
        }
 
@@ -185,4 +185,4 @@ public class HelperApplication : Gtk.Application {
                        }
                }
        }
-}
\ No newline at end of file
+}
diff --git a/helper/break/TimerBreakType.vala b/helper/break/TimerBreakType.vala
index c5541bc..46bb214 100644
--- a/helper/break/TimerBreakType.vala
+++ b/helper/break/TimerBreakType.vala
@@ -38,7 +38,7 @@ public abstract class TimerBreakType : BreakType {
                try {
                        DBusConnection connection = Bus.get_sync (BusType.SESSION, null);
                        connection.register_object (
-                               HELPER_BREAK_OBJECT_BASE_PATH+this.id,
+                               Config.HELPER_BREAK_OBJECT_BASE_PATH+this.id,
                                this.break_type_server
                        );
                } catch (IOError error) {
@@ -71,4 +71,4 @@ private class BreakHelper_TimerBreakServer : Object, IBreakHelper_TimerBreak {
        public void activate () {
                this.break_controller.activate ();
        }
-}
\ No newline at end of file
+}
diff --git a/meson.build b/meson.build
index 1fc2cf9..9d0f49a 100644
--- a/meson.build
+++ b/meson.build
@@ -34,8 +34,11 @@ conf.set_quoted('PACKAGE_NAME', meson.project_name())
 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
 conf.set_quoted('PACKAGE_URL', 'TODO')
 conf.set_quoted('VERSION', meson.project_version())
-conf.set_quoted('HELPER_DESKTOP_ID', 'TODO')
-conf.set_quoted('SETTINGS_DESKTOP_ID', 'TODO')
+conf.set_quoted('SETTINGS_DESKTOP_ID', 'org.gnome.BreakTimer')
+conf.set_quoted('HELPER_DESKTOP_ID', 'org.gnome.BreakTimer.Helper')
+conf.set_quoted('HELPER_BUS_NAME', 'org.gnome.BreakTimer.Helper')
+conf.set_quoted('HELPER_OBJECT_PATH', '/org/gnome/BreakTimer')
+conf.set_quoted('HELPER_BREAK_OBJECT_BASE_PATH', '/org/gnome/BreakTimer/')
 
 add_project_arguments('-DGETTEXT_PACKAGE="' + gettext_package + '"', language: 'c')
 
diff --git a/settings/BreakManager.vala b/settings/BreakManager.vala
index 64ea70b..4274010 100644
--- a/settings/BreakManager.vala
+++ b/settings/BreakManager.vala
@@ -67,7 +67,7 @@ public class BreakManager : Object {
 
                this.status_changed ();
 
-               Bus.watch_name (BusType.SESSION, HELPER_BUS_NAME, BusNameWatcherFlags.NONE,
+               Bus.watch_name (BusType.SESSION, Config.HELPER_BUS_NAME, BusNameWatcherFlags.NONE,
                                this.break_helper_appeared, this.break_helper_disappeared);
        }
 
@@ -118,8 +118,8 @@ public class BreakManager : Object {
                try {
                        this.break_helper = Bus.get_proxy_sync (
                                BusType.SESSION,
-                               HELPER_BUS_NAME,
-                               HELPER_OBJECT_PATH,
+                               Config.HELPER_BUS_NAME,
+                               Config.HELPER_OBJECT_PATH,
                                DBusProxyFlags.DO_NOT_AUTO_START
                        );
                        this.break_status_available ();
diff --git a/settings/SettingsApplication.vala b/settings/SettingsApplication.vala
index b47c3ca..59779f2 100644
--- a/settings/SettingsApplication.vala
+++ b/settings/SettingsApplication.vala
@@ -21,7 +21,7 @@ using GLib;
 namespace BreakTimer.Settings {
 
 public class SettingsApplication : Gtk.Application {
-       const string app_id = HELPER_BUS_NAME+".Settings";
+       const string app_id = Config.SETTINGS_DESKTOP_ID;
        
        private const string STYLE_DATA =
                """
diff --git a/settings/TimerBreakType.vala b/settings/TimerBreakType.vala
index e617e94..263219f 100644
--- a/settings/TimerBreakType.vala
+++ b/settings/TimerBreakType.vala
@@ -39,7 +39,7 @@ public abstract class TimerBreakType : BreakType {
 
        public override void initialize () {
                base.initialize ();
-               Bus.watch_name (BusType.SESSION, HELPER_BUS_NAME, BusNameWatcherFlags.NONE,
+               Bus.watch_name (BusType.SESSION, Config.HELPER_BUS_NAME, BusNameWatcherFlags.NONE,
                                this.breakhelper_appeared, this.breakhelper_disappeared);
        }
 
@@ -80,8 +80,8 @@ public abstract class TimerBreakType : BreakType {
                try {
                        this.break_server = Bus.get_proxy_sync (
                                BusType.SESSION,
-                               HELPER_BUS_NAME,
-                               HELPER_BREAK_OBJECT_BASE_PATH+this.id,
+                               Config.HELPER_BUS_NAME,
+                               Config.HELPER_BREAK_OBJECT_BASE_PATH+this.id,
                                DBusProxyFlags.DO_NOT_AUTO_START
                        );
                        // We can only poll the break helper application for updates, so


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