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
=== modified file 'lib/main.vala'
--- lib/main.vala 2013-08-12 01:33:27 +0000
+++ lib/main.vala 2013-08-22 07:27:00 +0000
@@ -19,6 +19,7 @@
19[DBus (name = "com.canonical.indicator.keyboard")]19[DBus (name = "com.canonical.indicator.keyboard")]
20public class Indicator.Keyboard.Service : Object {20public class Indicator.Keyboard.Service : Object {
2121
22 private static Service service;
22 private static IBus.Bus? ibus;23 private static IBus.Bus? ibus;
2324
24 private bool force;25 private bool force;
@@ -77,6 +78,22 @@
77 }78 }
7879
79 [DBus (visible = false)]80 [DBus (visible = false)]
81 public void up () {
82 if (loop == null) {
83 loop = new MainLoop ();
84 ((!) loop).run ();
85 }
86 }
87
88 [DBus (visible = false)]
89 public void down () {
90 if (loop != null) {
91 ((!) loop).quit ();
92 loop = null;
93 }
94 }
95
96 [DBus (visible = false)]
80 private void acquire_bus_name () {97 private void acquire_bus_name () {
81 Bus.own_name (BusType.SESSION,98 Bus.own_name (BusType.SESSION,
82 "com.canonical.indicator.keyboard",99 "com.canonical.indicator.keyboard",
@@ -84,9 +101,6 @@
84 handle_bus_acquired,101 handle_bus_acquired,
85 null,102 null,
86 handle_name_lost);103 handle_name_lost);
87
88 loop = new MainLoop ();
89 ((!) loop).run ();
90 }104 }
91105
92 [DBus (visible = false)]106 [DBus (visible = false)]
@@ -428,13 +442,19 @@
428442
429 [DBus (visible = false)]443 [DBus (visible = false)]
430 private void handle_name_lost (DBusConnection? connection, string name) {444 private void handle_name_lost (DBusConnection? connection, string name) {
431 ((!) loop).quit ();445 down ();
432 loop = null;
433 }446 }
434447
435 [DBus (visible = false)]448 [DBus (visible = false)]
436 public static int main (string[] args) {449 public static int main (string[] args) {
437 new Service (ref args);450 Service.service = new Service (ref args);
451
452 Posix.signal (Posix.SIGTERM, (code) => {
453 Service.service.down ();
454 });
455
456 Service.service.up ();
457
438 return 0;458 return 0;
439 }459 }
440}460}
441461
=== modified file 'po/indicator-keyboard.pot'
--- po/indicator-keyboard.pot 2013-08-21 04:46:54 +0000
+++ po/indicator-keyboard.pot 2013-08-22 07:27:00 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: PACKAGE VERSION\n"9"Project-Id-Version: PACKAGE VERSION\n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2013-08-21 12:15+0800\n"11"POT-Creation-Date: 2013-08-22 15:09+0800\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,14 +17,14 @@
17"Content-Type: text/plain; charset=CHARSET\n"17"Content-Type: text/plain; charset=CHARSET\n"
18"Content-Transfer-Encoding: 8bit\n"18"Content-Transfer-Encoding: 8bit\n"
1919
20#: ../lib/main.c:1419 ../lib/main.vala:32820#: ../lib/main.c:1449 ../lib/main.vala:342
21msgid "Character Map"21msgid "Character Map"
22msgstr ""22msgstr ""
2323
24#: ../lib/main.c:1421 ../lib/main.vala:32924#: ../lib/main.c:1451 ../lib/main.vala:343
25msgid "Keyboard Layout Chart"25msgid "Keyboard Layout Chart"
26msgstr ""26msgstr ""
2727
28#: ../lib/main.c:1423 ../lib/main.vala:33028#: ../lib/main.c:1453 ../lib/main.vala:344
29msgid "Text Entry Settings..."29msgid "Text Entry Settings..."
30msgstr ""30msgstr ""

Subscribers

People subscribed via source and target branches

to all changes: