Window: replaced ListPane for loading spinner
Added regular style constructor to ListPane
This commit is contained in:
parent
1d65bb4da6
commit
2ba3ae37d4
3 changed files with 71 additions and 16 deletions
|
@ -88,6 +88,10 @@ public class Contacts.ListPane : Frame {
|
|||
filter_entry_changed_id = Timeout.add (300, filter_entry_changed_timeout);
|
||||
}
|
||||
|
||||
public ListPane (Store contacts_store) {
|
||||
Object (store: contacts_store);
|
||||
}
|
||||
|
||||
construct {
|
||||
search_tool_item.set_expand (true);
|
||||
filter_entry.changed.connect (filter_entry_changed);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<object class="GtkGrid" id="content_grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
|
@ -47,14 +47,44 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="ContactsListPane" id="list_pane">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="store">contacts_store</property>
|
||||
<signal name="selection-changed" handler="list_pane_selection_changed_cb" object="ContactsWindow" after="no" swapped="no"/>
|
||||
<signal name="link-contacts" handler="list_pane_link_contacts_cb" object="ContactsWindow" after="no" swapped="no"/>
|
||||
<signal name="delete-contacts" handler="list_pane_delete_contacts_cb" object="ContactsWindow" after="no" swapped="no"/>
|
||||
</object>
|
||||
<object class="GtkBox" id="loading_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="width_request">300</property>
|
||||
<child>
|
||||
<object class="GtkSpinner">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="active">True</property>
|
||||
<style>
|
||||
<class name="contacts-watermark"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="label" translatable="yes">Loading</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
|
@ -282,11 +312,11 @@
|
|||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkSizeGroup">
|
||||
<object class="GtkSizeGroup" id="left_pane_size_group">
|
||||
<property name="mode">horizontal</property>
|
||||
<widgets>
|
||||
<widget name="left_toolbar"/>
|
||||
<widget name="list_pane"/>
|
||||
<widget name="loading_box"/>
|
||||
</widgets>
|
||||
</object>
|
||||
<object class="GtkSizeGroup">
|
||||
|
|
|
@ -22,6 +22,12 @@ using Folks;
|
|||
|
||||
[GtkTemplate (ui = "/org/gnome/contacts/contacts-window.ui")]
|
||||
public class Contacts.Window : Gtk.ApplicationWindow {
|
||||
[GtkChild]
|
||||
private Grid content_grid;
|
||||
[GtkChild]
|
||||
private Box loading_box;
|
||||
[GtkChild]
|
||||
private SizeGroup left_pane_size_group;
|
||||
[GtkChild]
|
||||
private HeaderBar left_toolbar;
|
||||
[GtkChild]
|
||||
|
@ -29,8 +35,6 @@ public class Contacts.Window : Gtk.ApplicationWindow {
|
|||
[GtkChild]
|
||||
private Overlay overlay;
|
||||
[GtkChild]
|
||||
private ListPane list_pane;
|
||||
[GtkChild]
|
||||
private ContactPane contact_pane;
|
||||
[GtkChild]
|
||||
private ToggleButton select_button;
|
||||
|
@ -57,6 +61,7 @@ public class Contacts.Window : Gtk.ApplicationWindow {
|
|||
|
||||
[GtkChild]
|
||||
public Store contacts_store;
|
||||
private ListPane list_pane;
|
||||
|
||||
/* FIXME: remove from public what it is not needed */
|
||||
[GtkChild]
|
||||
|
@ -105,6 +110,11 @@ public class Contacts.Window : Gtk.ApplicationWindow {
|
|||
/* Here we need to wait for Store::quiescent */
|
||||
view_switcher.visible_child_name = "content-view";
|
||||
set_titlebar (content_header_bar);
|
||||
|
||||
Timeout.add (5000, () => {
|
||||
this.set_list_pane ();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
setup_cancel_button.clicked.connect (() => {
|
||||
destroy ();
|
||||
|
@ -114,6 +124,20 @@ public class Contacts.Window : Gtk.ApplicationWindow {
|
|||
init_content_widgets ();
|
||||
}
|
||||
|
||||
public void set_list_pane () {
|
||||
list_pane = new ListPane (store);
|
||||
list_pane.selection_changed.connect (list_pane_selection_changed_cb);
|
||||
list_pane.link_contacts.connect (list_pane_link_contacts_cb);
|
||||
list_pane.delete_contacts.connect (list_pane_delete_contacts_cb);
|
||||
|
||||
left_pane_size_group.add_widget (list_pane);
|
||||
left_pane_size_group.remove_widget (loading_box);
|
||||
loading_box.destroy ();
|
||||
|
||||
content_grid.attach (list_pane, 0, 0, 1, 1);
|
||||
list_pane.show ();
|
||||
}
|
||||
|
||||
public void activate_selection_mode (bool active) {
|
||||
if (active) {
|
||||
add_button.hide ();
|
||||
|
@ -263,12 +287,10 @@ public class Contacts.Window : Gtk.ApplicationWindow {
|
|||
return false;
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
void list_pane_selection_changed_cb (Contact? new_selection) {
|
||||
set_shown_contact (new_selection);
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
void list_pane_link_contacts_cb (LinkedList<Contact> contact_list) {
|
||||
/* getting out of selection mode */
|
||||
set_shown_contact (null);
|
||||
|
@ -306,7 +328,6 @@ public class Contacts.Window : Gtk.ApplicationWindow {
|
|||
});
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
void list_pane_delete_contacts_cb (LinkedList<Contact> contact_list) {
|
||||
/* getting out of selection mode */
|
||||
set_shown_contact (null);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue