Merge lp:~attente/indicator-keyboard/handle-sigterm into lp:indicator-keyboard

Proposed by William Hua
Status: Merged
Approved by: Ted Gould
Approved revision: 105
Merged at revision: 107
Proposed branch: lp:~attente/indicator-keyboard/handle-sigterm
Merge into: lp:indicator-keyboard
Diff against target: 98 lines (+30/-10)
2 files modified
lib/main.vala (+26/-6)
po/indicator-keyboard.pot (+4/-4)
To merge this branch: bzr merge lp:~attente/indicator-keyboard/handle-sigterm
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+181481@code.launchpad.net

Commit message

Proper shutdown on SIGTERM.

Description of the change

Proper shutdown on SIGTERM.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/main.vala'
2--- lib/main.vala 2013-08-12 01:33:27 +0000
3+++ lib/main.vala 2013-08-22 07:27:00 +0000
4@@ -19,6 +19,7 @@
5 [DBus (name = "com.canonical.indicator.keyboard")]
6 public class Indicator.Keyboard.Service : Object {
7
8+ private static Service service;
9 private static IBus.Bus? ibus;
10
11 private bool force;
12@@ -77,6 +78,22 @@
13 }
14
15 [DBus (visible = false)]
16+ public void up () {
17+ if (loop == null) {
18+ loop = new MainLoop ();
19+ ((!) loop).run ();
20+ }
21+ }
22+
23+ [DBus (visible = false)]
24+ public void down () {
25+ if (loop != null) {
26+ ((!) loop).quit ();
27+ loop = null;
28+ }
29+ }
30+
31+ [DBus (visible = false)]
32 private void acquire_bus_name () {
33 Bus.own_name (BusType.SESSION,
34 "com.canonical.indicator.keyboard",
35@@ -84,9 +101,6 @@
36 handle_bus_acquired,
37 null,
38 handle_name_lost);
39-
40- loop = new MainLoop ();
41- ((!) loop).run ();
42 }
43
44 [DBus (visible = false)]
45@@ -428,13 +442,19 @@
46
47 [DBus (visible = false)]
48 private void handle_name_lost (DBusConnection? connection, string name) {
49- ((!) loop).quit ();
50- loop = null;
51+ down ();
52 }
53
54 [DBus (visible = false)]
55 public static int main (string[] args) {
56- new Service (ref args);
57+ Service.service = new Service (ref args);
58+
59+ Posix.signal (Posix.SIGTERM, (code) => {
60+ Service.service.down ();
61+ });
62+
63+ Service.service.up ();
64+
65 return 0;
66 }
67 }
68
69=== modified file 'po/indicator-keyboard.pot'
70--- po/indicator-keyboard.pot 2013-08-21 04:46:54 +0000
71+++ po/indicator-keyboard.pot 2013-08-22 07:27:00 +0000
72@@ -8,7 +8,7 @@
73 msgstr ""
74 "Project-Id-Version: PACKAGE VERSION\n"
75 "Report-Msgid-Bugs-To: \n"
76-"POT-Creation-Date: 2013-08-21 12:15+0800\n"
77+"POT-Creation-Date: 2013-08-22 15:09+0800\n"
78 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
79 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
80 "Language-Team: LANGUAGE <LL@li.org>\n"
81@@ -17,14 +17,14 @@
82 "Content-Type: text/plain; charset=CHARSET\n"
83 "Content-Transfer-Encoding: 8bit\n"
84
85-#: ../lib/main.c:1419 ../lib/main.vala:328
86+#: ../lib/main.c:1449 ../lib/main.vala:342
87 msgid "Character Map"
88 msgstr ""
89
90-#: ../lib/main.c:1421 ../lib/main.vala:329
91+#: ../lib/main.c:1451 ../lib/main.vala:343
92 msgid "Keyboard Layout Chart"
93 msgstr ""
94
95-#: ../lib/main.c:1423 ../lib/main.vala:330
96+#: ../lib/main.c:1453 ../lib/main.vala:344
97 msgid "Text Entry Settings..."
98 msgstr ""

Subscribers

People subscribed via source and target branches

to all changes: