Merge local changes.

This commit is contained in:
Stephan Erb 2009-12-05 11:28:13 +01:00
commit acf06b4470
10 changed files with 825 additions and 495 deletions

View File

@ -37,7 +37,7 @@ Gajim is a GTK+ app that loves GNOME. You can do 'make' so you don't require gno
<li>gnome-python-desktop (for GnomeKeyring support)</li> <li>gnome-python-desktop (for GnomeKeyring support)</li>
<li>notification-daemon or notify-python (and D-Bus) to get cooler popups</li> <li>notification-daemon or notify-python (and D-Bus) to get cooler popups</li>
<li>D-Bus running to have gajim-remote working. Some distributions split dbus-x11, which is needed for dbus to work with Gajim. Version >= 0.80 is required.</li> <li>D-Bus running to have gajim-remote working. Some distributions split dbus-x11, which is needed for dbus to work with Gajim. Version >= 0.80 is required.</li>
<li>python-dbus bindings (>=0.80)</li> <li>python-dbus bindings (>=0.81)</li>
<li>python-sexy to have clickable URLs in chat windows</li> <li>python-sexy to have clickable URLs in chat windows</li>
<li>python-kerberos to use GSSAPI authentification. Note: version1.1 or higher is required</li> <li>python-kerberos to use GSSAPI authentification. Note: version1.1 or higher is required</li>
</ul> </ul>

File diff suppressed because it is too large Load Diff

View File

@ -1375,6 +1375,21 @@ class ChatControl(ChatControlBase):
self.on_avatar_eventbox_button_press_event) self.on_avatar_eventbox_button_press_event)
self.handlers[id_] = widget self.handlers[id_] = widget
for key in ('1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '0', '#'):
widget = self.xml.get_widget(key + '_button')
id_ = widget.connect('pressed', self.on_num_button_pressed, key)
self.handlers[id_] = widget
id_ = widget.connect('released', self.on_num_button_released)
self.handlers[id_] = widget
widget = self.xml.get_widget('mic_hscale')
id_ = widget.connect('value_changed', self.on_mic_hscale_value_changed)
self.handlers[id_] = widget
widget = self.xml.get_widget('sound_hscale')
id_ = widget.connect('value_changed', self.on_sound_hscale_value_changed)
self.handlers[id_] = widget
if not session: if not session:
# Don't use previous session if we want to a specific resource # Don't use previous session if we want to a specific resource
# and it's not the same # and it's not the same
@ -1505,27 +1520,35 @@ class ChatControl(ChatControlBase):
if jingle_type not in ('audio', 'video'): if jingle_type not in ('audio', 'video'):
return return
banner_image = getattr(self, '_' + jingle_type + '_banner_image') banner_image = getattr(self, '_' + jingle_type + '_banner_image')
if getattr(self, jingle_type + '_state') in ( state = getattr(self, jingle_type + '_state')
self.JINGLE_STATE_NOT_AVAILABLE, self.JINGLE_STATE_AVAILABLE): if state in (self.JINGLE_STATE_NOT_AVAILABLE,
self.JINGLE_STATE_AVAILABLE):
banner_image.hide() banner_image.hide()
else: else:
banner_image.show() banner_image.show()
if self.audio_state == self.JINGLE_STATE_CONNECTING: if state == self.JINGLE_STATE_CONNECTING:
banner_image.set_from_stock( banner_image.set_from_stock(
gtk.STOCK_CONVERT, 1) gtk.STOCK_CONVERT, 1)
elif self.audio_state == self.JINGLE_STATE_CONNECTION_RECEIVED: elif state == self.JINGLE_STATE_CONNECTION_RECEIVED:
banner_image.set_from_stock( banner_image.set_from_stock(
gtk.STOCK_NETWORK, 1) gtk.STOCK_NETWORK, 1)
elif self.audio_state == self.JINGLE_STATE_CONNECTED: elif state == self.JINGLE_STATE_CONNECTED:
banner_image.set_from_stock( banner_image.set_from_stock(
gtk.STOCK_CONNECT, 1) gtk.STOCK_CONNECT, 1)
elif self.audio_state == self.JINGLE_STATE_ERROR: elif state == self.JINGLE_STATE_ERROR:
banner_image.set_from_stock( banner_image.set_from_stock(
gtk.STOCK_DIALOG_WARNING, 1) gtk.STOCK_DIALOG_WARNING, 1)
self.update_toolbar() self.update_toolbar()
def update_audio(self): def update_audio(self):
self._update_jingle('audio') self._update_jingle('audio')
vbox = self.xml.get_widget('audio_vbox')
if self.audio_state == self.JINGLE_STATE_CONNECTED:
vbox.set_no_show_all(False)
vbox.show_all()
else:
vbox.set_no_show_all(True)
vbox.hide()
def update_video(self): def update_video(self):
self._update_jingle('video') self._update_jingle('video')
@ -1589,6 +1612,24 @@ class ChatControl(ChatControlBase):
def set_video_state(self, state, sid=None, reason=None): def set_video_state(self, state, sid=None, reason=None):
self._set_jingle_state('video', state, sid=sid, reason=reason) self._set_jingle_state('video', state, sid=sid, reason=reason)
def _get_audio_content(self):
session = gajim.connections[self.account].get_jingle_session(
self.contact.get_full_jid(), self.audio_sid)
return session.get_content('audio')
def on_num_button_pressed(self, widget, num):
self._get_audio_content()._start_dtmf(num)
def on_num_button_released(self, released):
self._get_audio_content()._stop_dtmf()
def on_mic_hscale_value_changed(self, widget):
value = widget.get_value()
self._get_audio_content().set_mic_volume(value / 100)
def on_sound_hscale_value_changed(self, widget):
pass
def on_avatar_eventbox_enter_notify_event(self, widget, event): def on_avatar_eventbox_enter_notify_event(self, widget, event):
""" """
Enter the eventbox area so we under conditions add a timeout to show a Enter the eventbox area so we under conditions add a timeout to show a
@ -1790,7 +1831,7 @@ class ChatControl(ChatControlBase):
banner_name_label.set_tooltip_text(label_tooltip) banner_name_label.set_tooltip_text(label_tooltip)
def on_jingle_button_toggled(self, widget, jingle_type): def on_jingle_button_toggled(self, widget, jingle_type):
img_name = '%s_%s' % ({'audio': 'mic', 'video': 'cam'}[jingle_type], img_name = 'gajim-%s_%s' % ({'audio': 'mic', 'video': 'cam'}[jingle_type],
{True: 'active', False: 'inactive'}[widget.get_active()]) {True: 'active', False: 'inactive'}[widget.get_active()])
path_to_img = gtkgui_helpers.get_icon_path(img_name) path_to_img = gtkgui_helpers.get_icon_path(img_name)

View File

@ -578,8 +578,6 @@ class CommonConnection:
self.dispatch('STANZA_SENT', unicode(data)) self.dispatch('STANZA_SENT', unicode(data))
def change_status(self, show, msg, auto=False): def change_status(self, show, msg, auto=False):
if not show in ['offline', 'online', 'chat', 'away', 'xa', 'dnd']:
return -1
if not msg: if not msg:
msg = '' msg = ''
sign_msg = False sign_msg = False
@ -598,8 +596,9 @@ class CommonConnection:
self.USE_GPG = True self.USE_GPG = True
self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent'))
self.connect_and_init(show, msg, sign_msg) self.connect_and_init(show, msg, sign_msg)
return
elif show == 'offline': if show == 'offline':
self.connected = 0 self.connected = 0
if self.connection: if self.connection:
p = common.xmpp.Presence(typ = 'unavailable') p = common.xmpp.Presence(typ = 'unavailable')
@ -612,14 +611,17 @@ class CommonConnection:
self.connection.start_disconnect() self.connection.start_disconnect()
else: else:
self._on_disconnected() self._on_disconnected()
return
elif show != 'offline' and self.connected > 0: if show != 'offline' and self.connected > 0:
# dont'try to connect, when we are in state 'connecting' # dont'try to connect, when we are in state 'connecting'
if self.connected == 1: if self.connected == 1:
return return
if show == 'invisible': if show == 'invisible':
self._change_to_invisible(msg) self._change_to_invisible(msg)
return return
if show not in ['offline', 'online', 'chat', 'away', 'xa', 'dnd']:
return -1
was_invisible = self.connected == gajim.SHOW_LIST.index('invisible') was_invisible = self.connected == gajim.SHOW_LIST.index('invisible')
self.connected = gajim.SHOW_LIST.index(show) self.connected = gajim.SHOW_LIST.index(show)
if was_invisible: if was_invisible:

View File

@ -2714,6 +2714,8 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream,
if show == 'invisible': if show == 'invisible':
self.send_invisible_presence(msg, signed, True) self.send_invisible_presence(msg, signed, True)
return return
if show not in ['offline', 'online', 'chat', 'away', 'xa', 'dnd']:
return
priority = gajim.get_priority(self.name, sshow) priority = gajim.get_priority(self.name, sshow)
our_jid = helpers.parse_jid(gajim.get_jid_from_account(self.name)) our_jid = helpers.parse_jid(gajim.get_jid_from_account(self.name))
vcard = self.get_cached_vcard(our_jid) vcard = self.get_cached_vcard(our_jid)

View File

@ -23,7 +23,7 @@ def get_jingle_content(node):
return contents[namespace](node) return contents[namespace](node)
class FailedApplication(Exception): class JingleContentSetupException(Exception):
""" """
Exception that should be raised when a content fails to setup. Exception that should be raised when a content fails to setup.
""" """

View File

@ -24,7 +24,7 @@ from glib import GError
import gajim import gajim
from jingle_transport import JingleTransportICEUDP from jingle_transport import JingleTransportICEUDP
from jingle_content import contents, JingleContent, FailedApplication from jingle_content import contents, JingleContent, JingleContentSetupException
class JingleRTPContent(JingleContent): class JingleRTPContent(JingleContent):
@ -89,16 +89,17 @@ class JingleRTPContent(JingleContent):
and self.p2psession.get_property('codecs-ready')) and self.p2psession.get_property('codecs-ready'))
def make_bin_from_config(self, config_key, pipeline, text): def make_bin_from_config(self, config_key, pipeline, text):
pipeline = pipeline % gajim.config.get(config_key)
try: try:
bin = gst.parse_bin_from_description(pipeline bin = gst.parse_bin_from_description(pipeline, True)
% gajim.config.get(config_key), True)
return bin return bin
except GError, error_str: except GError, error_str:
self.session.connection.dispatch('ERROR', self.session.connection.dispatch('ERROR',
(_("%s configuration error") % text.capitalize(), (_("%s configuration error") % text.capitalize(),
_("Couldn't setup %s. Check your configuration.\n\nError was:\n%s") _("Couldn't setup %s. Check your configuration.\n\n"
% (text, error_str))) "Pipeline was:\n%s\n\n"
raise FailedApplication "Error was:\n%s") % (text, pipeline, error_str)))
raise JingleContentSetupException
def add_remote_candidates(self, candidates): def add_remote_candidates(self, candidates):
JingleContent.add_remote_candidates(self, candidates) JingleContent.add_remote_candidates(self, candidates)
@ -257,6 +258,12 @@ class JingleAudio(JingleRTPContent):
JingleRTPContent.__init__(self, session, 'audio', transport) JingleRTPContent.__init__(self, session, 'audio', transport)
self.setup_stream() self.setup_stream()
def set_mic_volume(self, vol):
"""
vol must be between 0 ans 1
"""
self.mic_volume.set_property('volume', vol)
def setup_stream(self): def setup_stream(self):
JingleRTPContent.setup_stream(self) JingleRTPContent.setup_stream(self)
@ -281,7 +288,7 @@ class JingleAudio(JingleRTPContent):
'audioconvert ! %s', _("audio output")) 'audioconvert ! %s', _("audio output"))
self.mic_volume = src_bin.get_by_name('gajim_vol') self.mic_volume = src_bin.get_by_name('gajim_vol')
self.mic_volume.set_property('volume', 1) self.set_mic_volume(0)
# link gst elements # link gst elements
self.pipeline.add(self.sink, src_bin) self.pipeline.add(self.sink, src_bin)
@ -315,7 +322,7 @@ class JingleVideo(JingleRTPContent):
#src_bin.link(caps) #src_bin.link(caps)
self.sink = self.make_bin_from_config('video_output_device', self.sink = self.make_bin_from_config('video_output_device',
'%s ! videoscale ! ffmpegcolorspace', _("video output")) 'videoscale ! ffmpegcolorspace ! %s', _("video output"))
self.pipeline.add(self.sink) self.pipeline.add(self.sink)
src_bin.get_pad('src').link(self.p2psession.get_property('sink-pad')) src_bin.get_pad('src').link(self.p2psession.get_property('sink-pad'))
@ -333,4 +340,4 @@ def get_content(desc):
contents[xmpp.NS_JINGLE_RTP] = get_content contents[xmpp.NS_JINGLE_RTP] = get_content
# vim: se ts=3: # vim: se ts=3:

View File

@ -29,7 +29,7 @@ Handles Jingle sessions (XEP 0166)
import gajim #Get rid of that? import gajim #Get rid of that?
import xmpp import xmpp
from jingle_transport import get_jingle_transport from jingle_transport import get_jingle_transport
from jingle_content import get_jingle_content, FailedApplication from jingle_content import get_jingle_content, JingleContentSetupException
# FIXME: Move it to JingleSession.States? # FIXME: Move it to JingleSession.States?
class JingleStates(object): class JingleStates(object):
@ -492,7 +492,7 @@ class JingleSession(object):
else: else:
reasons.add('unsupported-transports') reasons.add('unsupported-transports')
contents_rejected.append((element['name'], 'peer')) contents_rejected.append((element['name'], 'peer'))
except FailedApplication: except JingleContentSetupException:
reasons.add('failed-application') reasons.add('failed-application')
else: else:
contents_rejected.append((element['name'], 'peer')) contents_rejected.append((element['name'], 'peer'))

View File

@ -176,12 +176,12 @@ else:
elif sysname in ('FreeBSD', 'OpenBSD', 'NetBSD'): elif sysname in ('FreeBSD', 'OpenBSD', 'NetBSD'):
libc.setproctitle('gajim') libc.setproctitle('gajim')
if gtk.pygtk_version < (2, 12, 0): if gtk.pygtk_version < (2, 16, 0):
pritext = _('Gajim needs PyGTK 2.12 or above') pritext = _('Gajim needs PyGTK 2.16 or above')
sectext = _('Gajim needs PyGTK 2.12 or above to run. Quiting...') sectext = _('Gajim needs PyGTK 2.16 or above to run. Quiting...')
elif gtk.gtk_version < (2, 12, 0): elif gtk.gtk_version < (2, 16, 0):
pritext = _('Gajim needs GTK 2.12 or above') pritext = _('Gajim needs GTK 2.16 or above')
sectext = _('Gajim needs GTK 2.12 or above to run. Quiting...') sectext = _('Gajim needs GTK 2.16 or above to run. Quiting...')
try: try:
import gtk.glade # check if user has libglade (in pygtk and in gtk) import gtk.glade # check if user has libglade (in pygtk and in gtk)

View File

@ -36,31 +36,11 @@ import pango
import os import os
import sys import sys
import vcard
import dialogs
import logging import logging
log = logging.getLogger('gajim.gtkgui_helpers') log = logging.getLogger('gajim.gtkgui_helpers')
HAS_PYWIN32 = True
if os.name == 'nt':
try:
import win32file
import win32con
import pywintypes
except ImportError:
HAS_PYWIN32 = False
from common import i18n from common import i18n
from common import gajim from common import gajim
from common import helpers
gtk.glade.bindtextdomain(i18n.APP, i18n.DIR)
gtk.glade.textdomain(i18n.APP)
screen_w = gtk.gdk.screen_width()
screen_h = gtk.gdk.screen_height()
gtk_icon_theme = gtk.icon_theme_get_default() gtk_icon_theme = gtk.icon_theme_get_default()
gtk_icon_theme.append_search_path(gajim.ICONS_DIR) gtk_icon_theme.append_search_path(gajim.ICONS_DIR)
@ -82,6 +62,27 @@ def get_icon_path(icon_name, size=16):
except gobject.GError, e: except gobject.GError, e:
log.error("Unable to find icon %s: %s" % (icon_name, str(e))) log.error("Unable to find icon %s: %s" % (icon_name, str(e)))
import vcard
import dialogs
HAS_PYWIN32 = True
if os.name == 'nt':
try:
import win32file
import win32con
import pywintypes
except ImportError:
HAS_PYWIN32 = False
from common import helpers
gtk.glade.bindtextdomain(i18n.APP, i18n.DIR)
gtk.glade.textdomain(i18n.APP)
screen_w = gtk.gdk.screen_width()
screen_h = gtk.gdk.screen_height()
def add_image_to_menuitem(menuitem, icon_name): def add_image_to_menuitem(menuitem, icon_name):
img = gtk.Image() img = gtk.Image()
path_img = get_icon_path(icon_name) path_img = get_icon_path(icon_name)