Merge lp:~julien-spautz/cable/services-namespace into lp:cable

Proposed by Julien Spautz
Status: Merged
Merged at revision: 134
Proposed branch: lp:~julien-spautz/cable/services-namespace
Merge into: lp:cable
Diff against target: 186 lines (+60/-60)
7 files modified
CMakeLists.txt (+2/-1)
src/Cable.vala (+3/-5)
src/Controller/Channel.vala (+5/-5)
src/Services/Launcher.vala (+1/-1)
src/Services/Logger.vala (+7/-0)
src/Services/Notification.vala (+0/-48)
src/Services/Notify.vala (+42/-0)
To merge this branch: bzr merge lp:~julien-spautz/cable/services-namespace
Reviewer Review Type Date Requested Status
Cable Developers Pending
Review via email: mp+185644@code.launchpad.net

Description of the change

Put Logger, Notify and Launcher into a new namespace called Services.

To post a comment you must log in.
Revision history for this message
982c80311320c1b (alexander-wilms) wrote :

All tests pass and Cable works as expected

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2013-09-05 19:26:00 +0000
3+++ CMakeLists.txt 2013-09-14 15:56:40 +0000
4@@ -76,7 +76,8 @@
5 src/Settings/SavedState.vala
6
7 src/Services/Launcher.vala
8- src/Services/Notification.vala
9+ src/Services/Notify.vala
10+ src/Services/Logger.vala
11
12 src/Widgets/Window.vala
13 src/Widgets/Welcome.vala
14
15=== modified file 'src/Cable.vala'
16--- src/Cable.vala 2013-09-05 19:26:00 +0000
17+++ src/Cable.vala 2013-09-14 15:56:40 +0000
18@@ -79,11 +79,9 @@
19 }
20
21 public App () {
22- Granite.Services.Logger.initialize ("Cable");
23- Granite.Services.Logger.DisplayLevel = Granite.Services.LogLevel.DEBUG;
24-
25- Notification.init ();
26- Launcher.init ();
27+ Services.Logger.init ();
28+ Services.Notify.init ();
29+ Services.Launcher.init ();
30 Settings.init ();
31 Utils.init ();
32 Utils.Network.init ();
33
34=== modified file 'src/Controller/Channel.vala'
35--- src/Controller/Channel.vala 2013-08-30 21:01:25 +0000
36+++ src/Controller/Channel.vala 2013-09-14 15:56:40 +0000
37@@ -97,8 +97,8 @@
38 });
39
40 view.focused.connect (() => {
41- Launcher.jobs = 0;
42- Launcher.urgent = false;
43+ Services.Launcher.jobs = 0;
44+ Services.Launcher.urgent = false;
45 return false;
46 });
47
48@@ -175,9 +175,9 @@
49 if (message.contains (server.nick)) {
50
51 if (view.has_focus == false) {
52- Notification.send (nick, message);
53- Launcher.jobs++;
54- Launcher.urgent = true;
55+ Services.Notify.send (nick, message);
56+ Services.Launcher.jobs++;
57+ Services.Launcher.urgent = true;
58 }
59
60 view.message (nick, message, MessageType.PING);
61
62=== modified file 'src/Services/Launcher.vala'
63--- src/Services/Launcher.vala 2013-07-30 00:52:16 +0000
64+++ src/Services/Launcher.vala 2013-09-14 15:56:40 +0000
65@@ -20,7 +20,7 @@
66 /**
67 * Static class for managing the launcher using libunity.
68 */
69-public class Cable.Launcher {
70+public class Cable.Services.Launcher {
71
72 static Unity.LauncherEntry launcher_entry;
73
74
75=== added file 'src/Services/Logger.vala'
76--- src/Services/Logger.vala 1970-01-01 00:00:00 +0000
77+++ src/Services/Logger.vala 2013-09-14 15:56:40 +0000
78@@ -0,0 +1,7 @@
79+class Cable.Services.Logger {
80+
81+ public static void init () {
82+ Granite.Services.Logger.initialize ("Cable");
83+ Granite.Services.Logger.DisplayLevel = Granite.Services.LogLevel.DEBUG;
84+ }
85+}
86\ No newline at end of file
87
88=== removed file 'src/Services/Notification.vala'
89--- src/Services/Notification.vala 2013-07-30 00:52:16 +0000
90+++ src/Services/Notification.vala 1970-01-01 00:00:00 +0000
91@@ -1,48 +0,0 @@
92-/***
93- Copyright (C) 2013 Cable Developers
94-
95- This program or library is free software; you can redistribute it
96- and/or modify it under the terms of the GNU Lesser General Public
97- License as published by the Free Software Foundation; either
98- version 3 of the License, or (at your option) any later version.
99-
100- This library is distributed in the hope that it will be useful,
101- but WITHOUT ANY WARRANTY; without even the implied warranty of
102- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
103- Lesser General Public License for more details.
104-
105- You should have received a copy of the GNU Lesser General
106- Public License along with this library; if not, write to the
107- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
108- Boston, MA 02110-1301 USA.
109-***/
110-
111-/**
112- * Static class to deal with notifications.
113- */
114-public class Cable.Notification : GLib.Object {
115-
116- /**
117- * Initialize Notify. Only call this once.
118- */
119- public static void init () {
120- if (Notify.is_initted ()) {
121- warning ("Trying to reinitialize Notify.");
122- return;
123- }
124-
125- Notify.init ("Cable");
126- }
127-
128- /**
129- * Send a notfication.
130- */
131- public static void send (string summary, string body) {
132- var notify = new Notify.Notification (summary, body, "internet-chat");
133- try {
134- notify.show ();
135- } catch (Error e) {
136- warning (e.message);
137- }
138- }
139-}
140
141=== added file 'src/Services/Notify.vala'
142--- src/Services/Notify.vala 1970-01-01 00:00:00 +0000
143+++ src/Services/Notify.vala 2013-09-14 15:56:40 +0000
144@@ -0,0 +1,42 @@
145+/***
146+ Copyright (C) 2013 Cable Developers
147+
148+ This program or library is free software; you can redistribute it
149+ and/or modify it under the terms of the GNU Lesser General Public
150+ License as published by the Free Software Foundation; either
151+ version 3 of the License, or (at your option) any later version.
152+
153+ This library is distributed in the hope that it will be useful,
154+ but WITHOUT ANY WARRANTY; without even the implied warranty of
155+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
156+ Lesser General Public License for more details.
157+
158+ You should have received a copy of the GNU Lesser General
159+ Public License along with this library; if not, write to the
160+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
161+ Boston, MA 02110-1301 USA.
162+***/
163+
164+/**
165+ * Static class to deal with notifications.
166+ */
167+public class Cable.Services.Notify : GLib.Object {
168+
169+ public static void init () {
170+ if (global::Notify.is_initted ()) {
171+ warning ("Trying to reinitialize Notify.");
172+ return;
173+ }
174+
175+ global::Notify.init ("Cable");
176+ }
177+
178+ public static void send (string summary, string body) {
179+ var notify = new global::Notify.Notification (summary, body, "internet-chat");
180+ try {
181+ notify.show ();
182+ } catch (Error e) {
183+ warning (e.message);
184+ }
185+ }
186+}

Subscribers

People subscribed via source and target branches

to all changes: