Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor 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
mesonium
gajim
Commits
100ae021
Commit
100ae021
authored
3 years ago
by
Philipp Hörist
Browse files
Options
Downloads
Patches
Plain Diff
Refactor ChatList
parent
fc365a29
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
gajim/gtk/chat_list_stack.py
+6
-15
6 additions, 15 deletions
gajim/gtk/chat_list_stack.py
gajim/gtk/chat_page.py
+21
-1
21 additions, 1 deletion
gajim/gtk/chat_page.py
gajim/gtk/main.py
+1
-2
1 addition, 2 deletions
gajim/gtk/main.py
with
28 additions
and
18 deletions
gajim/gtk/chat_list_stack.py
+
6
−
15
View file @
100ae021
...
@@ -44,16 +44,17 @@ class ChatListStack(Gtk.Stack):
...
@@ -44,16 +44,17 @@ class ChatListStack(Gtk.Stack):
'
chat-unselected
'
:
(
GObject
.
SignalFlags
.
RUN_LAST
,
'
chat-unselected
'
:
(
GObject
.
SignalFlags
.
RUN_LAST
,
None
,
None
,
()),
()),
'
chat-removed
'
:
(
GObject
.
SignalFlags
.
RUN_LAST
,
None
,
(
str
,
str
,
str
)),
}
}
def
__init__
(
self
,
main_window
,
ui
,
chat_stack
):
def
__init__
(
self
,
main_window
,
search_entry
):
Gtk
.
Stack
.
__init__
(
self
)
Gtk
.
Stack
.
__init__
(
self
)
self
.
set_hexpand
(
True
)
self
.
set_hexpand
(
True
)
self
.
set_vexpand
(
True
)
self
.
set_vexpand
(
True
)
self
.
set_vhomogeneous
(
False
)
self
.
set_vhomogeneous
(
False
)
self
.
_ui
=
ui
self
.
_chat_stack
=
chat_stack
self
.
_chat_lists
=
{}
self
.
_chat_lists
=
{}
self
.
_last_visible_child_name
=
'
default
'
self
.
_last_visible_child_name
=
'
default
'
...
@@ -61,9 +62,7 @@ def __init__(self, main_window, ui, chat_stack):
...
@@ -61,9 +62,7 @@ def __init__(self, main_window, ui, chat_stack):
self
.
add_named
(
Gtk
.
Box
(),
'
default
'
)
self
.
add_named
(
Gtk
.
Box
(),
'
default
'
)
self
.
connect
(
'
notify::visible-child-name
'
,
self
.
_on_visible_child_name
)
self
.
connect
(
'
notify::visible-child-name
'
,
self
.
_on_visible_child_name
)
self
.
_ui
.
search_entry
.
connect
(
search_entry
.
connect
(
'
search-changed
'
,
self
.
_on_search_changed
)
'
search-changed
'
,
self
.
_on_search_changed
)
main_window
.
connect
(
'
notify::is-active
'
,
self
.
_on_window_active
)
main_window
.
connect
(
'
notify::is-active
'
,
self
.
_on_window_active
)
self
.
_add_actions
()
self
.
_add_actions
()
...
@@ -94,7 +93,6 @@ def _on_visible_child_name(self, _stack, _param):
...
@@ -94,7 +93,6 @@ def _on_visible_child_name(self, _stack, _param):
if
self
.
_last_visible_child_name
==
self
.
get_visible_child_name
():
if
self
.
_last_visible_child_name
==
self
.
get_visible_child_name
():
return
return
self
.
_ui
.
search_entry
.
set_text
(
''
)
if
self
.
_last_visible_child_name
!=
'
default
'
:
if
self
.
_last_visible_child_name
!=
'
default
'
:
child
=
self
.
get_child_by_name
(
self
.
_last_visible_child_name
)
child
=
self
.
get_child_by_name
(
self
.
_last_visible_child_name
)
child
.
set_filter_text
(
''
)
child
.
set_filter_text
(
''
)
...
@@ -157,8 +155,6 @@ def show_chat_list(self, workspace_id):
...
@@ -157,8 +155,6 @@ def show_chat_list(self, workspace_id):
if
current_workspace_id
!=
'
default
'
:
if
current_workspace_id
!=
'
default
'
:
self
.
_chat_lists
[
current_workspace_id
].
unselect_all
()
self
.
_chat_lists
[
current_workspace_id
].
unselect_all
()
self
.
_ui
.
workspace_label
.
set_text
(
app
.
settings
.
get_workspace_setting
(
workspace_id
,
'
name
'
))
self
.
set_visible_child_name
(
workspace_id
)
self
.
set_visible_child_name
(
workspace_id
)
def
add_chat
(
self
,
workspace_id
,
account
,
jid
,
type_
,
pinned
=
False
):
def
add_chat
(
self
,
workspace_id
,
account
,
jid
,
type_
,
pinned
=
False
):
...
@@ -204,12 +200,7 @@ def remove_chat(self, workspace_id, account, jid):
...
@@ -204,12 +200,7 @@ def remove_chat(self, workspace_id, account, jid):
type_
=
chat_list
.
get_chat_type
(
account
,
jid
)
type_
=
chat_list
.
get_chat_type
(
account
,
jid
)
chat_list
.
remove_chat
(
account
,
jid
)
chat_list
.
remove_chat
(
account
,
jid
)
self
.
store_open_chats
(
workspace_id
)
self
.
store_open_chats
(
workspace_id
)
self
.
emit
(
'
chat-removed
'
,
account
,
jid
,
type_
)
if
not
self
.
contains_chat
(
account
,
jid
):
self
.
_chat_stack
.
remove_chat
(
account
,
jid
)
if
type_
==
'
groupchat
'
:
client
=
app
.
get_client
(
account
)
client
.
get_module
(
'
MUC
'
).
leave
(
jid
)
def
_find_chat
(
self
,
account
,
jid
):
def
_find_chat
(
self
,
account
,
jid
):
for
chat_list
in
self
.
_chat_lists
.
values
():
for
chat_list
in
self
.
_chat_lists
.
values
():
...
...
This diff is collapsed.
Click to expand it.
gajim/gtk/chat_page.py
+
21
−
1
View file @
100ae021
...
@@ -59,10 +59,13 @@ def __init__(self):
...
@@ -59,10 +59,13 @@ def __init__(self):
self
.
_search_revealer
.
add
(
self
.
_search_view
)
self
.
_search_revealer
.
add
(
self
.
_search_view
)
self
.
_ui
.
right_grid_overlay
.
add_overlay
(
self
.
_search_revealer
)
self
.
_ui
.
right_grid_overlay
.
add_overlay
(
self
.
_search_revealer
)
self
.
_chat_list_stack
=
ChatListStack
(
self
,
self
.
_ui
,
self
.
_chat_stack
)
self
.
_chat_list_stack
=
ChatListStack
(
app
.
window
,
self
.
_ui
.
search_entry
)
self
.
_chat_list_stack
.
connect
(
'
chat-selected
'
,
self
.
_on_chat_selected
)
self
.
_chat_list_stack
.
connect
(
'
chat-selected
'
,
self
.
_on_chat_selected
)
self
.
_chat_list_stack
.
connect
(
'
chat-unselected
'
,
self
.
_chat_list_stack
.
connect
(
'
chat-unselected
'
,
self
.
_on_chat_unselected
)
self
.
_on_chat_unselected
)
self
.
_chat_list_stack
.
connect
(
'
chat-removed
'
,
self
.
_on_chat_removed
)
self
.
_chat_list_stack
.
connect
(
'
notify::visible-child-name
'
,
self
.
_on_chat_list_changed
)
self
.
_ui
.
chat_list_scrolled
.
add
(
self
.
_chat_list_stack
)
self
.
_ui
.
chat_list_scrolled
.
add
(
self
.
_chat_list_stack
)
self
.
_ui
.
start_chat_button
.
connect
(
'
clicked
'
,
self
.
_ui
.
start_chat_button
.
connect
(
'
clicked
'
,
...
@@ -120,6 +123,10 @@ def _on_button_release(paned, event):
...
@@ -120,6 +123,10 @@ def _on_button_release(paned, event):
def
_on_chat_selected
(
self
,
_chat_list_stack
,
workspace_id
,
account
,
jid
):
def
_on_chat_selected
(
self
,
_chat_list_stack
,
workspace_id
,
account
,
jid
):
self
.
_chat_stack
.
show_chat
(
account
,
jid
)
self
.
_chat_stack
.
show_chat
(
account
,
jid
)
self
.
_search_view
.
set_context
(
account
,
jid
)
self
.
_search_view
.
set_context
(
account
,
jid
)
self
.
_ui
.
workspace_label
.
set_text
(
app
.
settings
.
get_workspace_setting
(
workspace_id
,
'
name
'
))
self
.
emit
(
'
chat-selected
'
,
workspace_id
,
account
,
jid
)
self
.
emit
(
'
chat-selected
'
,
workspace_id
,
account
,
jid
)
def
_on_chat_unselected
(
self
,
_chat_list_stack
):
def
_on_chat_unselected
(
self
,
_chat_list_stack
):
...
@@ -136,6 +143,9 @@ def _on_search_history(self, _action, _param):
...
@@ -136,6 +143,9 @@ def _on_search_history(self, _action, _param):
def
_on_search_hide
(
self
,
*
args
):
def
_on_search_hide
(
self
,
*
args
):
self
.
_search_revealer
.
hide
()
self
.
_search_revealer
.
hide
()
def
_on_chat_list_changed
(
self
,
*
args
):
self
.
_ui
.
search_entry
.
set_text
(
''
)
def
process_event
(
self
,
event
):
def
process_event
(
self
,
event
):
self
.
_chat_stack
.
process_event
(
event
)
self
.
_chat_stack
.
process_event
(
event
)
self
.
_chat_list_stack
.
process_event
(
event
)
self
.
_chat_list_stack
.
process_event
(
event
)
...
@@ -219,6 +229,12 @@ def remove_chat(self, account, jid):
...
@@ -219,6 +229,12 @@ def remove_chat(self, account, jid):
self
.
_chat_list_stack
.
remove_chat
(
workspace_id
,
account
,
jid
)
self
.
_chat_list_stack
.
remove_chat
(
workspace_id
,
account
,
jid
)
return
return
def
_on_chat_removed
(
self
,
_chat_list
,
account
,
jid
,
type_
):
self
.
_chat_stack
.
remove_chat
(
account
,
jid
)
if
type_
==
'
groupchat
'
:
client
=
app
.
get_client
(
account
)
client
.
get_module
(
'
MUC
'
).
leave
(
jid
)
def
get_control
(
self
,
account
,
jid
):
def
get_control
(
self
,
account
,
jid
):
return
self
.
_chat_stack
.
get_control
(
account
,
jid
)
return
self
.
_chat_stack
.
get_control
(
account
,
jid
)
...
@@ -230,3 +246,7 @@ def get_active_control(self):
...
@@ -230,3 +246,7 @@ def get_active_control(self):
def
get_controls
(
self
,
account
=
None
):
def
get_controls
(
self
,
account
=
None
):
return
self
.
_chat_stack
.
get_controls
(
account
)
return
self
.
_chat_stack
.
get_controls
(
account
)
def
hide_search
(
self
):
if
self
.
_search_revealer
.
get_reveal_child
():
self
.
_search_revealer
.
hide
()
This diff is collapsed.
Click to expand it.
gajim/gtk/main.py
+
1
−
2
View file @
100ae021
...
@@ -173,8 +173,7 @@ def _on_action(self, action, _param):
...
@@ -173,8 +173,7 @@ def _on_action(self, action, _param):
return
res
return
res
if
action
==
'
escape
'
:
if
action
==
'
escape
'
:
if
self
.
_search_revealer
.
get_reveal_child
():
self
.
_chat_page
.
hide_search
()
self
.
_search_revealer
.
hide
()
# if action == 'escape' and app.settings.get('escape_key_closes'):
# if action == 'escape' and app.settings.get('escape_key_closes'):
# self.remove_tab(control, self.CLOSE_ESC)
# self.remove_tab(control, self.CLOSE_ESC)
...
...
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