Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
conecto
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nimrod
conecto
Commits
e748846f
Commit
e748846f
authored
6 years ago
by
gyan000
Browse files
Options
Downloads
Patches
Plain Diff
Remove useless file from old SMS window. Add proper margin in SMS tab.
parent
6f65fa84
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/EOSConnect/Plugin/Windows/SMSHistory.vala
+1
-20
1 addition, 20 deletions
src/EOSConnect/Plugin/Windows/SMSHistory.vala
src/EOSConnect/Views/SMSMessagesView.vala
+0
-203
0 additions, 203 deletions
src/EOSConnect/Views/SMSMessagesView.vala
with
1 addition
and
223 deletions
src/EOSConnect/Plugin/Windows/SMSHistory.vala
+
1
−
20
View file @
e748846f
...
@@ -39,26 +39,9 @@ namespace EOSConnect.Plugin.Windows {
...
@@ -39,26 +39,9 @@ namespace EOSConnect.Plugin.Windows {
main_settings
:
main_settings
,
main_settings
:
main_settings
,
devices_map
:
devices_map
devices_map
:
devices_map
);
);
// set_size_request (800, 700);
// set_default_size (600, 600);
}
}
construct
{
construct
{
// title = "SMS";
// var new_sms_button = new Gtk.Button.from_icon_name ("mail-message-new");
// new_sms_button.tooltip_text = _("Send a new SMS");
// new_sms_button.valign = Gtk.Align.CENTER;
// var headerbar = new Gtk.HeaderBar ();
// headerbar.get_style_context ().add_class ("default-decoration");
// headerbar.show_close_button = true;
// headerbar.pack_start (new_sms_button);
// headerbar.title = "SMS";
// set_titlebar (headerbar);
// window_position = Gtk.WindowPosition.CENTER;
var
scrolled_window
=
new
Gtk
.
ScrolledWindow
(
null
,
null
);
var
scrolled_window
=
new
Gtk
.
ScrolledWindow
(
null
,
null
);
scrolled_window
.
expand
=
true
;
scrolled_window
.
expand
=
true
;
...
@@ -79,13 +62,13 @@ namespace EOSConnect.Plugin.Windows {
...
@@ -79,13 +62,13 @@ namespace EOSConnect.Plugin.Windows {
paned
.
pack1
(
sidebar_grid
,
true
,
false
);
paned
.
pack1
(
sidebar_grid
,
true
,
false
);
paned
.
pack2
(
stack
,
true
,
false
);
paned
.
pack2
(
stack
,
true
,
false
);
margin
=
12
;
add
(
paned
);
add
(
paned
);
sms_contact_list_box
.
row_selected
.
connect
(
sms_contact_list_box_selected
);
sms_contact_list_box
.
row_selected
.
connect
(
sms_contact_list_box_selected
);
sms_contact_list_box
.
show_all
();
sms_contact_list_box
.
show_all
();
scrolled_window
.
show_all
();
scrolled_window
.
show_all
();
// show_all ();
}
}
public
void
update_list_box_ui
(
SMSContact
sms_contact
)
{
public
void
update_list_box_ui
(
SMSContact
sms_contact
)
{
...
@@ -144,13 +127,11 @@ namespace EOSConnect.Plugin.Windows {
...
@@ -144,13 +127,11 @@ namespace EOSConnect.Plugin.Windows {
public
void
open_sms_tab
(
Device
device
)
{
public
void
open_sms_tab
(
Device
device
)
{
show_all
();
show_all
();
// present ();
}
}
public
void
open_sms_window_reply
()
{
public
void
open_sms_window_reply
()
{
print
(
"\n\nopen_sms_window_reply ()\n\n"
);
print
(
"\n\nopen_sms_window_reply ()\n\n"
);
show_all
();
show_all
();
// present ();
}
}
private
void
add_sms_history_message_view
(
SMSContact
sms_contact
)
{
private
void
add_sms_history_message_view
(
SMSContact
sms_contact
)
{
...
...
This diff is collapsed.
Click to expand it.
src/EOSConnect/Views/SMSMessagesView.vala
deleted
100644 → 0
+
0
−
203
View file @
6f65fa84
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* AUTHORS
* gyan000 <gyan000 (at] ijaz.fr>
*/
using
EOSConnect
;
using
EOSConnect.Plugin
;
using
EOSConnect.Plugin.Widgets
;
using
Gee
;
using
MConnect
;
namespace
EOSConnect.Views
{
public
class
SMSMessagesView
:
Gtk
.
Grid
{
public
MainWindow
main_window
{
get
;
construct
;
}
// public GLib.Settings main_settings { get; construct; }
public
HashMap
<
string
,
Device
>
devices_map
{
get
;
construct
;
}
public
SMSContact
sms_contact
{
get
;
construct
;
}
public
Widgets
.
SMSContactListBox
device_list_box
{
get
;
construct
;
}
private
SMSTextEntry
text_entry
;
private
DateTime
first_message_date_time_utc
;
private
Gtk
.
ScrolledWindow
scrolled_window
;
private
Gtk
.
TextIter
text_iter
;
private
Gtk
.
TextBuffer
text_message_buffer
;
private
Gtk
.
TextView
text_view
;
private
Gtk
.
TextMark
text_mark_auto_scroll
;
private
int
last_message_day
=
0
;
public
MainWindow
main_window
{
get
;
construct
;
}
public
GLib
.
Settings
main_settings
{
get
;
construct
;
}
//
// public MainSettingsView (MainWindow main_window, GLib.Settings main_settings) {
// Object (
// main_settings: main_settings,
// main_window: main_window
// );
// }
public
SMSMessagesView
(
MainWindow
main_window
,
SMSContact
sms_contact
,
Widgets
.
SMSContactListBox
device_list_box
,
HashMap
<
string
,
Device
>
devices_map
)
{
Object
(
main_window
:
main_window
,
sms_contact
:
sms_contact
,
device_list_box
:
device_list_box
,
devices_map
:
devices_map
);
}
construct
{
orientation
=
Gtk
.
Orientation
.
VERTICAL
;
scrolled_window
=
new
Gtk
.
ScrolledWindow
(
null
,
null
);
scrolled_window
.
expand
=
true
;
scrolled_window
.
hscrollbar_policy
=
Gtk
.
PolicyType
.
NEVER
;
Gtk
.
TextTag
text_tag_day
=
new
Gtk
.
TextTag
(
"day"
);
text_tag_day
.
scale
=
Pango
.
Scale
.
SMALL
;
text_tag_day
.
justification
=
Gtk
.
Justification
.
CENTER
;
text_tag_day
.
pixels_below_lines
=
10
;
text_tag_day
.
pixels_above_lines
=
10
;
text_tag_day
.
foreground
=
"black"
;
Gtk
.
TextTag
text_tag_msg
=
new
Gtk
.
TextTag
(
"msg"
);
text_tag_msg
.
foreground
=
"black"
;
text_tag_msg
.
justification
=
Gtk
.
Justification
.
LEFT
;
Gtk
.
TextTag
text_tag_my_msg
=
new
Gtk
.
TextTag
(
"my-msg"
);
text_tag_my_msg
.
foreground
=
"black"
;
text_tag_my_msg
.
left_margin
=
150
;
text_tag_my_msg
.
justification
=
Gtk
.
Justification
.
LEFT
;
Gtk
.
TextTag
text_tag_time_msg
=
new
Gtk
.
TextTag
(
"time-msg"
);
text_tag_time_msg
.
justification
=
Gtk
.
Justification
.
LEFT
;
text_tag_time_msg
.
foreground
=
"red"
;
Gtk
.
TextTag
text_tag_my_time_msg
=
new
Gtk
.
TextTag
(
"my-time-msg"
);
text_tag_my_time_msg
.
left_margin
=
150
;
text_tag_my_time_msg
.
foreground
=
"blue"
;
text_tag_my_time_msg
.
justification
=
Gtk
.
Justification
.
LEFT
;
Gtk
.
TextTagTable
text_tag_table
=
new
Gtk
.
TextTagTable
();
text_tag_table
.
add
(
text_tag_day
);
text_tag_table
.
add
(
text_tag_my_msg
);
text_tag_table
.
add
(
text_tag_msg
);
text_tag_table
.
add
(
text_tag_time_msg
);
text_tag_table
.
add
(
text_tag_my_time_msg
);
text_mark_auto_scroll
=
new
Gtk
.
TextMark
(
"auto-scroll"
);
text_message_buffer
=
new
Gtk
.
TextBuffer
(
text_tag_table
);
text_message_buffer
.
get_iter_at_offset
(
out
text_iter
,
0
);
text_message_buffer
.
add_mark
(
text_mark_auto_scroll
,
text_iter
);
text_view
=
new
Gtk
.
TextView
();
text_view
.
set_wrap_mode
(
Gtk
.
WrapMode
.
WORD
);
text_view
.
editable
=
false
;
text_view
.
cursor_visible
=
false
;
text_view
.
buffer
=
text_message_buffer
;
text_view
.
top_margin
=
5
;
text_view
.
bottom_margin
=
5
;
text_view
.
left_margin
=
5
;
text_view
.
right_margin
=
5
;
int
i
=
0
;
foreach
(
SMS
sms
in
SMSStore
.
instance
().
get_latest_sms_message
(
sms_contact
))
{
if
(
i
++
==
0
)
{
first_message_date_time_utc
=
sms
.
date_time
;
}
add_message_in_textview
(
sms
);
}
scrolled_window
.
add
(
text_view
);
text_entry
=
new
SMSTextEntry
(
devices_map
);
text_entry
.
message_to_send
.
connect
((
message
,
device
)
=>
{
send_message
(
message
,
device
);
});
add
(
scrolled_window
);
add
(
text_entry
);
show_all
();
scrolled_window
.
edge_overshot
.
connect
((
pos
)
=>
{
if
(
pos
==
Gtk
.
PositionType
.
TOP
)
{
foreach
(
SMS
sms
in
SMSStore
.
instance
().
get_previous_sms_message
(
sms_contact
,
first_message_date_time_utc
))
{
first_message_date_time_utc
=
sms
.
date_time
;
text_message_buffer
.
get_iter_at_line
(
out
text_iter
,
0
);
add_message_in_textview
(
sms
,
true
);
}
text_message_buffer
.
get_iter_at_line
(
out
text_iter
,
text_message_buffer
.
get_line_count
());
}
})
;
}
public
void
update_ui_adding_sms
(
SMS
sms
)
{
add_message_in_textview
(
sms
);
}
public
void
update_combo_box_devices
()
{
text_entry
.
update_combo_box_devices
();
}
public
void
add_message_in_textview
(
SMS
sms
,
bool
adding_old_sms
=
false
)
{
if
(
last_message_day
!=
sms
.
date_time
.
get_day_of_week
())
{
string
msg_datetime_format
=
"------------ "
+
sms
.
date_time
.
format
(
"%A %e %B %Y"
)
+
" ------------"
;
text_message_buffer
.
insert_with_tags_by_name
(
ref
text_iter
,
msg_datetime_format
,
msg_datetime_format
.
length
,
"day"
);
text_message_buffer
.
insert
(
ref
text_iter
,
"\n"
,
1
);
last_message_day
=
sms
.
date_time
.
get_day_of_week
();
}
string
time_message
=
sms
.
date_time
.
format
(
"%H:%M - "
);
if
(
sms
.
from
==
SMS
.
FROM_CONTACT
)
{
text_message_buffer
.
insert_with_tags_by_name
(
ref
text_iter
,
time_message
,
time_message
.
length
,
"time-msg"
);
text_message_buffer
.
insert_with_tags_by_name
(
ref
text_iter
,
sms
.
message
,
sms
.
message
.
length
,
"msg"
);
}
else
{
text_message_buffer
.
insert_with_tags_by_name
(
ref
text_iter
,
time_message
,
time_message
.
length
,
"my-time-msg"
);
text_message_buffer
.
insert_with_tags_by_name
(
ref
text_iter
,
sms
.
message
,
sms
.
message
.
length
,
"my-msg"
);
}
text_message_buffer
.
insert
(
ref
text_iter
,
"\n\n"
,
2
);
if
(
adding_old_sms
==
false
)
{
text_view
.
scroll_to_mark
(
text_mark_auto_scroll
,
0
,
true
,
0
,
0
);
}
}
private
void
send_message
(
string
message
,
Device
device
)
{
SMS
sms
=
new
SMS
(
message
,
SMS
.
FROM_ME
,
SMS
.
FROM_TYPE_EOSCONNECT
,
new
DateTime
.
now_utc
());
if
(
device
.
has_capability_handler
(
TelephonyHandler
.
TELEPHONY
)
)
{
((
TelephonyHandler
)
device
.
get_path_capability_handler
(
TelephonyHandler
.
TELEPHONY
))
.
send_sms
(
device
,
sms_contact
.
phone_number
,
message
);
SMSStore
.
instance
().
add_sms
(
device
,
sms
,
sms_contact
);
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment