Merge lp:~robru/libfriends/deprecate into lp:libfriends

Proposed by Robert Bruce Park
Status: Merged
Merged at revision: 45
Proposed branch: lp:~robru/libfriends/deprecate
Merge into: lp:libfriends
Diff against target: 452 lines (+89/-143)
5 files modified
gtk/account.vala (+18/-4)
gtk/entry.vala (+20/-14)
src/service.vala (+13/-53)
src/utils.vala (+0/-1)
tests/vala/test-service.vala (+38/-71)
To merge this branch: bzr merge lp:~robru/libfriends/deprecate
Reviewer Review Type Date Requested Status
Ken VanDine Pending
Review via email: mp+143013@code.launchpad.net

Description of the change

So, I identified and fixed a bunch of warnings, but this is really just the start: the testsuite has been determined to be effectively tautological, so that needs to get fixed, and also I likely broke a bunch of other stuff too. Watch out for the FIXMEs ;-)

To post a comment you must log in.
lp:~robru/libfriends/deprecate updated
50. By Robert Bruce Park

Fix comments.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gtk/account.vala'
2--- gtk/account.vala 2013-01-11 17:25:44 +0000
3+++ gtk/account.vala 2013-01-12 02:18:21 +0000
4@@ -82,8 +82,15 @@
5 }
6 set {
7 GLib.Value t = value;
8- _account.set_value("friends/color", t);
9- _account.store_blocking();
10+ try
11+ {
12+ _account.set_value("friends/color", t);
13+ _account.store_blocking();
14+ }
15+ catch (Ag.AccountsError e)
16+ {
17+ warning (e.message);
18+ }
19 }
20 }
21
22@@ -117,8 +124,15 @@
23 GLib.Value t = false;
24 if (value == "1")
25 t = true;
26- _account.set_value("friends/send_enabled", t);
27- _account.store_blocking();
28+ try
29+ {
30+ _account.set_value("friends/send_enabled", t);
31+ _account.store_blocking();
32+ }
33+ catch (Ag.AccountsError e)
34+ {
35+ warning (e.message);
36+ }
37 }
38 }
39
40
41=== modified file 'gtk/entry.vala'
42--- gtk/entry.vala 2013-01-11 17:25:44 +0000
43+++ gtk/entry.vala 2013-01-12 02:18:21 +0000
44@@ -124,14 +124,14 @@
45 private Friends.Service service;
46
47 /**
48- * The {@link Gdk.Color} for the foreground
49+ * The {@link Gdk.RGBA} for the foreground
50 */
51- public Gdk.Color fg_color;
52+ public Gdk.RGBA fg_color;
53
54 /**
55- * The {@link Gdk.Color} for the error state
56+ * The {@link Gdk.RGBA} for the error state
57 */
58- public Gdk.Color error_color;
59+ public Gdk.RGBA error_color;
60
61 bool last_was_shortened = false;
62 private string _mid = null;
63@@ -159,9 +159,13 @@
64 Gtk.BindingEntry.add_signal (binding_set, Gdk.keyval_from_name ("Return"), 0, "submit", 0);
65 Gtk.BindingEntry.add_signal (binding_set, Gdk.keyval_from_name ("KP_Enter"), 0, "submit", 0);
66 Gtk.BindingEntry.add_signal (binding_set, Gdk.keyval_from_name ("Escape"), 0, "clear", 0);
67- fg_color = get_style ().text[Gtk.StateType.NORMAL];
68-
69- Gdk.Color.parse ("indianred", out error_color);
70+
71+ // FIXME: How do we tell this StyleContext to get the color from the right place?
72+ Gtk.StyleContext context = new Gtk.StyleContext ();
73+ fg_color = context.get_color (Gtk.StateFlags.NORMAL);
74+
75+ error_color = Gdk.RGBA ();
76+ error_color.parse("indianred");
77
78 get_buffer ().changed.connect (on_text_changed);
79 get_buffer ().insert_text.connect (on_text_inserted);
80@@ -245,8 +249,10 @@
81 private void on_text_changed ()
82 {
83 var chars = get_buffer ().get_char_count ();
84- modify_fg (Gtk.StateType.NORMAL,
85- chars > MAX_MESSAGE_LENGTH ? error_color : fg_color);
86+ override_color (
87+ Gtk.StateFlags.NORMAL,
88+ chars > MAX_MESSAGE_LENGTH ? error_color : fg_color
89+ );
90 }
91
92 private void on_text_inserted (ref Gtk.TextIter iter, string text, int len)
93@@ -300,9 +306,9 @@
94 {
95 context.translate(-1, -1);
96 factor = 1.0;
97- } else if (get_state () == 2) {
98+ } else if (get_state_flags () == Gtk.StateFlags.PRELIGHT) {
99 factor = 0.3;
100- } else if (get_state () == 1) {
101+ } else if (get_state_flags () == Gtk.StateFlags.ACTIVE) {
102 factor = 0.5;
103 }
104
105@@ -354,10 +360,10 @@
106 {
107 Object (spacing:0);
108 }
109-
110+
111 /*
112 * The {@Ag.Account.id} of the account button to be displayed
113- * This is used in the case of replies or private messages
114+ * This is used in the case of replies or private messages
115 * where the post will only go to a single account
116 */
117 public uint? selected {
118@@ -490,7 +496,7 @@
119 return account_button;
120 }
121
122- /*
123+ /*
124 * Set the number of remaining characters allowed to post
125 * @param chars Number of characters remaining
126 */
127
128=== modified file 'src/service.vala'
129--- src/service.vala 2013-01-11 18:53:44 +0000
130+++ src/service.vala 2013-01-12 02:18:21 +0000
131@@ -236,12 +236,7 @@
132 */
133 public bool retweet(uint account_id, string message_id)
134 {
135- try {
136- return do("retweet", account_id.to_string(), message_id);
137- } catch (GLib.Error e) {
138- warning (e.message);
139- }
140- return false;
141+ return do("retweet", account_id.to_string(), message_id);
142 }
143
144 /**
145@@ -257,12 +252,7 @@
146 */
147 public bool home(uint account_id)
148 {
149- try {
150- return do("home", account_id.to_string(), "");
151- } catch (GLib.Error e) {
152- warning (e.message);
153- }
154- return false;
155+ return do("home", account_id.to_string(), "");
156 }
157
158 /**
159@@ -279,12 +269,7 @@
160 */
161 public bool wall(uint account_id)
162 {
163- try {
164- return do("wall", account_id.to_string(), "");
165- } catch (GLib.Error e) {
166- warning (e.message);
167- }
168- return false;
169+ return do("wall", account_id.to_string(), "");
170 }
171
172 /**
173@@ -299,15 +284,10 @@
174 */
175 public bool search(uint? account_id, string query)
176 {
177- try {
178- if (account_id != null)
179- return do("search", account_id.to_string(), query);
180- else
181- return do("search", "", query);
182- } catch (GLib.Error e) {
183- warning (e.message);
184- }
185- return false;
186+ if (account_id != null)
187+ return do("search", account_id.to_string(), query);
188+ else
189+ return do("search", "", query);
190 }
191
192 /**
193@@ -322,12 +302,7 @@
194 */
195 public bool like(uint account_id, string message_id)
196 {
197- try {
198- return do("like", account_id.to_string(), message_id);
199- } catch (GLib.Error e) {
200- warning (e.message);
201- }
202- return false;
203+ return do("like", account_id.to_string(), message_id);
204 }
205
206 /**
207@@ -342,12 +317,7 @@
208 */
209 public bool unlike(uint account_id, string message_id)
210 {
211- try {
212- return do("unlike", account_id.to_string(), message_id);
213- } catch (GLib.Error e) {
214- warning (e.message);
215- }
216- return false;
217+ return do("unlike", account_id.to_string(), message_id);
218 }
219
220 /**
221@@ -362,12 +332,7 @@
222 */
223 public bool delete(uint account_id, string message_id)
224 {
225- try {
226- return do("delete", account_id.to_string(), message_id);
227- } catch (GLib.Error e) {
228- warning (e.message);
229- }
230- return false;
231+ return do("delete", account_id.to_string(), message_id);
232 }
233
234 /**
235@@ -381,12 +346,7 @@
236 */
237 public bool contacts(uint account_id)
238 {
239- try {
240- return do("contacts", account_id.to_string(), "");
241- } catch (GLib.Error e) {
242- warning (e.message);
243- }
244- return false;
245+ return do("contacts", account_id.to_string(), "");
246 }
247
248 /**
249@@ -413,8 +373,8 @@
250 /**
251 * This method returns a list of all the possible actions
252 * supported by a given protocol. This can be used to
253- * determine what actions are available for the requested
254- * protocol.
255+ * determine what actions are available for the requested
256+ * protocol.
257 *
258 * @param protocol One of ``facebook``, ``flickr``,
259 * ``foursquare``, ``identica``, or ``twitter``.
260
261=== modified file 'src/utils.vala'
262--- src/utils.vala 2013-01-09 18:50:08 +0000
263+++ src/utils.vala 2013-01-12 02:18:21 +0000
264@@ -54,7 +54,6 @@
265 {
266 string _avatar_cache_image = Path.build_path (Path.DIR_SEPARATOR_S, Environment.get_user_cache_dir(), "friends/avatars", GLib.Checksum.compute_for_string (GLib.ChecksumType.SHA1, url));
267 debug ("AVATAR PATH: %s", _avatar_cache_image);
268- var file = File.new_for_path (_avatar_cache_image);
269 return _avatar_cache_image;
270 }
271 }
272
273=== modified file 'tests/vala/test-service.vala'
274--- tests/vala/test-service.vala 2013-01-09 19:41:41 +0000
275+++ tests/vala/test-service.vala 2013-01-12 02:18:21 +0000
276@@ -63,50 +63,37 @@
277
278 internal static void test_refresh ()
279 {
280+ // https://bugs.launchpad.net/libfriends/+bug/1098773
281+ // FIXME: Need to capture STDOUT and ensure correct DBus
282+ // call is present.
283 var service = new Friends.Service ();
284 bool success = false;
285- try
286- {
287- service.refresh ();
288- success = true;
289- }
290- catch (GLib.IOError e)
291- {
292- warning ("Failed to refresh - %s", e.message);
293- }
294+ service.refresh ();
295+ success = true;
296 assert (success == true);
297-
298 }
299
300 internal static void test_quit ()
301 {
302+ // https://bugs.launchpad.net/libfriends/+bug/1098773
303+ // FIXME: Need to capture STDOUT and ensure correct DBus
304+ // call is present.
305 var service = new Friends.Service ();
306 bool success = false;
307- try
308- {
309- service.quit ();
310- success = true;
311- }
312- catch (GLib.IOError e)
313- {
314- warning ("Failed to shutdown - %s", e.message);
315- }
316+ service.quit ();
317+ success = true;
318 assert (success == true);
319
320 }
321
322 internal static void test_features ()
323 {
324+ // https://bugs.launchpad.net/libfriends/+bug/1098773
325+ // FIXME: Need to capture STDOUT and ensure correct DBus
326+ // call is present.
327 var service = new Friends.Service ();
328 string[] features;
329- try
330- {
331- features = service.features ("twitter");
332- }
333- catch (GLib.IOError e)
334- {
335- warning ("Failed to get features - %s", e.message);
336- }
337+ features = service.features ("twitter");
338 assert ("send" in features);
339 }
340
341@@ -129,87 +116,67 @@
342
343 internal static void test_send_message ()
344 {
345+ // https://bugs.launchpad.net/libfriends/+bug/1098773
346+ // FIXME: Need to capture STDOUT and ensure correct DBus
347+ // call is present.
348 var service = new Friends.Service ();
349 uint? acct = null;
350 string msg = "A message";
351 bool success = false;
352- try
353- {
354- service.send_message (acct, msg);
355- success = true;
356- }
357- catch (GLib.IOError e)
358- {
359- warning ("Failed to SendMessage - %s", e.message);
360- }
361+ service.send_message (acct, msg);
362+ success = true;
363 assert (success == true);
364 }
365
366 internal static void test_send_message_with_account ()
367 {
368+ // https://bugs.launchpad.net/libfriends/+bug/1098773
369+ // FIXME: Need to capture STDOUT and ensure correct DBus
370+ // call is present.
371 var service = new Friends.Service ();
372 uint acct = 1;
373 string msg = "A message";
374 bool success = false;
375- try
376- {
377- service.send_message (acct, msg);
378- success = true;
379- }
380- catch (GLib.IOError e)
381- {
382- warning ("Failed to SendMessage - %s", e.message);
383- }
384+ service.send_message (acct, msg);
385+ success = true;
386 assert (success == true);
387 }
388
389 internal static void test_send_reply ()
390 {
391+ // https://bugs.launchpad.net/libfriends/+bug/1098773
392+ // FIXME: Need to capture STDOUT and ensure correct DBus
393+ // call is present.
394 var service = new Friends.Service ();
395 uint acct = 1;
396 string msg = "A message";
397 string msg_id = "100";
398 bool success = false;
399- try
400- {
401- service.send_reply (acct, msg_id, msg);
402- success = true;
403- }
404- catch (GLib.IOError e)
405- {
406- warning ("Failed to SendReply - %s", e.message);
407- }
408+ service.send_reply (acct, msg_id, msg);
409+ success = true;
410 assert (success == true);
411 }
412
413 internal static void test_clear_indicators ()
414 {
415+ // https://bugs.launchpad.net/libfriends/+bug/1098773
416+ // FIXME: Need to capture STDOUT and ensure correct DBus
417+ // call is present.
418 var service = new Friends.Service ();
419 bool success = false;
420- try
421- {
422- service.messaging_menu_clear ();
423- success = true;
424- }
425- catch (GLib.IOError e)
426- {
427- warning ("Failed to clear indicators - %s", e.message);
428- }
429+ service.messaging_menu_clear ();
430+ success = true;
431 assert (success == true);
432 }
433
434 internal static void test_url_shorten ()
435 {
436+ // https://bugs.launchpad.net/libfriends/+bug/1098773
437+ // FIXME: Need to capture STDOUT and ensure correct DBus
438+ // call is present.
439 var service = new Friends.Service ();
440 string result = "";
441- try
442- {
443- result = service.shorten ("http://example.com/really/really/long");
444- }
445- catch (GLib.IOError e)
446- {
447- warning ("Failed to shorten URL - %s", e.message);
448- }
449+ result = service.shorten ("http://example.com/really/really/long");
450 assert (result == "http://is.gd/short");
451 }
452 }

Subscribers

People subscribed via source and target branches