[gnome-contacts/bugfix/telepathy-build] Fix build when -Dtelepathy=true
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts/bugfix/telepathy-build] Fix build when -Dtelepathy=true
- Date: Sat, 7 Nov 2020 11:02:29 +0000 (UTC)
commit 78149cde5f7e9b579d62c6a3e78b57f1cb1261dc
Author: Niels De Graef <nielsdegraef gmail com>
Date: Sat Nov 7 12:01:59 2020 +0100
Fix build when -Dtelepathy=true
src/contacts-contact-list.vala | 2 +-
src/contacts-contact-sheet.vala | 4 +++-
src/contacts-utils.vala | 4 ++--
src/contacts-window.vala | 25 ++++++++++++++++++-------
4 files changed, 24 insertions(+), 11 deletions(-)
---
diff --git a/src/contacts-contact-list.vala b/src/contacts-contact-list.vala
index aa3cd33c..b3716445 100644
--- a/src/contacts-contact-list.vala
+++ b/src/contacts-contact-list.vala
@@ -243,7 +243,7 @@ public class Contacts.ContactList : ListBox {
selection_changed (individual);
#if HAVE_TELEPATHY
if (individual != null)
- Contact.fetch_contact_info (individual);
+ Utils.fetch_contact_info (individual);
#endif
}
diff --git a/src/contacts-contact-sheet.vala b/src/contacts-contact-sheet.vala
index b6c22496..669e7713 100644
--- a/src/contacts-contact-sheet.vala
+++ b/src/contacts-contact-sheet.vala
@@ -27,6 +27,7 @@ using Gee;
public class Contacts.ContactSheet : Grid {
private int last_row = 0;
private Individual individual;
+ private unowned Store store;
public bool narrow { get; set; default = true; }
private const string[] SORTED_PROPERTIES = {
@@ -43,6 +44,7 @@ public class Contacts.ContactSheet : Grid {
public ContactSheet (Individual individual, Store store) {
Object (row_spacing: 12, column_spacing: 12);
this.individual = individual;
+ this.store = store;
this.individual.notify.connect (update);
this.individual.personas_changed.connect (update);
@@ -242,7 +244,7 @@ public class Contacts.ContactSheet : Grid {
var type = im_persona.presence_type;
if (type != PresenceType.UNSET && type != PresenceType.ERROR &&
type != PresenceType.OFFLINE && type != PresenceType.UNKNOWN) {
- Utils.start_chat (this.contact, protocol, id.value);
+ Utils.start_chat (this.individual, protocol, id.value);
}
}
});
diff --git a/src/contacts-utils.vala b/src/contacts-utils.vala
index 879c4a9f..8f3b8c19 100644
--- a/src/contacts-utils.vala
+++ b/src/contacts-utils.vala
@@ -80,8 +80,8 @@ namespace Contacts.Utils {
}
#if HAVE_TELEPATHY
- public void start_chat (Contact contact, string protocol, string id) {
- var im_persona = contact.find_im_persona (protocol, id);
+ public void start_chat (Individual individual, string protocol, string id) {
+ var im_persona = Utils.find_im_persona (individual, protocol, id);
var account = (im_persona.store as Tpf.PersonaStore).account;
var request_dict = new HashTable<string, Value?>(str_hash, str_equal);
request_dict.insert (TelepathyGLib.PROP_CHANNEL_CHANNEL_TYPE,
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index 759832b5..83709047 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -125,9 +125,17 @@ public class Contacts.Window : Hdy.ApplicationWindow {
this.sort_on_surname_button.active = this.settings.sort_on_surname;
}
+ public override void map () {
+ base.map ();
+ restore_window_size_and_position_from_settings ();
+ }
+
private void restore_window_size_and_position_from_settings () {
- var screen = get_screen();
- if (screen != null && this.window_width <= screen.get_width () && this.window_height <=
screen.get_height ()) {
+ var display = get_window ().get_display ();
+ var monitor = display.get_monitor_at_window (get_window ());
+ var geometry = monitor.geometry;
+
+ if (this.window_width <= geometry.width && this.window_height <= geometry.height) {
set_default_size (this.window_width, this.window_height);
}
if (this.window_maximized) {
@@ -150,20 +158,23 @@ public class Contacts.Window : Hdy.ApplicationWindow {
public override void size_allocate (Gtk.Allocation allocation) {
base.size_allocate (allocation);
- var screen = get_screen ();
- if (screen != null && !this.window_maximized) {
+ var window = get_window ();
+ if (window != null && !this.window_maximized) {
+ var monitor = window.get_display ().get_monitor_at_window (window);
+ var geometry = monitor.geometry;
+
// Get the size via ::get_size instead of the allocation
// so that the window isn't ever-expanding.
int width = 0;
int height = 0;
- get_size(out width, out height);
+ get_size (out width, out height);
// Only store if the values have changed and are
// reasonable-looking.
- if (this.window_width != width && width > 0 && width <= screen.get_width ()) {
+ if (this.window_width != width && width > 0 && width <= geometry.width) {
this.window_width = width;
}
- if (this.window_height != height && height > 0 && height <= screen.get_height ()) {
+ if (this.window_height != height && height > 0 && height <= geometry.height) {
this.window_height = height;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]