Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gajim-plugins
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
59
Issues
59
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gajim
gajim-plugins
Commits
adb10905
Commit
adb10905
authored
May 10, 2018
by
Philipp Hörist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[triggers] Port to new FileChooser api
parent
d0b81cae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
3 deletions
+37
-3
triggers/triggers.py
triggers/triggers.py
+37
-3
No files found.
triggers/triggers.py
View file @
adb10905
...
...
@@ -19,10 +19,11 @@
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
from
gi.repository
import
Gtk
import
sys
import
os
from
gi.repository
import
Gtk
from
gajim.common
import
app
from
gajim.common
import
ged
from
gajim.common
import
helpers
...
...
@@ -30,7 +31,20 @@ from gajim.plugins import GajimPlugin
from
gajim.plugins.helpers
import
log_calls
from
gajim.plugins.gui
import
GajimPluginConfigDialog
from
gajim.dialogs
import
SoundChooserDialog
try
:
from
gajim.filechoosers
import
NativeFileChooserDialog
,
Filter
NEW_FILECHOOSER
=
True
class
SoundChooserDialog
(
NativeFileChooserDialog
):
_title
=
_
(
'Choose Sound'
)
_filters
=
[
Filter
(
_
(
'All files'
),
'*'
,
False
),
Filter
(
_
(
'WAV files'
),
'*.wav'
,
True
)]
except
ImportError
:
from
gajim.dialogs
import
SoundChooserDialog
NEW_FILECHOOSER
=
False
class
Triggers
(
GajimPlugin
):
...
...
@@ -705,6 +719,26 @@ class TriggersPluginConfigDialog(GajimPluginConfigDialog):
self
.
sound_file_hbox
.
set_sensitive
(
False
)
def
on_browse_for_sounds_button_clicked
(
self
,
widget
,
data
=
None
):
if
NEW_FILECHOOSER
:
self
.
_new_filechooser
()
else
:
self
.
_old_filechooser
(
widget
,
data
)
def
_new_filechooser
(
self
):
if
self
.
active_num
<
0
:
return
def
on_ok
(
path_to_snd_file
):
self
.
config
[
self
.
active_num
][
'sound_file'
]
=
path_to_snd_file
self
.
sound_entry
.
set_text
(
path_to_snd_file
)
path_to_snd_file
=
self
.
sound_entry
.
get_text
()
path_to_snd_file
=
os
.
path
.
join
(
os
.
getcwd
(),
path_to_snd_file
)
SoundChooserDialog
(
on_ok
,
path
=
path_to_snd_file
,
transient_for
=
self
)
def
_old_filechooser
(
self
,
widget
,
data
=
None
):
if
self
.
active_num
<
0
:
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment