[gnome-contacts] Contacts.View: moved into ui file
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Contacts.View: moved into ui file
- Date: Thu, 29 May 2014 20:25:35 +0000 (UTC)
commit 9351fc8841a64db299c4e768418c0015c0e868f6
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Sat Apr 26 02:12:35 2014 -0400
Contacts.View: moved into ui file
Contacts.store instant of View promoted to property. Removed classic
constructor code.
src/contacts-list-pane.ui | 6 ++++++
src/contacts-list-pane.vala | 10 +++-------
src/contacts-view.vala | 32 ++++++++++++++++++++------------
3 files changed, 29 insertions(+), 19 deletions(-)
---
diff --git a/src/contacts-list-pane.ui b/src/contacts-list-pane.ui
index 00575c2..5fac1cf 100644
--- a/src/contacts-list-pane.ui
+++ b/src/contacts-list-pane.ui
@@ -51,6 +51,12 @@
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="no_show_all">True</property>
+ <child>
+ <object class="ContactsView" id="contacts_view">
+ <property name="visible">True</property>
+ <property name="selection_mode">browse</property>
+ </object>
+ </child>
</object>
<packing>
<property name="left_attach">0</property>
diff --git a/src/contacts-list-pane.vala b/src/contacts-list-pane.vala
index 041dbca..b9f1069 100644
--- a/src/contacts-list-pane.vala
+++ b/src/contacts-list-pane.vala
@@ -23,6 +23,8 @@ using Folks;
[GtkTemplate (ui = "/org/gnome/contacts/contacts-list-pane.ui")]
public class Contacts.ListPane : Frame {
private Store contacts_store;
+
+ [GtkChild]
private View contacts_view;
[GtkChild]
@@ -38,9 +40,6 @@ public class Contacts.ListPane : Frame {
public Button delete_button;
[GtkChild]
- public ScrolledWindow scrolled;
-
- [GtkChild]
public ActionBar actions_bar;
private uint filter_entry_changed_id;
@@ -89,16 +88,13 @@ public class Contacts.ListPane : Frame {
search_tool_item.set_expand (true);
filter_entry.changed.connect (filter_entry_changed);
- this.contacts_store = contacts_store;
- this.contacts_view = new View (contacts_store);
+ contacts_view.store = contacts_store;
contacts_view.set_show_subset (View.Subset.ALL);
contacts_view.selection_changed.connect( (l, contact) => {
if (!ignore_selection_change)
selection_changed (contact);
});
- scrolled.add (contacts_view);
- contacts_view.show_all ();
/* contact mark handling */
contacts_view.contacts_marked.connect ((nr_contacts_marked) => {
diff --git a/src/contacts-view.vala b/src/contacts-view.vala
index 6522bb2..c52008c 100644
--- a/src/contacts-view.vala
+++ b/src/contacts-view.vala
@@ -77,7 +77,6 @@ public class Contacts.View : ListBox {
public signal void selection_changed (Contact? contact);
public signal void contacts_marked (int contacts_marked);
- Store contacts_store;
Subset show_subset;
HashMap<Contact,ContactDataRow> contacts;
HashSet<Contact> hidden_contacts;
@@ -87,13 +86,28 @@ public class Contacts.View : ListBox {
TextDisplay text_display;
bool selectors_visible;
- public View (Store store, TextDisplay text_display = TextDisplay.PRESENCE) {
- set_selection_mode (SelectionMode.BROWSE);
- contacts_store = store;
+ private Store _store;
+
+ public Store store {
+ get {
+ return _store;
+ }
+ set {
+ _store = value;
+
+ _store.added.connect (contact_added_cb);
+ _store.removed.connect (contact_removed_cb);
+ _store.changed.connect (contact_changed_cb);
+ foreach (var c in _store.get_contacts ())
+ contact_added_cb (_store, c);
+ }
+ }
+
+ construct {
hidden_contacts = new HashSet<Contact>();
nr_contacts_marked = 0;
show_subset = Subset.ALL;
- this.text_display = text_display;
+ text_display = TextDisplay.PRESENCE;
contacts = new HashMap<Contact,ContactDataRow> ();
@@ -107,13 +121,7 @@ public class Contacts.View : ListBox {
selectors_visible = false;
- contacts_store.added.connect (contact_added_cb);
- contacts_store.removed.connect (contact_removed_cb);
- contacts_store.changed.connect (contact_changed_cb);
- foreach (var c in store.get_contacts ())
- contact_added_cb (store, c);
-
- /* background color */
+ /* FIXME: remove hardcoded background color */
var color = Gdk.RGBA ();
color.parse ("#ebedeb");
override_background_color (0, color);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]