Philipp Hörist pushed to branch master at gajim / gajim
Commits:
4cbd71d3 by lovetox at 2020-09-06T21:54:13+02:00
Themes: Store setting after renaming theme
- - - - -
eb1737a4 by lovetox at 2020-09-06T21:55:43+02:00
PopoverSettings: Bind current label to setting
- - - - -
2 changed files:
- gajim/gtk/settings.py
- gajim/gtk/themes.py
Changes:
=====================================
gajim/gtk/settings.py
=====================================
@@ -565,8 +565,18 @@ class PopoverSetting(GenericSetting):
self._current_label.set_text(entries.get(self.setting_value, ''))
+ self._bind_label()
+
self.show_all()
+ def _bind_label(self):
+ if self.type_ not in (SettingType.CONFIG, SettingType.ACCOUNT_CONFIG):
+ return
+
+ app.settings.bind_signal(self.value,
+ self._current_label,
+ 'set_text')
+
def _add_menu_entries(self, entries):
if isinstance(entries, list):
entries = {key: key for key in entries}
=====================================
gajim/gtk/themes.py
=====================================
@@ -239,6 +239,7 @@ class Themes(Gtk.ApplicationWindow):
if result is False:
return
+ app.settings.set('roster_theme', new_name)
self._ui.theme_store.set_value(iter_, Column.THEME, new_name)
def _select_theme_row(self, iter_):
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/3e0bdbf8a4a52dde0ccfdd8192817ba…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/3e0bdbf8a4a52dde0ccfdd8192817ba…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
3e0bdbf8 by lovetox at 2020-09-06T20:28:16+02:00
Add helper method get_group_chat_nick()
- - - - -
2 changed files:
- gajim/common/helpers.py
- gajim/gui_interface.py
Changes:
=====================================
gajim/common/helpers.py
=====================================
@@ -1430,3 +1430,16 @@ def ask_for_status_message(status, signin=False):
return app.settings.get('ask_offline_status')
return app.settings.get('always_ask_for_status_message')
+
+
+def get_group_chat_nick(account, room_jid):
+ nick = app.nicks[account]
+
+ client = app.get_client(account)
+
+ bookmark = client.get_module('Bookmarks').get_bookmark(room_jid)
+ if bookmark is not None:
+ if bookmark.nick is not None:
+ nick = bookmark.nick
+
+ return nick
=====================================
gajim/gui_interface.py
=====================================
@@ -76,6 +76,7 @@ from gajim.common import helpers
from gajim.common import passwords
from gajim.common import logging_helpers
from gajim.common.helpers import ask_for_status_message
+from gajim.common.helpers import get_group_chat_nick
from gajim.common.structs import MUCData
from gajim.common.nec import NetworkEvent
from gajim.common.i18n import _
@@ -1347,15 +1348,12 @@ class Interface:
@staticmethod
def _create_muc_data(account, room_jid, nick, password, config):
if not nick:
- nick = app.nicks[account]
+ nick = get_group_chat_nick(account, room_jid)
# Fetch data from bookmarks
- con = app.connections[account]
- bookmark = con.get_module('Bookmarks').get_bookmark(room_jid)
+ client = app.get_client(account)
+ bookmark = client.get_module('Bookmarks').get_bookmark(room_jid)
if bookmark is not None:
- if bookmark.nick is not None:
- nick = bookmark.nick
-
if bookmark.password is not None:
password = bookmark.password
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/3e0bdbf8a4a52dde0ccfdd8192817ba6…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/3e0bdbf8a4a52dde0ccfdd8192817ba6…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
da425e41 by lovetox at 2020-09-06T18:35:17+02:00
ChatControlBase: Fix infinite recursion
If the input textview is not sensitive it can’t get the focus. In that case propagate_key_event() would send the event again to the conversation textview. This would mean a recursion.
Fixes #10259
- - - - -
1 changed file:
- gajim/chat_control_base.py
Changes:
=====================================
gajim/chat_control_base.py
=====================================
@@ -266,6 +266,12 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper):
if textview.get_buffer().props.has_selection:
return Gdk.EVENT_PROPAGATE
+ if not self.msg_textview.get_sensitive():
+ # If the input textview is not sensitive it can’t get the focus.
+ # In that case propagate_key_event() would send the event again
+ # to the conversation textview. This would mean a recursion.
+ return Gdk.EVENT_PROPAGATE
+
# Focus the Message Input and resend the event
textview.unselect()
self.msg_textview.grab_focus()
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/da425e411bd585ab2b3e1267dba62ff3…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/da425e411bd585ab2b3e1267dba62ff3…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
3befd602 by lovetox at 2020-09-06T16:19:10+02:00
Settings: Allow bind_signal() to be inverted
- - - - -
2 changed files:
- gajim/common/settings.py
- gajim/gtk/settings.py
Changes:
=====================================
gajim/common/settings.py
=====================================
@@ -27,7 +27,6 @@ from pathlib import Path
from collections import namedtuple
from collections import defaultdict
-from gi.module import FunctionInfo
from gi.repository import GLib
from gajim import IS_PORTABLE
@@ -93,19 +92,26 @@ class _Settings:
def disconnect_signals(self, object_):
for _, handlers in self._callbacks.items():
for handler in list(handlers):
- if isinstance(handler, FunctionInfo):
+ if isinstance(handler, tuple):
continue
func = handler()
if func is None or func.__self__ is object_:
handlers.remove(handler)
- def bind_signal(self, setting, widget, func_name, account=None, jid=None):
+ def bind_signal(self,
+ setting,
+ widget,
+ func_name,
+ account=None,
+ jid=None,
+ inverted=False):
+
callbacks = self._callbacks[(setting, account, jid)]
func = getattr(widget, func_name)
- callbacks.append(func)
+ callbacks.append((func, inverted))
def _on_destroy(*args):
- callbacks.remove(func)
+ callbacks.remove((func, inverted))
widget.connect('destroy', _on_destroy)
@@ -114,7 +120,11 @@ class _Settings:
callbacks = self._callbacks[(setting, account, jid)]
for func in list(callbacks):
- if isinstance(func, FunctionInfo):
+ if isinstance(func, tuple):
+ func, inverted = func
+ if inverted:
+ value = not value
+
try:
func(value)
except Exception:
=====================================
gajim/gtk/settings.py
=====================================
@@ -195,16 +195,17 @@ class GenericSetting(Gtk.ListBoxRow):
if self.bind is None:
return
- app.settings.connect_signal(self.bind,
- self._on_setting_changed,
- account=self.account)
-
- value = app.settings.get_account_setting(self.account, self.bind)
- if self.inverted:
- value = not value
- self.set_sensitive(value)
+ app.settings.bind_signal(self.bind,
+ self,
+ 'set_sensitive',
+ account=self.account,
+ inverted=self.inverted)
+
+ if self.account is not None:
+ value = app.settings.get_account_setting(self.account, self.bind)
+ else:
+ value = app.settings.get(self.bind)
- def _on_setting_changed(self, value, *args):
if self.inverted:
value = not value
self.set_sensitive(value)
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/3befd6022a35eabb3e64c21c89b13911…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/3befd6022a35eabb3e64c21c89b13911…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
6ab6bdaf by lovetox at 2020-09-06T12:19:14+02:00
Settings: Add bind_signal()
This allows to bind the value of a specific setting to a widget method
like set_sensitive() or set_visible()
- - - - -
738723c6 by lovetox at 2020-09-06T12:19:14+02:00
Settings: Pass func as string
- - - - -
1 changed file:
- gajim/common/settings.py
Changes:
=====================================
gajim/common/settings.py
=====================================
@@ -27,6 +27,7 @@ from pathlib import Path
from collections import namedtuple
from collections import defaultdict
+from gi.module import FunctionInfo
from gi.repository import GLib
from gajim import IS_PORTABLE
@@ -85,26 +86,51 @@ class _Settings:
# remove the func once it should not be called anymore
raise ValueError('Only bound methods can be connected')
+
func = weakref.WeakMethod(func)
self._callbacks[(setting, account, jid)].append(func)
def disconnect_signals(self, object_):
for _, handlers in self._callbacks.items():
for handler in list(handlers):
+ if isinstance(handler, FunctionInfo):
+ continue
func = handler()
if func is None or func.__self__ is object_:
handlers.remove(handler)
+ def bind_signal(self, setting, widget, func_name, account=None, jid=None):
+ callbacks = self._callbacks[(setting, account, jid)]
+ func = getattr(widget, func_name)
+ callbacks.append(func)
+
+ def _on_destroy(*args):
+ callbacks.remove(func)
+
+ widget.connect('destroy', _on_destroy)
+
def _notify(self, value, setting, account=None, jid=None):
log.info('Signal: %s changed', setting)
callbacks = self._callbacks[(setting, account, jid)]
for func in list(callbacks):
+ if isinstance(func, FunctionInfo):
+ try:
+ func(value)
+ except Exception:
+ log.exception('Error while executing signal callback')
+ continue
+
if func() is None:
callbacks.remove(func)
continue
+
+ func = func()
+ if func is None:
+ continue
+
try:
- func()(value, setting, account, jid)
+ func(value, setting, account, jid)
except Exception:
log.exception('Error while executing signal callback')
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/1b9ccad1636c7f59d5cadd22bb35e99…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/1b9ccad1636c7f59d5cadd22bb35e99…
You're receiving this email because of your account on dev.gajim.org.