Philipp Hörist pushed to branch master at gajim / gajim
Commits:
2a62209e by Matthew W. S. Bell at 2018-10-26T10:57:13Z
Obtain sleep inhibitor again after every sleep
- There is a PrepareForSleep signal before and after every sleep event.
The expectation is that before sleep, gajim cleans up and then releases
the sleep inhibitor. Accordingly, we must reacquire the inhibitor after
sleeping, which can helpfully be done with the other signal.
- Moved module to the dbus folder
- Embed logic in a LogindListener object so we can import the module
without listening to dbus
- - - - -
3 changed files:
- + gajim/common/dbus/logind.py
- gajim/gui_interface.py
- − gajim/logind_listener.py
Changes:
=====================================
gajim/common/dbus/logind.py
=====================================
@@ -0,0 +1,135 @@
+# Copyright (C) 2014 Kamil Paral <kamil.paral AT gmail.com>
+#
+# This file is part of Gajim.
+#
+# Gajim is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published
+# by the Free Software Foundation; version 3 only.
+#
+# Gajim is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
+
+'''
+Watch for system sleep using systemd-logind.
+Documentation: http://www.freedesktop.org/wiki/Software/systemd/inhibit
+'''
+
+import os
+import logging
+
+from gi.repository import Gio
+from gi.repository import GLib
+
+from gajim.common import app
+from gajim.common.i18n import _
+
+log = logging.getLogger('gajim.c.dbus.logind')
+
+
+class LogindListener:
+ _instance = None
+
+ @classmethod
+ def get(cls):
+ if cls._instance is None:
+ cls._instance = cls()
+ return cls._instance
+
+ def __init__(self):
+ # file descriptor object of the inhibitor
+ self._inhibit_fd = None
+
+ Gio.bus_watch_name(
+ Gio.BusType.SYSTEM,
+ 'org.freedesktop.login1',
+ Gio.BusNameWatcherFlags.NONE,
+ self._on_appear_logind,
+ self._on_vanish_logind)
+
+ def _on_prepare_for_sleep(self, connection, _sender_name, _object_path,
+ interface_name, signal_name, parameters,
+ *_user_data):
+ '''Signal handler for PrepareForSleep event'''
+ log.debug('Received signal %s.%s%s', interface_name, signal_name, parameters)
+
+ before = parameters[0] # Signal is either before or after sleep occurs
+ if before:
+ warn = self._inhibit_fd is None
+ log.log(
+ logging.WARNING if warn else logging.INFO,
+ 'Preparing for sleep by disconnecting from network%s',
+ ', without holding a sleep inhibitor' if warn else '')
+
+ for name, conn in app.connections.items():
+ if app.account_is_connected(name):
+ conn.old_show = app.SHOW_LIST[conn.connected]
+ st = conn.status
+ conn.change_status('offline', _('Machine is going to sleep'))
+ conn.status = st
+ conn.time_to_reconnect = 5
+
+ self._disinhibit_sleep()
+ else:
+ self._inhibit_sleep(connection)
+ for conn in app.connections.values():
+ if conn.connected <= 0 and conn.time_to_reconnect:
+ conn.reconnect()
+
+ def _inhibit_sleep(self, connection):
+ '''Obtain a sleep delay inhibitor from logind'''
+ if self._inhibit_fd is not None:
+ # Something is wrong, we have an inhibitor fd, and we are asking for
+ # yet another one.
+ log.warning('Trying to obtain a sleep inhibitor '
+ 'while already holding one.')
+
+ ret, ret_fdlist = connection.call_with_unix_fd_list_sync(
+ 'org.freedesktop.login1',
+ '/org/freedesktop/login1',
+ 'org.freedesktop.login1.Manager',
+ 'Inhibit',
+ GLib.Variant('(ssss)', (
+ 'sleep', 'org.gajim.Gajim', _('Disconnect from the network'),
+ 'delay' # Inhibitor will delay but not block sleep
+ )),
+ GLib.VariantType.new('(h)'),
+ Gio.DBusCallFlags.NONE, -1, None, None)
+
+ log.info('Inhibit sleep')
+ self._inhibit_fd = ret_fdlist.get(ret.unpack()[0])
+
+ def _disinhibit_sleep(self):
+ '''Relinquish our sleep delay inhibitor'''
+ if self._inhibit_fd is not None:
+ os.close(self._inhibit_fd)
+ self._inhibit_fd = None
+ log.info('Disinhibit sleep')
+
+ def _on_appear_logind(self, connection, name, name_owner, *_user_data):
+ '''Use signal and locks provided by org.freedesktop.login1'''
+ log.info('Name %s appeared, owned by %s', name, name_owner)
+
+ connection.signal_subscribe(
+ 'org.freedesktop.login1',
+ 'org.freedesktop.login1.Manager',
+ 'PrepareForSleep',
+ '/org/freedesktop/login1',
+ None,
+ Gio.DBusSignalFlags.NONE,
+ self._on_prepare_for_sleep,
+ None)
+ self._inhibit_sleep(connection)
+
+ def _on_vanish_logind(self, _connection, name, *_user_data):
+ '''Release remaining resources related to org.freedesktop.login1'''
+ log.info('Name %s vanished', name)
+ self._disinhibit_sleep()
+
+
+def enable():
+ LogindListener.get()
=====================================
gajim/gui_interface.py
=====================================
@@ -59,6 +59,7 @@ from gajim.common import events
from gajim.common.dbus import screensaver
from gajim.common.dbus import location
from gajim.common.dbus import music_track
+from gajim.common.dbus import logind
from gajim import gtkgui_helpers
from gajim import gui_menu_builder
@@ -2723,7 +2724,7 @@ class Interface:
# Handle screensaver
if sys.platform == 'linux':
- from gajim import logind_listener # pylint: disable=unused-variable
+ logind.enable()
screensaver.enable()
self.show_vcard_when_connect = []
=====================================
gajim/logind_listener.py deleted
=====================================
@@ -1,116 +0,0 @@
-# Copyright (C) 2014 Kamil Paral <kamil.paral AT gmail.com>
-#
-# This file is part of Gajim.
-#
-# Gajim is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published
-# by the Free Software Foundation; version 3 only.
-#
-# Gajim is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
-
-'''
-Watch for system suspend using systemd-logind.
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/inhibit
-'''
-
-import os
-import logging
-
-from gi.repository import Gio, GLib
-
-from gajim.common import app
-from gajim.common.i18n import _
-
-log = logging.getLogger('gajim.logind_listener')
-
-# file descriptor of the inhibitor; negative number means we don't
-# hold any (yet)
-fd = None
-
-
-def signal_received(connection, sender_name, object_path,
- interface_name, signal_name, parameters, *user_data):
- '''Signal handler for suspend event'''
-
- global fd
-
- log.info('Signal received: %s - %s', interface_name, parameters)
-
- # signal is sent right before (with the parameter True) and after
- # (with the parameter False) the system goes down for suspend/hibernate
- if not parameters[0]:
- return
-
- # we're going for suspend, let's disconnect
- log.debug('System suspend detected, disconnecting from network…')
- for name, conn in app.connections.items():
- if app.account_is_connected(name):
- conn.old_show = app.SHOW_LIST[conn.connected]
- st = conn.status
- conn.change_status('offline', _('Machine is going to sleep'))
- conn.status = st
- conn.time_to_reconnect = 5
-
- # close the file descriptor and let the computer suspend
- if fd is not None:
- os.close(fd)
- fd = None
- else:
- # something is wrong, the system is suspending but we don't have
- # a lock file
- log.warning("System suspend detected, but we don't seem to be holding "
- "a file descriptor for sleep inhibitor")
-
-
-def get_inhibitor(connection):
- '''Ask for a suspend delay inhibitor'''
-
- global fd
-
- if fd is not None:
- # something is wrong, we haven't closed the previous file descriptor
- # and we ask for yet another one
- log.warning('We are about to ask for a sleep inhibitor, but we seem '
- 'to be holding one already')
-
- ret = connection.call_with_unix_fd_list_sync(
- 'org.freedesktop.login1',
- '/org/freedesktop/login1',
- 'org.freedesktop.login1.Manager',
- 'Inhibit',
- GLib.Variant('(ssss)', ('sleep', 'org.gajim.Gajim',
- _('Disconnect from the network'), 'delay')),
- GLib.VariantType.new('(h)'),
- Gio.DBusCallFlags.NONE, -1, None, None)
-
- fd = ret.out_fd_list.get(0)
-
-
-def appeared(connection, name, name_owner, *user_data):
- '''Set up a listener for suspend signals'''
- log.info('%s appeared', name)
- if name == 'org.freedesktop.login1':
- connection.signal_subscribe(
- 'org.freedesktop.login1',
- 'org.freedesktop.login1.Manager',
- 'PrepareForSleep',
- '/org/freedesktop/login1',
- None,
- Gio.DBusSignalFlags.NONE,
- signal_received,
- None)
- get_inhibitor(connection)
-
-
-Gio.bus_watch_name(
- Gio.BusType.SYSTEM,
- 'org.freedesktop.login1',
- Gio.BusNameWatcherFlags.NONE,
- appeared,
- None)
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/2a62209e1e5e0dff020d3cf94e82f811f6…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/2a62209e1e5e0dff020d3cf94e82f811f6…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
54fe4dac by Philipp Hörist at 2018-10-25T23:49:15Z
Fix import
- - - - -
1 changed file:
- gajim/common/dbus/location.py
Changes:
=====================================
gajim/common/dbus/location.py
=====================================
@@ -21,6 +21,8 @@ from gi.repository import GLib
from gajim.common import app
+if app.is_installed('GEOCLUE'):
+ from gi.repository import Geoclue
log = logging.getLogger('gajim.c.dbus.location')
@@ -104,6 +106,5 @@ def enable():
log.warning('GeoClue not installed')
return
- from gi.repository import Geoclue
listener = LocationListener.get()
listener.start()
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/54fe4dacf2b5b51cd402e2ad607f8f9f30…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/54fe4dacf2b5b51cd402e2ad607f8f9f30…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
e5beff26 by Philipp Hörist at 2018-10-25T23:45:43Z
Guard GeoClue import
- So we dont have to check on module import if GeoClue is installed
- - - - -
1 changed file:
- gajim/common/dbus/location.py
Changes:
=====================================
gajim/common/dbus/location.py
=====================================
@@ -14,15 +14,13 @@
# You should have received a copy of the GNU General Public License
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
-from datetime import datetime
import logging
+from datetime import datetime
+
+from gi.repository import GLib
from gajim.common import app
-import gi
-gi.require_version('Geoclue', '2.0')
-from gi.repository import Geoclue
-from gi.repository import GLib
log = logging.getLogger('gajim.c.dbus.location')
@@ -102,5 +100,10 @@ class LocationListener:
def enable():
+ if not app.is_installed('GEOCLUE'):
+ log.warning('GeoClue not installed')
+ return
+
+ from gi.repository import Geoclue
listener = LocationListener.get()
listener.start()
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/e5beff266a2324542a5df3dcb76cb4f865…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/e5beff266a2324542a5df3dcb76cb4f865…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
d98ba45f by Philipp Hörist at 2018-10-25T22:47:36Z
Dont use deprecated const
- - - - -
1 changed file:
- gajim/message_textview.py
Changes:
=====================================
gajim/message_textview.py
=====================================
@@ -38,7 +38,7 @@ class MessageTextView(Gtk.TextView):
chat/groupchat windows
"""
__gsignals__ = {
- 'text-changed': (GObject.SIGNAL_RUN_LAST, None, (Gtk.TextBuffer,))
+ 'text-changed': (GObject.SignalFlags.RUN_LAST, None, (Gtk.TextBuffer,))
}
UNDO_LIMIT = 20
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/d98ba45f973a12c90829c8897a7a49a45e…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/d98ba45f973a12c90829c8897a7a49a45e…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch gajim_1.1 at gajim / gajim
Commits:
9f2a0ae7 by Daniel Brötzmann at 2018-10-25T22:23:13Z
Update feature list in appdata.xml
- - - - -
a7624b56 by Philipp Hörist at 2018-10-25T22:23:13Z
Fix error when plugin cant be loaded
Fixes #9403
- - - - -
3 changed files:
- .gitlab-ci.yml
- data/org.gajim.Gajim.appdata.xml.in
- gajim/plugins/pluginmanager.py
Changes:
=====================================
.gitlab-ci.yml
=====================================
@@ -24,6 +24,11 @@ run-pylint:
- pylint --version
- scripts/dev/pylint-ci.sh --jobs=2 gajim
+run-appdata:
+ stage: test
+ script:
+ - appstream-util validate data/org.gajim.Gajim.appdata.xml.in
+
run-build:
stage: build
script:
=====================================
data/org.gajim.Gajim.appdata.xml.in
=====================================
@@ -7,32 +7,37 @@
<metadata_license>CC-BY-SA-3.0</metadata_license>
<project_license>GPL-3.0</project_license>
<name>Gajim</name>
- <summary>A GTK+ Jabber client</summary>
+ <summary>A GTK+ XMPP client</summary>
<description>
- <p>Gajim is a chat client to be used with Jabber.org, Live Journal Talk,
- Nimbuzz, Ovi, Talkonaut, and thousands of other services
- run by companies and ISPs, and volunteers around the world.
+ <p>Gajim aims to be an easy to use and fully-featured XMPP client.
+ With Gajim you can chat through various XMPP services of your choice
+ (e.g. Jabber.org) as well as transports (e.g. Facebook, IRC).
</p>
- <p>If you have a few accounts on different servers, if you want to be in
- contact with your friends and family all the time, then Gajim is for you.
+ <p>Just chat with your friends or family, easily share pictures and
+ thoughts or discuss the news with your groups.
+ </p>
+ <p>Gajim integrates well with your other devices: just chat and see what's
+ been said on your mobile device.
</p>
<p>Features:</p>
<ul>
- <li>Tabbed chat window and single window modes</li>
- <li>Group chat support (with Multi-User Chat protocol), invitation, chat to group chat transformation</li>
- <li>Emojis, avatars, PEP (user activity, mood and tune)</li>
- <li>Audio / video conferences</li>
- <li>File transfer, room bookmarks</li>
- <li>Metacontacts support</li>
- <li>Trayicon, speller, extended chat history functionalities</li>
- <li>TLS, GPG and End-To-End encryption support</li>
- <li>Transport registration support</li>
- <li>Service discovery including nodes, user search</li>
- <li>Wikipedia, dictionary and search engine lookup</li>
- <li>Multiple accounts support</li>
- <li>XML console interface</li>
- <li>Link local (bonjour / zeroconf), BOSH</li>
- <li>Other features via plugins </li>
+ <li>Never miss a message, keep all your chat clients synchronized</li>
+ <li>Invite friends to group chats or join one</li>
+ <li>Easily send pictures, videos or other files to friends and groups</li>
+ <li>Chat securely with End-to-End encryption via OMEMO or PGP</li>
+ <li>Use your favorite emoticons, set your own profile picture</li>
+ <li>Keep and manage all your chat history</li>
+ <li>Organize your chats with tabs</li>
+ <li>Automatic spell-checking for your messages</li>
+ <li>Connect to other Messengers via Transports (Facebook, IRC, ...)</li>
+ <li>Lookup things on Wikipedia, dictionaries or other search engines directly from the chat window</li>
+ <li>Set your activity, tune, and mood to show your friends how you are feeling</li>
+ <li>Support for multiple accounts</li>
+ <li>Group multiple contacts from one friend to a single Meta-Contact</li>
+ <li>XML console to see what's happening on the protocol layer</li>
+ <li>Serverless messaging (Bonjour/Zeroconf), BOSH</li>
+ <li>Support for service discovery including nodes and search for users</li>
+ <li>Even more features via plugins</li>
</ul>
</description>
<categories>
@@ -43,7 +48,7 @@
</categories>
<screenshots>
<screenshot type="default">
- <image>https://gajim.org/imgs/gajim_roster.png</image>
+ <image>https://gajim.org/imgs/gajim_single_window_mode.png</image>
<caption>Roster, list of contacts</caption>
</screenshot>
<screenshot>
@@ -69,7 +74,7 @@
<url type="homepage">https://gajim.org/</url>
<url type="bugtracker">https://dev.gajim.org/gajim/gajim</url>
<url type="faq">https://dev.gajim.org/gajim/gajim/wikis/help/gajimfaq</url>
- <url type="help">https://dev.gajim.org/gajim/gajim/wikis/help/home</url>
+ <url type="help">https://dev.gajim.org/gajim/gajim/wikis/help/Help</url>
<url type="donation">https://gajim.org/dev.php#donate</url>
<url type="translate">https://dev.gajim.org/gajim/gajim/wikis/development/DevTranslate</url>
<translation type="gettext">gajim</translation>
=====================================
gajim/plugins/pluginmanager.py
=====================================
@@ -163,6 +163,8 @@ class PluginManager(metaclass=Singleton):
if activate:
pc = self.scan_dir_for_plugins(dst_dir, scan_dirs=True,
package=True)
+ if not pc:
+ continue
self.add_plugin(pc[0])
plugin = self.plugins[-1]
self.activate_plugin(plugin)
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/4a812dce670022cdda0fdcaa9796d5a90…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/4a812dce670022cdda0fdcaa9796d5a90…
You're receiving this email because of your account on dev.gajim.org.