[gnome-clocks] Back out the application service split



commit 343b75298586a0d37b05b3a0cd8d33e83de16323
Author: Paolo Borelli <pborelli gnome org>
Date:   Mon May 13 21:06:48 2013 +0200

    Back out the application service split
    
    The infrastructure is not there yet, among other things:
     - makes debugging hard (no "simple" print)
     - breaks icon detection in gnome-shell
     - requires jumping through oops to work in jhbuild
    
    The is work is still available in the wip/appservice branch and I still
    hope to merge it later, but right now it is getting in the way of new
    contributors.

 Makefile.am          |   20 ++-------------
 po/POTFILES.in       |    1 -
 po/POTFILES.skip     |    1 -
 src/application.vala |   33 +++++++++++++++++++++++++-
 src/launcher.vala    |   63 --------------------------------------------------
 5 files changed, 35 insertions(+), 83 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 0b82e7e..024993d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,14 +9,6 @@ SUBDIRS = libgd po
 applicationsdir = $(datadir)/applications
 applications_DATA = data/gnome-clocks.desktop
 dist_noinst_DATA = data/gnome-clocks.desktop.in
-dbusservicedir = $(datadir)/dbus-1/services
-dbusservice_DATA = data/org.gnome.clocks.service
-
-data/org.gnome.clocks.service: Makefile
-       $(AM_V_GEN) (echo '[D-BUS Service]'; \
-                    echo 'Name=org.gnome.clocks'; \
-                    echo 'Exec=${libexecdir}/gnome-clocks-service') > $  tmp && \
-                   mv $  tmp $@
 
 # gsettings
 gsettings_SCHEMAS = data/org.gnome.clocks.gschema.xml
@@ -99,7 +91,6 @@ AM_VALAFLAGS = \
        --pkg libnotify \
        --pkg gd-1.0
 
-libexec_PROGRAMS = gnome-clocks-service
 bin_PROGRAMS = gnome-clocks
 
 BUILT_SOURCES = \
@@ -120,7 +111,7 @@ VALA_SOURCES = \
        src/widgets.vala \
        src/main.vala
 
-gnome_clocks_service_SOURCES = \
+gnome_clocks_SOURCES = \
        $(BUILT_SOURCES) \
        $(VALA_SOURCES) \
        src/cutils.c \
@@ -134,17 +125,12 @@ AM_CFLAGS = \
        -Wno-unused-but-set-variable \
        -Wno-unused-variable
 
-gnome_clocks_service_LDFLAGS = -export-dynamic
-gnome_clocks_service_LDADD = \
+gnome_clocks_LDFLAGS = -export-dynamic
+gnome_clocks_LDADD = \
        $(top_builddir)/libgd/libgd.la \
        $(CLOCKS_LIBS) \
        -lm
 
-gnome_clocks_LDADD = $(CLOCKS_LIBS)
-gnome_clocks_SOURCES = \
-       src/launcher.vala \
-       src/config.vapi
-
 EXTRA_DIST = \
        $(icon_files) \
        $(hcicon_files) \
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e79287a..76e2ada 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -3,7 +3,6 @@ data/org.gnome.clocks.gschema.xml.in
 src/alarm.vala
 src/application.vala
 src/clock.vala
-src/launcher.vala
 src/stopwatch.vala
 src/timer.vala
 src/utils.vala
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 999c277..b329f18 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -2,7 +2,6 @@ egg-list-box/egg-flow-box.c
 libgd/libgd/gd-header-bar.c
 libgd/libgd/gd-stack-switcher.c
 src/alarm.c
-src/launcher.c
 src/stopwatch.c
 src/timer.c
 src/utils.c
diff --git a/src/application.vala b/src/application.vala
index 1d32200..711e8cf 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -19,6 +19,12 @@
 namespace Clocks {
 
 public class Application : Gtk.Application {
+    static bool print_version;
+    const OptionEntry[] option_entries = {
+        { "version", 'v', 0, OptionArg.NONE, ref print_version, N_("Print version information and exit"), 
null },
+        { null }
+    };
+
     const GLib.ActionEntry[] action_entries = {
         { "quit", on_quit_activate }
     };
@@ -26,7 +32,7 @@ public class Application : Gtk.Application {
     private Window window;
 
     public Application () {
-        Object (application_id: "org.gnome.clocks", flags: ApplicationFlags.IS_SERVICE);
+        Object (application_id: "org.gnome.clocks");
 
         add_action_entries (action_entries, this);
     }
@@ -54,6 +60,31 @@ public class Application : Gtk.Application {
         add_accelerator ("<Primary>a", "win.select-all", null);
     }
 
+    protected override bool local_command_line ([CCode (array_length = false, array_null_terminated = true)] 
ref unowned string[] arguments, out int exit_status) {
+        var ctx = new OptionContext ("");
+
+        ctx.add_main_entries (option_entries, Config.GETTEXT_PACKAGE);
+        ctx.add_group (Gtk.get_option_group (true));
+
+        // Workaround for bug #642885
+        unowned string[] argv = arguments;
+
+        try {
+            ctx.parse (ref argv);
+        } catch (Error e) {
+            exit_status = 1;
+            return true;
+        }
+
+        if (print_version) {
+            print ("%s %s\n", Environment.get_application_name (), Config.VERSION);
+            exit_status = 0;
+            return true;
+        }
+
+        return base.local_command_line (ref arguments, out exit_status);
+    }
+
     void on_quit_activate () {
         quit ();
     }


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