[gnome-contacts] Contacts.ListPane: clean up some code.
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Contacts.ListPane: clean up some code.
- Date: Sun, 24 Dec 2017 11:38:28 +0000 (UTC)
commit 7d94874890d73f2df04aaf9f0fd813609fd31691
Author: Niels De Graef <nielsdegraef gmail com>
Date: Sun Dec 24 12:37:54 2017 +0100
Contacts.ListPane: clean up some code.
data/ui/contacts-list-pane.ui | 5 +++++
src/contacts-list-pane.vala | 27 +++++++++++++--------------
2 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/data/ui/contacts-list-pane.ui b/data/ui/contacts-list-pane.ui
index 3abcd13..34fca1f 100644
--- a/data/ui/contacts-list-pane.ui
+++ b/data/ui/contacts-list-pane.ui
@@ -35,6 +35,9 @@
</object>
</child>
</object>
+ <packing>
+ <property name="expand">True</property>
+ </packing>
</child>
</object>
<packing>
@@ -71,6 +74,7 @@
<property name="label" translatable="yes" comments="Link refers to the verb, from linking
contacts together">Link</property>
<property name="width_request">70</property>
<property name="sensitive">False</property>
+ <signal name="clicked" handler="on_link_button_clicked"/>
</object>
<packing>
<property name="pack_type">start</property>
@@ -84,6 +88,7 @@
<property name="label" translatable="yes">Remove</property>
<property name="width_request">70</property>
<property name="sensitive">False</property>
+ <signal name="clicked" handler="on_delete_button_clicked"/>
<style>
<class name="destructive-action"/>
</style>
diff --git a/src/contacts-list-pane.vala b/src/contacts-list-pane.vala
index 18f95f8..ec77f0b 100644
--- a/src/contacts-list-pane.vala
+++ b/src/contacts-list-pane.vala
@@ -98,20 +98,6 @@ public class Contacts.ListPane : Frame {
this.link_button.sensitive = (nr_contacts_marked > 1);
contacts_marked (nr_contacts_marked);
});
-
- // Take care of the other widgets
- this.search_tool_item.set_expand (true);
-
- this.link_button.clicked.connect (() => {
- link_contacts (this.contacts_view.get_marked_contacts ());
- });
-
- this.delete_button.clicked.connect (() => {
- var marked_contacts = contacts_view.get_marked_contacts ();
- foreach (var c in marked_contacts)
- c.hide ();
- delete_contacts (marked_contacts);
- });
}
public void select_contact (Contact? contact, bool ignore_change = false) {
@@ -131,6 +117,19 @@ public class Contacts.ListPane : Frame {
actions_bar.hide ();
}
+ [GtkCallback]
+ private void on_link_button_clicked (Gtk.Button link_button) {
+ link_contacts (this.contacts_view.get_marked_contacts ());
+ }
+
+ [GtkCallback]
+ private void on_delete_button_clicked (Gtk.Button delete_button) {
+ var marked_contacts = contacts_view.get_marked_contacts ();
+ foreach (var c in marked_contacts)
+ c.hide ();
+ delete_contacts (marked_contacts);
+ }
+
/* Limiting width hack */
public override void get_preferred_width (out int minimum_width, out int natural_width) {
minimum_width = natural_width = 300;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]