[Git][gajim/gajim][master] 4 commits: Dont try to select iter if there is none

2017-02-12 Thread Philipp Hörist
Philipp Hörist pushed to branch master at gajim / gajim


Commits:
d24bed12 by Philipp Hörist at 2017-02-12T19:09:48+01:00
Dont try to select iter if there is none

- - - - -
50514393 by Philipp Hörist at 2017-02-12T19:09:48+01:00
Fix key error on removing account

- - - - -
09f54f97 by Philipp Hörist at 2017-02-12T19:09:49+01:00
Use platform identifier with better granularity

Fixes #8542

- - - - -
1b2324ca by Philipp Hörist at 2017-02-12T19:10:55+01:00
Merge branch small-fixes into master

Small fixes

Closes #8542

See merge request !58
- - - - -


3 changed files:

- src/common/helpers.py
- src/config.py
- src/roster_window.py


Changes:

=
src/common/helpers.py
=
--- a/src/common/helpers.py
+++ b/src/common/helpers.py
@@ -746,13 +746,13 @@ def play_sound_file(path_to_soundfile):
 path_to_soundfile = check_soundfile_path(path_to_soundfile)
 if path_to_soundfile is None:
 return
-elif os.name == 'nt' and HAS_WINSOUND:
+elif sys.platform == 'win32' and HAS_WINSOUND:
 try:
 winsound.PlaySound(path_to_soundfile,
 winsound.SND_FILENAME|winsound.SND_ASYNC)
 except Exception:
 log.exception('Sound Playback Error')
-elif os.name == 'posix':
+elif sys.platform == 'linux':
 if gajim.config.get('soundplayer') == '':
 def _oss_play():
 sndfile = wave.open(path_to_soundfile, 'rb')


=
src/config.py
=
--- a/src/config.py
+++ b/src/config.py
@@ -3254,7 +3254,9 @@ class ManageBookmarksWindow:
 self.xml.connect_signals(self)
 self.window.show_all()
 # select root iter
-self.selection.select_iter(self.treestore.get_iter_first())
+first_iter = self.treestore.get_iter_first()
+if first_iter:
+self.selection.select_iter(first_iter)
 
 def on_key_press_event(self, widget, event):
 if event.keyval == Gdk.KEY_Escape:


=
src/roster_window.py
=
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -1558,6 +1558,8 @@ class RosterWindow:
 """
 if not self.tree.get_model():
 return
+if account not in gajim.connections:
+return
 delimiter = gajim.connections[account].nested_group_delimiter
 group_splited = group.split(delimiter)
 i = 1



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/eec1a69efd90620686cbeac52f37decc473ede34...1b2324ca978db4218cf9dd9dfcde9adcc3c476d0
___
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits


[Git][gajim/gajim][master] 3 commits: Remove old gtk2 code

2017-02-12 Thread Philipp Hörist
Philipp Hörist pushed to branch master at gajim / gajim


Commits:
aaef09fc by Philipp Hörist at 2017-02-12T16:45:56+01:00
Remove old gtk2 code

- - - - -
2a599d1e by Philipp Hörist at 2017-02-12T16:45:56+01:00
Fix constants usage in history manager

- - - - -
eec1a69e by Philipp Hörist at 2017-02-12T16:50:28+01:00
Merge branch history-manager into master

History manager fixes

See merge request !57
- - - - -


1 changed file:

- src/history_manager.py


Changes:

=
src/history_manager.py
=
--- a/src/history_manager.py
+++ b/src/history_manager.py
@@ -29,24 +29,6 @@
 ## the same can be said for history_window.py
 
 import os
-
-if os.name == 'nt':
-import warnings
-warnings.filterwarnings(action='ignore')
-
-if os.path.isdir('gtk'):
-# Used to create windows installer with GTK included
-paths = os.environ['PATH']
-list_ = paths.split(';')
-new_list = []
-for p in list_:
-if p.find('gtk') < 0 and p.find('GTK') < 0:
-new_list.append(p)
-new_list.insert(0, 'gtk/lib')
-new_list.insert(0, 'gtk/bin')
-os.environ['PATH'] = ';'.join(new_list)
-os.environ['GTK_BASEPATH'] = 'gtk'
-
 import sys
 import signal
 import gi
@@ -91,11 +73,7 @@ common.configpaths.gajimpaths.init(config_path)
 del config_path
 from common import gajim
 import gtkgui_helpers
-from common.logger import LOG_DB_PATH, constants
-
-#FIXME: constants should implement 2 way mappings
-status = dict((constants.__dict__[i], i[5:].lower()) for i in \
-constants.__dict__.keys() if i.startswith('SHOW_'))
+from common.logger import LOG_DB_PATH, JIDConstant, KindConstant
 from common import helpers
 import dialogs
 
@@ -342,7 +320,7 @@ class HistoryManager:
 possible_room_jid = jid.split('/', 1)[0]
 
 self.cur.execute('SELECT jid_id FROM jids WHERE jid = ? AND type = ?',
-(possible_room_jid, constants.JID_ROOM_TYPE))
+(possible_room_jid, JIDConstant.ROOM_TYPE))
 row = self.cur.fetchone()
 if row is None:
 return False
@@ -357,7 +335,7 @@ class HistoryManager:
 row = self.cur.fetchone()
 if row is None:
 raise
-elif row[0] == constants.JID_ROOM_TYPE:
+elif row[0] == JIDConstant.ROOM_TYPE:
 return True
 else:  # normal type
 return False
@@ -399,15 +377,15 @@ class HistoryManager:
 pass
 else:
 color = None
-if kind in (constants.KIND_SINGLE_MSG_RECV,
-constants.KIND_CHAT_MSG_RECV, constants.KIND_GC_MSG):
+if kind in (KindConstant.SINGLE_MSG_RECV,
+KindConstant.CHAT_MSG_RECV, KindConstant.GC_MSG):
 # it is the other side
 color = gajim.config.get('inmsgcolor')  # so incoming color
-elif kind in (constants.KIND_SINGLE_MSG_SENT,
-constants.KIND_CHAT_MSG_SENT):  # it is us
+elif kind in (KindConstant.SINGLE_MSG_SENT,
+KindConstant.CHAT_MSG_SENT):  # it is us
 color = gajim.config.get('outmsgcolor')  # so outgoing 
color
-elif kind in (constants.KIND_STATUS,
-constants.KIND_GCSTATUS):  # is is statuses
+elif kind in (KindConstant.STATUS,
+KindConstant.GCSTATUS):  # is is statuses
 # so status color
 color = gajim.config.get('statusmsgcolor')
 # include status into (status) message
@@ -540,13 +518,13 @@ class HistoryManager:
 # in store: time, kind, message, contact_name FROM logs
 # in text: JID or You or nickname (if it's gc_msg), time, message
 time_, kind, message, nickname = row
-if kind in (constants.KIND_SINGLE_MSG_RECV,
-constants.KIND_CHAT_MSG_RECV):
+if kind in (KindConstant.SINGLE_MSG_RECV,
+KindConstant.CHAT_MSG_RECV):
 who = self._get_jid_from_jid_id(jid_id)
-elif kind in (constants.KIND_SINGLE_MSG_SENT,
-constants.KIND_CHAT_MSG_SENT):
+elif kind in (KindConstant.SINGLE_MSG_SENT,
+KindConstant.CHAT_MSG_SENT):
 who = _('You')
-elif kind == constants.KIND_GC_MSG:
+elif kind == KindConstant.GC_MSG:
 who = nickname
 else:  # status or gc_status. do not save
 #print kind



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/7814f07bd3fae75d76e29bd1229d6a49b9ea1891...eec1a69efd90620686cbeac52f37decc473ede34
___
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits