From f2ca4ba985a4ff9948a23d82d276c4f1eef5e11a Mon Sep 17 00:00:00 2001 From: gyan000 <gyan000@ijaz.fr> Date: Fri, 16 Nov 2018 15:15:11 +0100 Subject: [PATCH] Fix: contact list box not display by default Fix: click on "send or view SMS" in quick list now display correctly the SMS tab. --- src/EOSConnect/EOSConnect.vala | 13 ++++--------- .../Plugin/Widgets/SMSContactListBox.vala | 14 +++++++++----- src/EOSConnect/Plugin/Windows/SMSHistory.vala | 11 ++--------- src/EOSConnect/Widgets/DeviceMenuitem.vala | 9 ++++----- src/MConnect/TelephonyHandler.vala | 4 ++-- 5 files changed, 21 insertions(+), 30 deletions(-) diff --git a/src/EOSConnect/EOSConnect.vala b/src/EOSConnect/EOSConnect.vala index c9f0bd9..d19a55b 100644 --- a/src/EOSConnect/EOSConnect.vala +++ b/src/EOSConnect/EOSConnect.vala @@ -117,13 +117,11 @@ namespace EOSConnect { private async void init_sms_history_tab () { - SimpleAction simple_action = new SimpleAction ("telephony-open-sms-window-reply", null); + SimpleAction simple_action = new SimpleAction ("telephony-open-sms-tab", null); simple_action.activate.connect (() => { - // sms_history_view.open_sms_window_reply (); - // sms_history_view.show_all (); main_window.main_stack.set_visible_child_name ("sms_history_view"); - warning ("par ka"); }); + this.add_action (simple_action); SMSStore.instance ().sms_handled.connect ( (sms) => { @@ -140,9 +138,6 @@ namespace EOSConnect { SMSStore.instance ().refresh_contact_list (); - - // sms_history_view.show_all (); - contacts_interface = new EContacts (); contacts_interface.load_contacts (); contacts_interface.contact_loaded.connect ((contact ) => { @@ -174,8 +169,8 @@ namespace EOSConnect { } if (to_add == true) { - launcher_entry.quicklist.child_append (new DeviceMenuitem.with_device ( - device_entry.value, sms_history_view)); + launcher_entry.quicklist.child_append ( + new DeviceMenuitem.with_device (device_entry.value, main_window)); } // var device_menuitem = launcher_entry.quicklist.find_id (device_entry.value.device_num); diff --git a/src/EOSConnect/Plugin/Widgets/SMSContactListBox.vala b/src/EOSConnect/Plugin/Widgets/SMSContactListBox.vala index 16b5ff0..80d735d 100644 --- a/src/EOSConnect/Plugin/Widgets/SMSContactListBox.vala +++ b/src/EOSConnect/Plugin/Widgets/SMSContactListBox.vala @@ -22,17 +22,21 @@ namespace EOSConnect.Plugin.Widgets { public class SMSContactListBox : Gtk.ListBox { - private Gtk.Label _contacts_label; + private Gtk.Label contacts_label; construct { selection_mode = Gtk.SelectionMode.SINGLE; set_header_func (update_headers); - _contacts_label = new Gtk.Label (_("Contacts")); - _contacts_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL); - _contacts_label.halign = Gtk.Align.START; + contacts_label = new Gtk.Label (_("Contacts")); + contacts_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL); + contacts_label.halign = Gtk.Align.START; show_all (); + + // this.row_activated.connect ( (list_box_row) => { + // warning("par la"); + // }); } public void update_selected_list_box_row () { @@ -43,7 +47,7 @@ namespace EOSConnect.Plugin.Widgets { private void update_headers (Gtk.ListBoxRow row, Gtk.ListBoxRow? before = null) { if(before == null) { - row.set_header (_contacts_label); + row.set_header (contacts_label); } } } diff --git a/src/EOSConnect/Plugin/Windows/SMSHistory.vala b/src/EOSConnect/Plugin/Windows/SMSHistory.vala index f63a9d8..cd14eb7 100644 --- a/src/EOSConnect/Plugin/Windows/SMSHistory.vala +++ b/src/EOSConnect/Plugin/Windows/SMSHistory.vala @@ -109,6 +109,8 @@ namespace EOSConnect.Plugin.Windows { sms_contact_list_box.select_row (sms_contact_list_box.get_row_at_index (0)); latest_contact_selected = ((Widgets.SMSContactListBoxRow)sms_contact_list_box.get_row_at_index (0)).sms_contact.phone_number; } + + show_all (); } public void update_message_ui_adding_sms (SMS sms) { @@ -125,15 +127,6 @@ namespace EOSConnect.Plugin.Windows { }); } - public void open_sms_tab (Device device) { - show_all (); - } - - public void open_sms_window_reply () { - print ("\n\nopen_sms_window_reply ()\n\n"); - show_all (); - } - private void add_sms_history_message_view (SMSContact sms_contact) { if (stack.get_child_by_name (sms_contact.phone_number) == null) { diff --git a/src/EOSConnect/Widgets/DeviceMenuitem.vala b/src/EOSConnect/Widgets/DeviceMenuitem.vala index f15172d..a75b21d 100644 --- a/src/EOSConnect/Widgets/DeviceMenuitem.vala +++ b/src/EOSConnect/Widgets/DeviceMenuitem.vala @@ -28,20 +28,20 @@ namespace EOSConnect.Widgets { private const int SUB_MENU_SHARE_ID = 300; private Device device; - private SMSHistory sms_history_window; + private MainWindow main_window; private Dbusmenu.Menuitem sub_menu_item_battery; private Dbusmenu.Menuitem sub_menu_item_telephony; private Dbusmenu.Menuitem sub_menu_item_share; construct { } - public DeviceMenuitem.with_device (Device device, SMSHistory sms_history_window) { + public DeviceMenuitem.with_device (Device device, MainWindow main_window) { Object ( id: device.device_num ); this.device = device; - this.sms_history_window = sms_history_window; + this.main_window = main_window; property_set (Dbusmenu.MENUITEM_PROP_LABEL, device.custom_name); update_sub_menu_battery (); update_sub_menu_telephony (); @@ -81,8 +81,7 @@ namespace EOSConnect.Widgets { if (sub_menu_item_telephony == null) { sub_menu_item_telephony = new Dbusmenu.Menuitem.with_id (id + SUB_MENU_TELEPHONY_ID); sub_menu_item_telephony.item_activated.connect (() => { - - sms_history_window.open_sms_tab (device); + main_window.main_stack.set_visible_child_name ("sms_history_view"); }); child_append (sub_menu_item_telephony); } diff --git a/src/MConnect/TelephonyHandler.vala b/src/MConnect/TelephonyHandler.vala index 75470a6..f073ee0 100644 --- a/src/MConnect/TelephonyHandler.vala +++ b/src/MConnect/TelephonyHandler.vala @@ -108,8 +108,8 @@ namespace MConnect { notification.set_body (notif_body); if (event == "sms") { - // Action defined in EOSConnect._init_sms_history_window () - notification.set_default_action ("app.telephony-open-sms-window-reply"); + // Action defined in EOSConnect._init_sms_history_view () + notification.set_default_action ("app.telephony-open-sms-tab"); } if (set_notification_icon == true) { -- GitLab