[Gotham48] add nice icons to toggle audio / video
This commit is contained in:
parent
17b60033ab
commit
d70b74e6b6
Binary file not shown.
After Width: | Height: | Size: 988 B |
Binary file not shown.
After Width: | Height: | Size: 963 B |
Binary file not shown.
After Width: | Height: | Size: 788 B |
Binary file not shown.
After Width: | Height: | Size: 773 B |
|
@ -1213,10 +1213,22 @@ class ChatControl(ChatControlBase):
|
||||||
self._audio_button = self.xml.get_widget('audio_togglebutton')
|
self._audio_button = self.xml.get_widget('audio_togglebutton')
|
||||||
id_ = self._audio_button.connect('toggled', self.on_audio_button_toggled)
|
id_ = self._audio_button.connect('toggled', self.on_audio_button_toggled)
|
||||||
self.handlers[id_] = self._audio_button
|
self.handlers[id_] = self._audio_button
|
||||||
|
# add a special img
|
||||||
|
path_to_img = os.path.join(gajim.DATA_DIR, 'pixmaps',
|
||||||
|
'mic_inactive.png')
|
||||||
|
img = gtk.Image()
|
||||||
|
img.set_from_file(path_to_img)
|
||||||
|
self._audio_button.set_image(img)
|
||||||
|
|
||||||
self._video_button = self.xml.get_widget('video_togglebutton')
|
self._video_button = self.xml.get_widget('video_togglebutton')
|
||||||
id_ = self._video_button.connect('toggled', self.on_video_button_toggled)
|
id_ = self._video_button.connect('toggled', self.on_video_button_toggled)
|
||||||
self.handlers[id_] = self._video_button
|
self.handlers[id_] = self._video_button
|
||||||
|
# add a special img
|
||||||
|
path_to_img = os.path.join(gajim.DATA_DIR, 'pixmaps',
|
||||||
|
'cam_inactive.png')
|
||||||
|
img = gtk.Image()
|
||||||
|
img.set_from_file(path_to_img)
|
||||||
|
self._video_button.set_image(img)
|
||||||
|
|
||||||
self._send_file_button = self.xml.get_widget('send_file_button')
|
self._send_file_button = self.xml.get_widget('send_file_button')
|
||||||
# add a special img for send file button
|
# add a special img for send file button
|
||||||
|
@ -1818,31 +1830,43 @@ class ChatControl(ChatControlBase):
|
||||||
|
|
||||||
def on_audio_button_toggled(self, widget):
|
def on_audio_button_toggled(self, widget):
|
||||||
if widget.get_active():
|
if widget.get_active():
|
||||||
|
path_to_img = os.path.join(gajim.DATA_DIR, 'pixmaps',
|
||||||
|
'mic_active.png')
|
||||||
if self.audio_state == self.JINGLE_STATE_AVAILABLE:
|
if self.audio_state == self.JINGLE_STATE_AVAILABLE:
|
||||||
sid = gajim.connections[self.account].startVoIP(
|
sid = gajim.connections[self.account].startVoIP(
|
||||||
self.contact.get_full_jid())
|
self.contact.get_full_jid())
|
||||||
self.set_audio_state('connecting', sid)
|
self.set_audio_state('connecting', sid)
|
||||||
else:
|
else:
|
||||||
|
path_to_img = os.path.join(gajim.DATA_DIR, 'pixmaps',
|
||||||
|
'mic_inactive.png')
|
||||||
session = gajim.connections[self.account].get_jingle_session(
|
session = gajim.connections[self.account].get_jingle_session(
|
||||||
self.contact.get_full_jid(), self.audio_sid)
|
self.contact.get_full_jid(), self.audio_sid)
|
||||||
if session:
|
if session:
|
||||||
content = session.get_content('audio')
|
content = session.get_content('audio')
|
||||||
if content:
|
if content:
|
||||||
session.remove_content(content.creator, content.name)
|
session.remove_content(content.creator, content.name)
|
||||||
|
img = self._audio_button.get_property('image')
|
||||||
|
img.set_from_file(path_to_img)
|
||||||
|
|
||||||
def on_video_button_toggled(self, widget):
|
def on_video_button_toggled(self, widget):
|
||||||
if widget.get_active():
|
if widget.get_active():
|
||||||
|
path_to_img = os.path.join(gajim.DATA_DIR, 'pixmaps',
|
||||||
|
'cam_active.png')
|
||||||
if self.video_state == self.JINGLE_STATE_AVAILABLE:
|
if self.video_state == self.JINGLE_STATE_AVAILABLE:
|
||||||
sid = gajim.connections[self.account].startVideoIP(
|
sid = gajim.connections[self.account].startVideoIP(
|
||||||
self.contact.get_full_jid())
|
self.contact.get_full_jid())
|
||||||
self.set_video_state('connecting', sid)
|
self.set_video_state('connecting', sid)
|
||||||
else:
|
else:
|
||||||
|
path_to_img = os.path.join(gajim.DATA_DIR, 'pixmaps',
|
||||||
|
'cam_inactive.png')
|
||||||
session = gajim.connections[self.account].get_jingle_session(
|
session = gajim.connections[self.account].get_jingle_session(
|
||||||
self.contact.get_full_jid(), self.video_sid)
|
self.contact.get_full_jid(), self.video_sid)
|
||||||
if session:
|
if session:
|
||||||
content = session.get_content('video')
|
content = session.get_content('video')
|
||||||
if content:
|
if content:
|
||||||
session.remove_content(content.creator, content.name)
|
session.remove_content(content.creator, content.name)
|
||||||
|
img = self._video_button.get_property('image')
|
||||||
|
img.set_from_file(path_to_img)
|
||||||
|
|
||||||
def _toggle_gpg(self):
|
def _toggle_gpg(self):
|
||||||
if not self.gpg_is_active and not self.contact.keyID:
|
if not self.gpg_is_active and not self.contact.keyID:
|
||||||
|
|
Loading…
Reference in New Issue