ManageSounds GUI Update

This commit is contained in:
Daniel Brötzmann 2018-11-02 17:09:28 +01:00 committed by Philipp Hörist
parent 55eef51887
commit 7cae880920
3 changed files with 18 additions and 39 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<requires lib="gtk+" version="3.20"/>
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name enabled -->
@ -19,16 +19,19 @@
<property name="width_request">400</property>
<property name="height_request">370</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="border_width">18</property>
<property name="title" translatable="yes">Manage sounds</property>
<property name="window_position">center-on-parent</property>
<property name="default_width">400</property>
<property name="default_height">370</property>
<property name="type_hint">dialog</property>
<signal name="delete-event" handler="_on_destroy" swapped="no"/>
<signal name="destroy" handler="_on_destroy" swapped="no"/>
<signal name="key-press-event" handler="_on_key_press" swapped="no"/>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="vbox1">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
@ -106,7 +109,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Clear File</property>
<property name="tooltip_text" translatable="yes">Clear Sound</property>
<signal name="clicked" handler="_on_clear" swapped="no"/>
<child>
<object class="GtkImage">
@ -127,9 +130,10 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Play Sound</property>
<signal name="clicked" handler="_on_play" swapped="no"/>
<child>
<object class="GtkImage" id="image1370">
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">media-playback-start-symbolic</property>
@ -150,35 +154,6 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="close_button">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="_on_destroy" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>

View File

@ -682,7 +682,7 @@ class Preferences(Gtk.ApplicationWindow):
def on_manage_sounds_button_clicked(self, widget):
if self.sounds_preferences is None:
self.sounds_preferences = ManageSounds(self)
self.sounds_preferences = ManageSounds()
else:
self.sounds_preferences.window.present()

View File

@ -14,6 +14,7 @@
import os
from gi.repository import Gdk
from gi.repository import Gtk
from gajim.common import app
@ -24,10 +25,10 @@ from gajim.gtk.util import get_builder
class ManageSounds:
def __init__(self, transient):
def __init__(self):
self._ui = get_builder('manage_sounds_window.ui')
self.window = self._ui.manage_sounds_window
self.window.set_transient_for(transient)
self.window.set_transient_for(app.app.get_active_window())
filter_ = Gtk.FileFilter()
filter_.set_name(_('All files'))
@ -115,8 +116,11 @@ class ManageSounds:
snd_event_config_name = model[iter_][3]
helpers.play_sound(snd_event_config_name)
def _on_key_press(self, widget, event):
if event.keyval == Gdk.KEY_Escape:
self.window.destroy()
def _on_destroy(self, *args):
self.window.destroy()
window = app.get_app_window('Preferences')
if window is not None:
window.sounds_preferences = None