Merge lp:~ken-vandine/gwibber/status_bar into lp:gwibber

Proposed by Ken VanDine
Status: Merged
Merged at revision: 1279
Proposed branch: lp:~ken-vandine/gwibber/status_bar
Merge into: lp:gwibber
Diff against target: 166 lines (+127/-0)
3 files modified
client/Makefile.am (+1/-0)
client/gwibber-client.vala (+33/-0)
client/status-bar.vala (+93/-0)
To merge this branch: bzr merge lp:~ken-vandine/gwibber/status_bar
Reviewer Review Type Date Requested Status
David Klasinc (community) Approve
Review via email: mp+93336@code.launchpad.net

Description of the change

Adds new StatusBar widget.

To post a comment you must log in.
Revision history for this message
David Klasinc (bigwhale) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'client/Makefile.am'
--- client/Makefile.am 2011-08-30 17:57:21 +0000
+++ client/Makefile.am 2012-02-16 06:09:17 +0000
@@ -16,6 +16,7 @@
16 public-item.vala \16 public-item.vala \
17 messages-item.vala \17 messages-item.vala \
18 stream-entry.vala \18 stream-entry.vala \
19 status-bar.vala \
19 tab-bar.vala \20 tab-bar.vala \
20 tab-bar-item.vala \21 tab-bar-item.vala \
21 tab-bar-widgets.vala22 tab-bar-widgets.vala
2223
=== modified file 'client/gwibber-client.vala'
--- client/gwibber-client.vala 2012-02-13 22:20:12 +0000
+++ client/gwibber-client.vala 2012-02-16 06:09:17 +0000
@@ -19,12 +19,14 @@
19public class Client : Gtk.Window19public class Client : Gtk.Window
20{20{
21 private Gwibber.Streams streams_service;21 private Gwibber.Streams streams_service;
22 private Gwibber.Service _service;
22 private GLib.Settings state_settings;23 private GLib.Settings state_settings;
23 public Gee.HashMap <string, Dee.Model?> streams_map;24 public Gee.HashMap <string, Dee.Model?> streams_map;
24 public Gee.HashMap <string, TabBarItem?> items_map;25 public Gee.HashMap <string, TabBarItem?> items_map;
25 public TabBar tabbar;26 public TabBar tabbar;
26 public GwibberGtk.StreamView view;27 public GwibberGtk.StreamView view;
27 public Gtk.UIManager manager;28 public Gtk.UIManager manager;
29 private StatusBar _status_bar;
28 private int _sort_order = 1;30 private int _sort_order = 1;
2931
30 public int sort_order {32 public int sort_order {
@@ -87,6 +89,37 @@
87 tabbar = new TabBar ();89 tabbar = new TabBar ();
8890
89 var main_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);91 var main_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
92
93 _status_bar = new StatusBar ();
94 /* We don't need this yet
95 _status_bar.add_button (Gtk.Stock.OK, Gtk.ResponseType.OK);
96 _status_bar.response.connect((r) => {
97 _status_bar.showing = false;
98 });
99 */
100 main_box.pack_end (_status_bar, false, false, 0);
101 _status_bar.notify["showing"].connect (()=>
102 {
103 debug ("StatusBar showing changed");
104 });
105
106 _service = new Gwibber.Service ();
107 _service.loading_started.connect((source) => {
108 debug ("Loading started");
109 if (!_status_bar.showing)
110 {
111 _status_bar.reset ();
112 _status_bar.set_message_type (Gtk.MessageType.OTHER);
113 _status_bar.message = _("Refreshing");
114 _status_bar.showing = true;
115 }
116 });
117 _service.loading_complete.connect((source) => {
118 debug ("Loading completed");
119 if (_status_bar.showing)
120 _status_bar.showing = false;
121 });
122
90 main_box.pack_end (tabbar, true, true, 0);123 main_box.pack_end (tabbar, true, true, 0);
91 add (main_box);124 add (main_box);
92125
93126
=== added file 'client/status-bar.vala'
--- client/status-bar.vala 1970-01-01 00:00:00 +0000
+++ client/status-bar.vala 2012-02-16 06:09:17 +0000
@@ -0,0 +1,93 @@
1/*
2 * Copyright (C) 2011 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by Ken VanDine <ken@vandine.org>
17 */
18
19public class StatusBar : Gtk.InfoBar
20{
21 private string _message;
22 private Gtk.Label _message_label;
23 private Gtk.Container _content_area;
24
25 private Gwibber.Service _service;
26
27 private bool _showing = false;
28
29 public bool showing {
30 get {
31 return _showing;
32 }
33 set {
34 _showing = value;
35 if (_showing)
36 {
37 show ();
38 queue_draw ();
39 }
40 else
41 {
42 hide ();
43 queue_draw ();
44 }
45 }
46 }
47
48 public string message {
49 get {
50 return _message;
51 }
52 set {
53 if (_message != value)
54 {
55 _message = value;
56 _message_label.set_markup ("<b>" + _message + "</b>");
57 }
58 }
59 }
60
61 public StatusBar ()
62 {
63 Object ();
64 }
65
66 construct
67 {
68 _message = "";
69 set_no_show_all (true);
70 set_message_type (Gtk.MessageType.OTHER);
71 _content_area = get_content_area () as Gtk.Container;
72 _message_label = new Gtk.Label (message);
73 _message_label.set_alignment (0.0f, 0.5f);
74 _message_label.set_use_markup (true);
75 _content_area.add (_message_label);
76 _message_label.show ();
77
78 notify["showing"].connect (()=>
79 {
80 });
81 }
82
83 public void reset ()
84 {
85 message = "";
86 var _action_area = get_action_area () as Gtk.Container;
87 foreach (var _w in _action_area.get_children ())
88 {
89 if (_w is Gtk.Widget)
90 _w.destroy ();
91 }
92 }
93}