[gnome-weather] Move application to the new deployment format



commit 63f6e4ec27f192b76ad933a71a6a79704afeec3e
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sun Aug 18 17:52:52 2013 +0200

    Move application to the new deployment format
    
    Make the application DBus activatable, and make sure that all
    files in shared directories (except for the launcher in $bindir)
    are in reverse dns notation.

 Makefile.am                                        |    2 +
 configure.ac                                       |    8 +++--
 data/Makefile.am                                   |   36 +++++++++++++++----
 data/icons/Makefile.am                             |   12 +++---
 ...ather.png => org.gnome.Weather.Application.png} |  Bin 896 -> 896 bytes
 ...ather.png => org.gnome.Weather.Application.png} |  Bin 1415 -> 1415 bytes
 ...ather.png => org.gnome.Weather.Application.png} |  Bin 54717 -> 54717 bytes
 ...ather.png => org.gnome.Weather.Application.png} |  Bin 2218 -> 2218 bytes
 ...ather.png => org.gnome.Weather.Application.png} |  Bin 4043 -> 4043 bytes
 ...ather.svg => org.gnome.Weather.Application.svg} |    0
 ...=> org.gnome.Weather.Application.desktop.in.in} |    5 ++-
 ...=> org.gnome.Weather.Application.gresource.xml} |    0
 data/org.gnome.Weather.Application.service.in      |    3 ++
 po/POTFILES.in                                     |    2 +-
 po/POTFILES.skip                                   |    1 +
 src/Makefile.am                                    |   22 ++++++++++--
 src/gnome-weather.in                               |    6 +---
 src/main.js                                        |    6 ++-
 src/org.gnome.Weather.Application.in               |    6 +++
 19 files changed, 78 insertions(+), 31 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 1206837..2ebdb74 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,4 +19,6 @@ MAINTAINERCLEANFILES = \
 
 GITIGNOREFILES = m4/
 
+distdir = $(PACKAGE_TARNAME)-$(VERSION)
+
 -include $(top_srcdir)/git.mk
diff --git a/configure.ac b/configure.ac
index a6cfceb..4168a66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ(2.63)
-AC_INIT([gnome-weather],[3.9.5],
+AC_INIT([org.gnome.Weather.Application],[3.9.5],
        [https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-weather],
        [gnome-weather],
        [https://live.gnome.org/Design/Apps/Weather])
@@ -7,11 +7,13 @@ AC_INIT([gnome-weather],[3.9.5],
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR([m4])
 
-AM_INIT_AUTOMAKE([1.11 dist-xz foreign tar-ustar -Wno-portability])
+AM_INIT_AUTOMAKE([1.11 dist-xz foreign tar-ustar no-define -Wno-portability])
+# revert automake using PACKAGE_TARNAME instead of PACKAGE_NAME
+AC_SUBST([PACKAGE], [$PACKAGE_NAME])
 
 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
 
-GETTEXT_PACKAGE=gnome-weather
+GETTEXT_PACKAGE=$PACKAGE_NAME
 AC_SUBST(GETTEXT_PACKAGE)
 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
                    [The prefix for our gettext translation domains.])
diff --git a/data/Makefile.am b/data/Makefile.am
index c51aa40..ae834be 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -2,32 +2,52 @@
 # 5 different directory declarations
 SUBDIRS = icons
 
-resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies 
$(srcdir)/gnome-weather.gresource.xml)
-gnome-weather.gresource: gnome-weather.gresource.xml $(resource_files)
+resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies 
$(srcdir)/$(PACKAGE_NAME).gresource.xml)
+$(PACKAGE_NAME).gresource: $(PACKAGE_NAME).gresource.xml $(resource_files)
        $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) $<
 
 resourcedir = $(pkgdatadir)
-resource_DATA = gnome-weather.gresource
+resource_DATA = $(PACKAGE_NAME).gresource
 
 appsdir = $(datadir)/applications
-apps_DATA = gnome-weather.desktop
+apps_DATA = $(PACKAGE_NAME).desktop
 
 @INTLTOOL_DESKTOP_RULE@
 
-gsettings_SCHEMAS = org.gnome.Weather.Application.gschema.xml
+gsettings_SCHEMAS = $(PACKAGE_NAME).gschema.xml
 
 @GSETTINGS_RULES@
 
+$(PACKAGE_NAME).service: $(PACKAGE_NAME).service.in
+       $(AM_V_GEN) sed \
+               -e "s|[ ]PACKAGE_NAME@|$(PACKAGE_NAME)|g" \
+               -e "s|[ ]pkgdatadir@|$(pkgdatadir)|g" \
+               -e "s|[ ]pkglibdir@|$(pkglibdir)|g" \
+               $< > $@
+
+$(PACKAGE_NAME).desktop.in: $(PACKAGE_NAME).desktop.in.in
+       $(AM_V_GEN) sed \
+               -e "s|[ ]PACKAGE_NAME@|$(PACKAGE_NAME)|g" \
+               -e "s|[ ]pkgdatadir@|$(pkgdatadir)|g" \
+               -e "s|[ ]pkglibdir@|$(pkglibdir)|g" \
+               $< > $@
+
+servicedir = $(datadir)/dbus-1/services
+service_DATA = $(PACKAGE_NAME).service
+
 EXTRA_DIST = \
        CREDITS \
-       gnome-weather.desktop.in \
-       gnome-weather.gresource.xml \
+       $(PACKAGE_NAME).desktop.in.in \
+       $(PACKAGE_NAME).service.in \
+       $(PACKAGE_NAME).gresource.xml \
        $(gsettings_SCHEMAS) \
        $(resource_files) \
        $(NULL)
 
 CLEANFILES = \
-       gnome-weather.gresource \
+       $(PACKAGE_NAME).desktop.in \
+       $(PACKAGE_NAME).service \
+       $(PACKAGE_NAME).gresource \
        $(apps_DATA) \
        *.valid \
        gschemas.compiled \
diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am
index 9082bf2..3f3cc1c 100644
--- a/data/icons/Makefile.am
+++ b/data/icons/Makefile.am
@@ -3,13 +3,13 @@ icondir = $(datadir)/icons/
 # I'd like to use nobase_dist_icon_DATA, but
 # automake doesn't recognizes two prefixes at once
 nobase_icon_DATA = \
-       hicolor/16x16/apps/gnome-weather.png \
-       hicolor/22x22/apps/gnome-weather.png \
-       hicolor/32x32/apps/gnome-weather.png \
-       hicolor/48x48/apps/gnome-weather.png \
-       hicolor/256x256/apps/gnome-weather.png
+       hicolor/16x16/apps/$(PACKAGE_NAME).png \
+       hicolor/22x22/apps/$(PACKAGE_NAME).png \
+       hicolor/32x32/apps/$(PACKAGE_NAME).png \
+       hicolor/48x48/apps/$(PACKAGE_NAME).png \
+       hicolor/256x256/apps/$(PACKAGE_NAME).png
 
-EXTRA_DIST = $(nobase_icon_DATA) hicolor/gnome-weather.svg
+EXTRA_DIST = $(nobase_icon_DATA) hicolor/$(PACKAGE_NAME).svg
 
 gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor; gtk-update-icon-cache -f -t 
$(datadir)/icons/HighContrast
 
diff --git a/data/icons/hicolor/gnome-weather.svg b/data/icons/hicolor/org.gnome.Weather.Application.svg
similarity index 100%
rename from data/icons/hicolor/gnome-weather.svg
rename to data/icons/hicolor/org.gnome.Weather.Application.svg
diff --git a/data/gnome-weather.desktop.in b/data/org.gnome.Weather.Application.desktop.in.in
similarity index 56%
rename from data/gnome-weather.desktop.in
rename to data/org.gnome.Weather.Application.desktop.in.in
index 2f9ad50..3e4d019 100644
--- a/data/gnome-weather.desktop.in
+++ b/data/org.gnome.Weather.Application.desktop.in.in
@@ -2,5 +2,6 @@
 Type=Application
 _Name=Weather
 _Comment=Show weather conditions and forecast
-Icon=gnome-weather
-Exec=gnome-weather
+Icon= PACKAGE_NAME@
+Exec= pkgdatadir@/@PACKAGE_NAME@
+DBusActivatable=true
\ No newline at end of file
diff --git a/data/gnome-weather.gresource.xml b/data/org.gnome.Weather.Application.gresource.xml
similarity index 100%
rename from data/gnome-weather.gresource.xml
rename to data/org.gnome.Weather.Application.gresource.xml
diff --git a/data/org.gnome.Weather.Application.service.in b/data/org.gnome.Weather.Application.service.in
new file mode 100644
index 0000000..2f615d9
--- /dev/null
+++ b/data/org.gnome.Weather.Application.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name= PACKAGE_NAME@
+Exec= pkgdatadir@/@PACKAGE_NAME@
\ No newline at end of file
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d1701ca..fbec71e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,6 @@
 [type: gettext/glade]data/app-menu.ui
 [type: gettext/glade]data/city.ui
-data/gnome-weather.desktop.in
+data/org.gnome.Weather.Application.desktop.in.in
 [type: gettext/glade]data/new-location-dialog.ui
 data/org.gnome.Weather.Application.gschema.xml
 [type: gettext/glade]data/window.ui
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
new file mode 100644
index 0000000..26fc196
--- /dev/null
+++ b/po/POTFILES.skip
@@ -0,0 +1 @@
+data/org.gnome.Weather.Application.desktop.in
diff --git a/src/Makefile.am b/src/Makefile.am
index c05cc00..d6af53f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,9 @@
 NULL =
 
-nodist_bin_SCRIPTS = gnome-weather
+nodist_bin_SCRIPTS = $(PACKAGE_TARNAME)
+nodist_pkgdata_SCRIPTS = $(PACKAGE_NAME)
+
+EXTRA_SCRIPTS = org.gnome.Weather.Application gnome-weather
 
 jsdir = $(pkgdatadir)
 dist_js_DATA = \
@@ -15,7 +18,18 @@ dist_js_DATA = \
        world.js        \
        $(NULL)
 
-gnome-weather: gnome-weather.in
+$(PACKAGE_TARNAME): $(PACKAGE_TARNAME).in
+       $(AM_V_GEN) sed \
+               -e "s|[ ]GJS@|$(GJS)|g" \
+               -e "s|[ ]PACKAGE_NAME@|$(PACKAGE_NAME)|g" \
+               -e "s|[ ]PACKAGE_VERSION@|$(PACKAGE_VERSION)|g" \
+               -e "s|[ ]prefix@|$(prefix)|g" \
+               -e "s|[ ]libdir@|$(libdir)|g" \
+               -e "s|[ ]pkgdatadir@|$(pkgdatadir)|g" \
+               $< > $@
+       @chmod +x $@
+
+$(PACKAGE_NAME): $(PACKAGE_NAME).in
        $(AM_V_GEN) sed \
                -e "s|[ ]GJS@|$(GJS)|g" \
                -e "s|[ ]PACKAGE_NAME@|$(PACKAGE_NAME)|g" \
@@ -26,7 +40,7 @@ gnome-weather: gnome-weather.in
                $< > $@
        @chmod +x $@
 
-EXTRA_DIST = gnome-weather.in
-DISTCLEANFILES = gnome-weather
+EXTRA_DIST = $(PACKAGE_NAME).in $(PACKAGE_TARNAME).in
+CLEANFILES = $(PACKAGE_NAME) $(PACKAGE_TARNAME)
 
 -include $(top_srcdir)/git.mk
diff --git a/src/gnome-weather.in b/src/gnome-weather.in
index 599e93d..8c1dbd1 100755
--- a/src/gnome-weather.in
+++ b/src/gnome-weather.in
@@ -1,7 +1,3 @@
 #! GJS@
 imports.searchPath.push("@pkgdatadir@");
-imports.package.start({ name: "@PACKAGE_NAME@",
-                        version: "@PACKAGE_VERSION@",
-                        prefix: "@prefix@",
-                        libdir: "@libdir@" });
-
+imports.package.launch({ name: "@PACKAGE_NAME@" });
\ No newline at end of file
diff --git a/src/main.js b/src/main.js
index 01b583a..765e58e 100644
--- a/src/main.js
+++ b/src/main.js
@@ -41,7 +41,8 @@ const Application = new Lang.Class({
     Extends: Gtk.Application,
 
     _init: function() {
-        this.parent({ application_id: 'org.gnome.Weather.Application' });
+        this.parent({ application_id: pkg.name,
+                      flags: Gio.ApplicationFlags.IS_SERVICE });
         GLib.set_application_name(_("Weather"));
     },
 
@@ -61,7 +62,8 @@ const Application = new Lang.Class({
         this.parent();
         Gd.ensure_types();
 
-        let resource = Gio.Resource.load(pkg.pkgdatadir + '/gnome-weather.gresource');
+        let resource = Gio.Resource.load(GLib.build_filenamev([pkg.pkgdatadir,
+                                                               pkg.name + '.gresource']));
         resource._register();
 
         Util.loadStyleSheet('/org/gnome/weather/application.css');
diff --git a/src/org.gnome.Weather.Application.in b/src/org.gnome.Weather.Application.in
new file mode 100644
index 0000000..11c4071
--- /dev/null
+++ b/src/org.gnome.Weather.Application.in
@@ -0,0 +1,6 @@
+#! GJS@
+imports.searchPath.push("@pkgdatadir@");
+imports.package.start({ name: "@PACKAGE_NAME@",
+                        version: "@PACKAGE_VERSION@",
+                        prefix: "@prefix@",
+                        libdir: "@libdir@" });
\ No newline at end of file


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