[gnome-contacts] Window: moved ListPane into ui file
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Window: moved ListPane into ui file
- Date: Thu, 29 May 2014 20:25:40 +0000 (UTC)
commit f0aa4a55e5d3bfd7ff9597dfae34377fa712b4a9
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Sat Apr 26 09:24:09 2014 -0400
Window: moved ListPane into ui file
src/contacts-app.vala | 6 ++----
src/contacts-list-pane.vala | 15 +++++++++++----
src/contacts-window.ui | 23 ++++++++++++++++++++---
src/contacts-window.vala | 16 ++--------------
4 files changed, 35 insertions(+), 25 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index 0912edf..336bb31 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -29,7 +29,7 @@ public class Contacts.App : Gtk.Application {
public Contacts.Window window;
- private ListPane list_pane;
+ private weak ListPane list_pane;
private weak ContactPane contacts_pane;
private bool app_menu_created;
@@ -242,13 +242,11 @@ public class Contacts.App : Gtk.Application {
window.delete_event.connect (window_delete_event);
window.key_press_event.connect_after (window_key_press_event);
- list_pane = new ListPane (contacts_store);
+ list_pane = window.list_pane;
list_pane.selection_changed.connect (selection_changed);
list_pane.link_contacts.connect (link_contacts);
list_pane.delete_contacts.connect (delete_contacts);
- window.add_left_child (list_pane);
-
contacts_pane = window.contacts_pane;
contacts_pane.will_delete.connect (delete_contact);
diff --git a/src/contacts-list-pane.vala b/src/contacts-list-pane.vala
index b9f1069..5c8155b 100644
--- a/src/contacts-list-pane.vala
+++ b/src/contacts-list-pane.vala
@@ -22,7 +22,16 @@ using Folks;
[GtkTemplate (ui = "/org/gnome/contacts/contacts-list-pane.ui")]
public class Contacts.ListPane : Frame {
- private Store contacts_store;
+ private Store _store;
+ public Store store {
+ get {
+ return _store;
+ }
+ set {
+ _store = value;
+ contacts_view.store = _store;
+ }
+ }
[GtkChild]
private View contacts_view;
@@ -84,12 +93,10 @@ public class Contacts.ListPane : Frame {
filter_entry_changed_id = Timeout.add (300, filter_entry_changed_timeout);
}
- public ListPane (Store contacts_store) {
+ construct {
search_tool_item.set_expand (true);
filter_entry.changed.connect (filter_entry_changed);
- contacts_view.store = contacts_store;
-
contacts_view.set_show_subset (View.Subset.ALL);
contacts_view.selection_changed.connect( (l, contact) => {
if (!ignore_selection_change)
diff --git a/src/contacts-window.ui b/src/contacts-window.ui
index cd07b4a..f690ecb 100644
--- a/src/contacts-window.ui
+++ b/src/contacts-window.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.15.2 on Thu Aug 15 15:33:02 2013 -->
<interface>
+ <object class="ContactsStore" id="contacts_store" />
<!-- interface-requires gtk+ 3.10 -->
<template class="ContactsWindow" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
@@ -152,14 +153,24 @@
</packing>
</child>
<child>
- <placeholder/>
+ <object class="ContactsListPane" id="list_pane">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="store">contacts_store</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
</child>
</object>
</child>
</object>
</child>
</template>
- <object class="GtkSizeGroup" id="sizegroup1">
+ <object class="GtkSizeGroup">
<property name="mode">vertical</property>
<widgets>
<widget name="add_button"/>
@@ -167,5 +178,11 @@
<widget name="done_button"/>
</widgets>
</object>
- <object class="ContactsStore" id="contacts_store" />
+ <object class="GtkSizeGroup">
+ <property name="mode">horizontal</property>
+ <widgets>
+ <widget name="left_toolbar"/>
+ <widget name="list_pane"/>
+ </widgets>
+ </object>
</interface>
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index 1e94531..2811a82 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -27,15 +27,13 @@ public class Contacts.Window : Gtk.ApplicationWindow {
private HeaderBar right_toolbar;
[GtkChild]
private Overlay overlay;
- [GtkChild]
- private Grid grid;
- [GtkChild]
- private Overlay right_overlay;
[GtkChild]
public Store contacts_store;
[GtkChild]
+ public ListPane list_pane;
+ [GtkChild]
public ContactPane contacts_pane;
/* FIXME: remove from public what it is not needed */
@@ -99,16 +97,6 @@ public class Contacts.Window : Gtk.ApplicationWindow {
}
}
- public void add_left_child (Widget child) {
- grid.attach (child, 0, 0, 1, 1);
-
- /* horizontal size group, for the splitted headerbar */
- var hsize_group = new SizeGroup (SizeGroupMode.HORIZONTAL);
- hsize_group.add_widget (left_toolbar);
- hsize_group.add_widget (child);
- child.show ();
- }
-
public void add_notification (Widget notification) {
overlay.add_overlay (notification);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]