Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Briar GTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
briar
Briar GTK
Commits
a417fad5
Commit
a417fad5
authored
5 years ago
by
Nico
Browse files
Options
Downloads
Patches
Plain Diff
Add ability to chat with other contacts than the first one
Co-Authored-By:
ialokim
<
ialokim@t-online.de
>
parent
0c39cac6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/briar/api/models/private_chat.py
+2
-2
2 additions, 2 deletions
src/briar/api/models/private_chat.py
src/briar/gtk/containers/main.py
+5
-10
5 additions, 10 deletions
src/briar/gtk/containers/main.py
src/briar/gtk/window.py
+2
-4
2 additions, 4 deletions
src/briar/gtk/window.py
with
9 additions
and
16 deletions
src/briar/api/models/private_chat.py
+
2
−
2
View file @
a417fad5
...
@@ -14,7 +14,7 @@ class PrivateChat(Model):
...
@@ -14,7 +14,7 @@ class PrivateChat(Model):
def
get
(
self
,
contact_id
):
def
get
(
self
,
contact_id
):
headers
=
{
'
Authorization
'
:
'
Bearer
'
+
self
.
_api
.
auth_token
}
headers
=
{
'
Authorization
'
:
'
Bearer
'
+
self
.
_api
.
auth_token
}
url
=
urljoin
(
self
.
_constants
.
get_base_url
(),
'
messages/
'
+
contact_id
)
url
=
urljoin
(
self
.
_constants
.
get_base_url
(),
'
messages/
%i
'
%
contact_id
)
r
=
_get
(
url
,
headers
=
headers
)
r
=
_get
(
url
,
headers
=
headers
)
return
r
.
json
()
return
r
.
json
()
...
@@ -25,5 +25,5 @@ class PrivateChat(Model):
...
@@ -25,5 +25,5 @@ class PrivateChat(Model):
def
send
(
self
,
contact_id
,
message
):
def
send
(
self
,
contact_id
,
message
):
headers
=
{
'
Authorization
'
:
'
Bearer
'
+
self
.
_api
.
auth_token
}
headers
=
{
'
Authorization
'
:
'
Bearer
'
+
self
.
_api
.
auth_token
}
url
=
urljoin
(
self
.
_constants
.
get_base_url
(),
'
messages/
'
+
contact_id
)
url
=
urljoin
(
self
.
_constants
.
get_base_url
(),
'
messages/
%s
'
%
contact_id
)
_post
(
url
,
headers
=
headers
,
json
=
{
'
text
'
:
message
})
_post
(
url
,
headers
=
headers
,
json
=
{
'
text
'
:
message
})
This diff is collapsed.
Click to expand it.
src/briar/gtk/containers/main.py
+
5
−
10
View file @
a417fad5
...
@@ -8,7 +8,7 @@ from briar.gtk.define import App
...
@@ -8,7 +8,7 @@ from briar.gtk.define import App
import
gi
import
gi
gi
.
require_version
(
'
Gtk
'
,
'
3.0
'
)
gi
.
require_version
(
'
Gtk
'
,
'
3.0
'
)
from
gi.repository
import
GLib
,
GObject
,
Gtk
from
gi.repository
import
GLib
,
Gtk
class
MainContainer
(
Container
):
class
MainContainer
(
Container
):
...
@@ -16,15 +16,9 @@ class MainContainer(Container):
...
@@ -16,15 +16,9 @@ class MainContainer(Container):
def
__init__
(
self
):
def
__init__
(
self
):
super
().
__init__
()
super
().
__init__
()
self
.
_api
=
App
().
api
self
.
_api
=
App
().
api
self
.
_register_signals
()
self
.
_setup_view
()
self
.
_setup_view
()
self
.
_load_content
()
self
.
_load_content
()
def
_register_signals
(
self
):
GObject
.
signal_new
(
"
briar_open_private_chat
"
,
Gtk
.
Overlay
,
GObject
.
SignalFlags
.
RUN_LAST
,
GObject
.
TYPE_BOOLEAN
,
(
GObject
.
TYPE_STRING
,))
def
_setup_view
(
self
):
def
_setup_view
(
self
):
self
.
builder
.
add_from_resource
(
"
/app/briar/gtk/ui/main.ui
"
)
self
.
builder
.
add_from_resource
(
"
/app/briar/gtk/ui/main.ui
"
)
self
.
add
(
self
.
builder
.
get_object
(
"
contacts_list
"
))
self
.
add
(
self
.
builder
.
get_object
(
"
contacts_list
"
))
...
@@ -36,9 +30,10 @@ class MainContainer(Container):
...
@@ -36,9 +30,10 @@ class MainContainer(Container):
contacts_list_box
=
self
.
builder
.
get_object
(
"
contacts_list
"
)
contacts_list_box
=
self
.
builder
.
get_object
(
"
contacts_list
"
)
for
contact
in
contacts_list
:
for
contact
in
contacts_list
:
contact_label
=
Gtk
.
Button
(
contact
[
"
author
"
][
"
name
"
])
contact_label
=
Gtk
.
Button
(
contact
[
"
author
"
][
"
name
"
])
contact_label
.
connect
(
"
clicked
"
,
self
.
_contact_clicked
)
contact_label
.
connect
(
"
clicked
"
,
self
.
_contact_clicked
,
contact
[
"
contactId
"
])
contact_label
.
show
()
contact_label
.
show
()
contacts_list_box
.
add
(
contact_label
)
contacts_list_box
.
add
(
contact_label
)
def
_contact_clicked
(
self
,
contact
):
def
_contact_clicked
(
self
,
widget
,
contact
Id
):
GLib
.
idle_add
(
self
.
emit
,
"
briar_
open_private_chat
"
,
(
contact
,)
)
GLib
.
idle_add
(
App
().
window
.
open_private_chat
,
contact
Id
)
This diff is collapsed.
Click to expand it.
src/briar/gtk/window.py
+
2
−
4
View file @
a417fad5
...
@@ -55,14 +55,12 @@ class Window(Gtk.ApplicationWindow):
...
@@ -55,14 +55,12 @@ class Window(Gtk.ApplicationWindow):
def
__setup_main_container
(
self
):
def
__setup_main_container
(
self
):
self
.
__container
=
MainContainer
()
self
.
__container
=
MainContainer
()
self
.
__container
.
show
()
self
.
__container
.
show
()
self
.
__container
.
connect
(
"
briar_open_private_chat
"
,
self
.
__open_private_chat
)
self
.
__grid
.
add
(
self
.
__container
)
self
.
__grid
.
add
(
self
.
__container
)
def
__
open_private_chat
(
self
,
inst
,
obj
):
def
open_private_chat
(
self
,
contact_id
):
self
.
__grid
.
destroy
()
self
.
__grid
.
destroy
()
self
.
__setup_grid
()
self
.
__setup_grid
()
self
.
__setup_private_chat
(
"
1
"
)
self
.
__setup_private_chat
(
contact_id
)
def
__setup_private_chat
(
self
,
contact_id
):
def
__setup_private_chat
(
self
,
contact_id
):
self
.
__container
=
ChatContainer
(
contact_id
)
self
.
__container
=
ChatContainer
(
contact_id
)
...
...
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