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
Snippets
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
eta
gajim
Commits
c966ab9e
Commit
c966ab9e
authored
19 years ago
by
nkour
Browse files
Options
Downloads
Patches
Plain Diff
we can now delete a row or more from db. TODO: update UI on the fly
parent
ec03a1d8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/history_manager.glade
+1
-0
1 addition, 0 deletions
src/history_manager.glade
src/history_manager.py
+34
-6
34 additions, 6 deletions
src/history_manager.py
with
35 additions
and
6 deletions
src/history_manager.glade
+
1
−
0
View file @
c966ab9e
...
...
@@ -83,6 +83,7 @@
<property
name=
"fixed_height_mode"
>
False
</property>
<property
name=
"hover_selection"
>
False
</property>
<property
name=
"hover_expand"
>
False
</property>
<signal
name=
"key_press_event"
handler=
"on_logs_listview_key_press_event"
last_modification_time=
"Sat, 04 Feb 2006 15:01:22 GMT"
/>
</widget>
</child>
</widget>
...
...
This diff is collapsed.
Click to expand it.
src/history_manager.py
+
34
−
6
View file @
c966ab9e
...
...
@@ -82,29 +82,30 @@ class HistoryManager:
def
_init_jids_listview
(
self
):
self
.
jids_liststore
=
gtk
.
ListStore
(
str
)
# jid
self
.
jids_listview
.
set_model
(
self
.
jids_liststore
)
renderer_text
=
gtk
.
CellRendererText
()
# holds jid
col
=
gtk
.
TreeViewColumn
(
'
Contacts
'
,
renderer_text
,
text
=
0
)
self
.
jids_listview
.
append_column
(
col
)
def
_init_logs_listview
(
self
):
# log_line_id (HIDDEN), jid_id (HIDDEN), time, message, subject
self
.
logs_liststore
=
gtk
.
ListStore
(
str
,
str
,
str
,
str
,
str
)
self
.
logs_listview
.
set_model
(
self
.
logs_liststore
)
self
.
logs_listview
.
get_selection
().
set_mode
(
gtk
.
SELECTION_MULTIPLE
)
renderer_text
=
gtk
.
CellRendererText
()
# holds time
col
=
gtk
.
TreeViewColumn
(
'
Time
'
,
renderer_text
,
text
=
C_UNIXTIME
)
col
.
set_sort_column_id
(
C_UNIXTIME
)
# user can click this header and sort
col
.
set_resizable
(
True
)
self
.
logs_listview
.
append_column
(
col
)
renderer_text
=
gtk
.
CellRendererText
()
# holds message
col
=
gtk
.
TreeViewColumn
(
'
Message
'
,
renderer_text
,
text
=
C_MESSAGE
)
col
.
set_sort_column_id
(
C_MESSAGE
)
# user can click this header and sort
col
.
set_resizable
(
True
)
self
.
logs_listview
.
append_column
(
col
)
renderer_text
=
gtk
.
CellRendererText
()
# holds subject
col
=
gtk
.
TreeViewColumn
(
'
Subject
'
,
renderer_text
,
text
=
C_SUBJECT
)
col
.
set_sort_column_id
(
C_SUBJECT
)
# user can click this header and sort
...
...
@@ -187,6 +188,33 @@ class HistoryManager:
else
:
self
.
logs_liststore
.
append
((
row
[
0
],
row
[
1
],
time_
,
row
[
4
],
row
[
5
]))
def
on_logs_listview_key_press_event
(
self
,
widget
,
event
):
liststore
,
list_of_paths
=
self
.
logs_listview
.
get_selection
()
\
.
get_selected_rows
()
if
list_of_paths
==
[]:
# nothing is selected
return
if
event
.
keyval
==
gtk
.
keysyms
.
Delete
:
dialog
=
dialogs
.
ConfirmationDialog
(
_
(
'
Do you really want to delete the selected messages?
'
),
_
(
'
This is an irreversible operation.
'
))
if
dialog
.
get_response
()
!=
gtk
.
RESPONSE_OK
:
return
# delete rows from db (using log_line_id)
for
path
in
list_of_paths
:
log_line_id
=
liststore
[
path
][
0
]
self
.
cur
.
execute
(
'''
DELETE FROM logs
WHERE log_line_id = %s
'''
%
(
log_line_id
,))
self
.
con
.
commit
()
def
delete_messages_from_log
(
self
,
selection
):
pass
if
__name__
==
'
__main__
'
:
signal
.
signal
(
signal
.
SIGINT
,
signal
.
SIG_DFL
)
# ^C exits the application
HistoryManager
()
...
...
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