Philipp Hörist pushed to branch master at gajim / gajim
Commits:
125fe1e0 by Daniel Brötzmann at 2019-06-20T12:56:12Z
Make some strings translatable
Sync threshold options in the preferences window did not translate correctly,
Add Account was not translatable in accounts window,
Context menu Delete item was not translatable in history manager
- - - - -
5 changed files:
- gajim/data/gui/history_manager.ui
- gajim/gtk/accounts.py
- gajim/gtk/features.py
- gajim/gtk/preferences.py
- gajim/history_manager.py
Changes:
=====================================
gajim/data/gui/history_manager.ui
=====================================
@@ -17,7 +17,7 @@
<object class="GtkMenuItem" id="delete_menuitem">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label">_Delete</property>
+ <property name="label" translatable="yes">_Delete</property>
<property name="use_underline">True</property>
</object>
</child>
=====================================
gajim/gtk/accounts.py
=====================================
@@ -670,7 +670,7 @@ class AddNewAccountPage(Gtk.Box):
Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
self.set_vexpand(True)
self.set_hexpand(True)
- button = Gtk.Button(label='Add Account')
+ button = Gtk.Button(label=_('Add Account'))
button.get_style_context().add_class('suggested-action')
button.set_action_name('app.add-account')
button.set_halign(Gtk.Align.CENTER)
=====================================
gajim/gtk/features.py
=====================================
@@ -207,7 +207,7 @@ class FeatureItem(Gtk.Grid):
self.box.pack_start(self.feature_dependency_u, True, True, 0)
self.icon = Gtk.Image()
- self.label_disabled = Gtk.Label(label='Disabled in Preferences')
+ self.label_disabled = Gtk.Label(label=_('Disabled in Preferences'))
self.label_disabled.get_style_context().add_class('dim-label')
self.set_feature(feature.available, feature.enabled)
=====================================
gajim/gtk/preferences.py
=====================================
@@ -148,15 +148,15 @@ class Preferences(Gtk.ApplicationWindow):
st = app.config.get('show_subject_on_join')
self._ui.subject_on_join_checkbutton.set_active(st)
-
# Group chat settings
threshold_model = self._ui.sync_threshold_combobox.get_model()
- for day in app.config.get_options('threshold_options'):
- if day == '0':
+ days = app.config.get_options('threshold_options', return_type=int)
+ for day in days:
+ if day == 0:
label = _('No threshold')
else:
- label = ngettext('%s day' % day, '%s days' % day, int(day))
- threshold_model.append([day, label])
+ label = ngettext('%i day', '%i days', day, day, day)
+ threshold_model.append([str(day), label])
public_threshold = app.config.get('public_room_sync_threshold')
self._ui.sync_threshold_combobox.set_id_column(0)
self._ui.sync_threshold_combobox.set_active_id(str(public_threshold))
=====================================
gajim/history_manager.py
=====================================
@@ -105,7 +105,7 @@ class HistoryManager:
log_db_path = configpaths.get('LOG_DB')
if not os.path.exists(log_db_path):
ErrorDialog(_('Cannot find history logs database'),
- '%s does not exist.' % log_db_path)
+ _('%s does not exist.') % log_db_path)
sys.exit()
self._ui = get_builder('history_manager.ui')
@@ -246,11 +246,11 @@ class HistoryManager:
dialog = YesNoDialog(
_('Do you want to clean up the database? '
- '(STRONGLY NOT RECOMMENDED IF GAJIM IS RUNNING)'),
+ '(STRONGLY NOT RECOMMENDED IF GAJIM IS RUNNING)'),
_('Normally allocated database size will not be freed, '
- 'it will just become reusable. If you really want to reduce '
- 'database filesize, click YES, else click NO.'
- '\n\nIn case you click YES, please wait…'),
+ 'it will just become reusable. If you really want to reduce '
+ 'database filesize, click YES, else click NO.'
+ '\n\nIn case you click YES, please wait…'),
on_response_yes=on_yes, on_response_no=on_no)
dialog.set_title(_('Database Cleanup'))
button_box = dialog.get_children()[0].get_children()[1]
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/125fe1e0f6c8f909104726a8c4b1584e91…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/125fe1e0f6c8f909104726a8c4b1584e91…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
881238de by Daniel Brötzmann at 2019-06-20T12:37:23Z
Notifications: Do not play sound if message has more than one recipient
This prevents Gajim from playing the message_sent sound multiple times
- - - - -
1 changed file:
- gajim/gui_interface.py
Changes:
=====================================
gajim/gui_interface.py
=====================================
@@ -361,10 +361,13 @@ class Interface:
@staticmethod
def handle_event_msgsent(obj):
- #('MSGSENT', account, (jid, msg))
- # do not play sound when standalone chatstate message (eg no msg)
+ # ('MSGSENT', account, (jid, msg))
+ # Do not play sound if it is a standalone chatstate message (eg no msg)
+ # or if it is a message to more than one recipient
if obj.message and app.config.get_per('soundevents', 'message_sent',
'enabled'):
+ if isinstance(obj.jid, list) and len(obj.jid) > 1:
+ return
helpers.play_sound('message_sent')
@staticmethod
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/881238de9ed5332912f440032919cc5b5a…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/881238de9ed5332912f440032919cc5b5a…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
328ceedd by Philipp Hörist at 2019-06-20T11:08:15Z
Fix rejecting file transfer
- - - - -
3 changed files:
- gajim/common/jingle_session.py
- gajim/common/modules/bytestream.py
- gajim/common/modules/jingle.py
Changes:
=====================================
gajim/common/jingle_session.py
=====================================
@@ -538,7 +538,7 @@ class JingleSession:
# If we are not receiving a file
# Check if there's already a session with this user:
if contents[0].media != 'file':
- for session in self.connection.get_module('Jingle').iter_jingle_sessions(self.peerjid):
+ for session in self.connection.get_module('Jingle').get_jingle_sessions(self.peerjid):
if session is not self:
reason = nbxmpp.Node('reason')
alternative_session = reason.setTag('alternative-session')
=====================================
gajim/common/modules/bytestream.py
=====================================
@@ -179,10 +179,9 @@ class Bytestream(BaseModule):
if not app.account_is_connected(self._account):
return
- if file_props.sid in self._sessions:
- jingle = self._sessions[file_props.sid]
- jingle.cancel_session()
- return
+ for session in self._con.get_module('Jingle').get_jingle_sessions(
+ None, file_props.sid):
+ session.cancel_session()
def send_success_connect_reply(self, streamhost):
"""
=====================================
gajim/common/modules/jingle.py
=====================================
@@ -230,16 +230,16 @@ class Jingle(BaseModule):
return 'sha-256'
return None
- def iter_jingle_sessions(self, jid, sid=None, media=None):
+ def get_jingle_sessions(self, jid, sid=None, media=None):
if sid:
- return (session for session in self._sessions.values() if \
- session.sid == sid)
- sessions = (session for session in self._sessions.values() if \
- session.peerjid == jid)
+ return [session for session in self._sessions.values() if \
+ session.sid == sid]
+ sessions = [session for session in self._sessions.values() if \
+ session.peerjid == jid]
if media:
if media not in ('audio', 'video', 'file'):
- return tuple()
- return (session for session in sessions if session.get_content(media))
+ return []
+ return [session for session in sessions if session.get_content(media)]
return sessions
def set_file_info(self, file_):
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/328ceedd2fe32eae9f0d97ce45fcc31074…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/328ceedd2fe32eae9f0d97ce45fcc31074…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
0411d8fe by Daniel Brötzmann at 2019-06-20T09:37:57Z
Make use of NewConfirmationDialog
This replaces ConfirmationDialog by NewConfirmationDialog and
ConfirmationDialogCheck by NewConfirmationCheckDialog in most places.
- - - - -
9 changed files:
- gajim/chat_control.py
- gajim/chat_control_base.py
- gajim/dialogs.py
- gajim/groupchat_control.py
- gajim/gtk/accounts.py
- gajim/gtk/themes.py
- gajim/gtkgui_helpers.py
- gajim/history_manager.py
- gajim/roster_window.py
Changes:
=====================================
gajim/chat_control.py
=====================================
@@ -56,8 +56,8 @@ from gajim import gui_menu_builder
from gajim import message_control
from gajim import dialogs
-from gajim.gtk.dialogs import NewConfirmationDialog
from gajim.gtk.dialogs import DialogButton
+from gajim.gtk.dialogs import NewConfirmationDialog
from gajim.gtk.add_contact import AddNewContactWindow
from gajim.gtk.util import get_icon_name
from gajim.gtk.util import get_cursor
@@ -1155,15 +1155,15 @@ class ChatControl(ChatControlBase):
time_ = app.last_message_time[self.account][self.get_full_jid()]
if time.time() - time_ < 2:
# 2 seconds
-
NewConfirmationDialog(
_('Close'),
- _('You just received a new message from %s') % self.contact.jid,
- _('If you close this tab and you have history disabled, '
+ _('You just received a new message '
+ 'from %s') % self.contact.jid,
+ _('If you close this tab while having chat history disabled, '
'this message will be lost.'),
[DialogButton.make('Cancel',
callback=lambda: on_no(self)),
- DialogButton.make('OK',
+ DialogButton.make('Remove',
text=_('Close'),
callback=lambda: on_yes(self))],
transient_for=self.parent_win.window).show()
=====================================
gajim/chat_control_base.py
=====================================
@@ -52,8 +52,9 @@ from gajim.message_control import MessageControl
from gajim.conversation_textview import ConversationTextview
from gajim.message_textview import MessageTextView
-from gajim.gtk.dialogs import NewConfirmationDialog
from gajim.gtk.dialogs import DialogButton
+from gajim.gtk.dialogs import NewConfirmationDialog
+from gajim.gtk.dialogs import NewConfirmationCheckDialog
from gajim.gtk import util
from gajim.gtk.util import convert_rgb_to_hex
from gajim.gtk.util import at_the_end
@@ -606,23 +607,27 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
image = clipboard.wait_for_image()
if image is not None:
if not app.config.get('confirm_paste_image'):
- self._paste_event_confirmed(image)
+ self._paste_event_confirmed(True, image)
return
- NewConfirmationDialog(
- _('Warning'),
+ NewConfirmationCheckDialog(
+ _('Paste Image'),
_('You are trying to paste an image'),
_('Are you sure you want to paste your '
- 'clipboard image in the chat?'),
+ 'clipboard\'s image into the chat window?'),
+ _('_Do not ask me again'),
[DialogButton.make('Cancel'),
DialogButton.make('OK',
- callback=lambda: self._paste_event_confirmed(image))],
- ).show()
+ text=_('_Paste'),
+ callback=self._paste_event_confirmed,
+ args=[image])]).show()
- def _paste_event_confirmed(self, image):
+ def _paste_event_confirmed(self, is_checked, image):
+ if is_checked:
+ app.config.set('confirm_paste_image', False)
tmp_dir = TemporaryDirectory()
dir_ = tmp_dir.name
- # get file transfer preference
+ # Get file transfer preference
ft_pref = app.config.get_per('accounts', self.account,
'filetransfer_preference')
path = os.path.join(dir_, '0.png')
=====================================
gajim/dialogs.py
=====================================
@@ -47,8 +47,9 @@ from gajim.common import app
from gajim.common import helpers
from gajim.common.exceptions import GajimGeneralException
+from gajim.gtk.dialogs import DialogButton
+from gajim.gtk.dialogs import NewConfirmationDialog
from gajim.gtk.dialogs import ErrorDialog
-from gajim.gtk.dialogs import ConfirmationDialog
from gajim.gtk.dialogs import InputDialog
from gajim.gtk.dialogs import AspellDictError
from gajim.gtk.util import get_icon_name
@@ -675,7 +676,7 @@ class ChangeStatusMessageDialog(TimeoutDialog):
if not msg_name: # msg_name was ''
msg_name = msg_text_1l
- def on_ok2():
+ def _on_ok2():
self.preset_messages_dict[msg_name] = [
msg_text, self.pep_dict.get('activity'),
self.pep_dict.get('subactivity'),
@@ -694,12 +695,19 @@ class ChangeStatusMessageDialog(TimeoutDialog):
app.config.set_per('statusmsg', msg_name, 'mood_text',
self.pep_dict.get('mood_text'))
if msg_name in self.preset_messages_dict:
- ConfirmationDialog(_('Overwrite Status Message?'),
- _('This name is already used. Do you want to overwrite this '
- 'status message?'), on_response_ok=on_ok2, transient_for=self.dialog)
+ NewConfirmationDialog(
+ _('Overwrite'),
+ _('Overwrite Status Message?'),
+ _('Preset name is already in use. '
+ 'Do you want to overwrite this preset?'),
+ [DialogButton.make('Cancel'),
+ DialogButton.make('Remove',
+ text=_('_Overwrite'),
+ callback=_on_ok2)],
+ transient_for=self.dialog).show()
return
app.config.add_per('statusmsg', msg_name)
- on_ok2()
+ _on_ok2()
iter_ = self.message_liststore.append((msg_name,))
# select in combobox the one we just saved
self.message_combobox.set_active_iter(iter_)
=====================================
gajim/groupchat_control.py
=====================================
@@ -67,9 +67,10 @@ from gajim.chat_control_base import ChatControlBase
from gajim.command_system.implementation.hosts import GroupChatCommands
from gajim.common.connection_handlers_events import GcMessageOutgoingEvent
+from gajim.gtk.dialogs import DialogButton
+from gajim.gtk.dialogs import NewConfirmationCheckDialog
from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk.dialogs import InputTextDialog
-from gajim.gtk.dialogs import ConfirmationDialogCheck
from gajim.gtk.dialogs import DestroyMucDialog
from gajim.gtk.dialogs import InputDialog
from gajim.gtk.dialogs import ChangeNickDialog
@@ -2352,27 +2353,30 @@ class GroupchatControl(ChatControlBase):
and self.is_connected and self.room_jid \
not in excludes:
- def on_ok(clicked):
- if clicked:
- # user does not want to be asked again
+ def on_ok(is_checked):
+ if is_checked:
+ # User does not want to be asked again
app.config.set('confirm_close_muc', False)
on_yes(self)
- def on_cancel(clicked):
- if clicked:
- # user does not want to be asked again
+ def on_cancel(is_checked):
+ if is_checked:
+ # User does not want to be asked again
app.config.set('confirm_close_muc', False)
on_no(self)
- pritext = _('Are you sure you want to leave group chat "%s"?')\
- % self.name
- sectext = _('If you close this window, you will be disconnected '
- 'from this group chat.')
-
- ConfirmationDialogCheck(pritext, sectext,
- _('_Do not ask me again'), on_response_ok=on_ok,
- on_response_cancel=on_cancel,
- transient_for=self.parent_win.window)
+ NewConfirmationCheckDialog(
+ _('Leave Group Chat'),
+ _('Are you sure you want to leave this group chat?'),
+ _('If you close this window, you will be disconnected '
+ 'from \'%s\'.') % self.name,
+ _('_Do not ask me again'),
+ [DialogButton.make('Cancel',
+ callback=on_cancel),
+ DialogButton.make('OK',
+ text=_('_Leave'),
+ callback=on_ok)],
+ transient_for=self.parent_win.window).show()
return
on_yes(self)
=====================================
gajim/gtk/accounts.py
=====================================
@@ -32,19 +32,18 @@ from gajim.common.zeroconf.connection_zeroconf import ConnectionZeroconf
from gajim import gui_menu_builder
-from gajim.gtk.settings import SettingsDialog
-from gajim.gtk.settings import SettingsBox
-from gajim.gtk.dialogs import ConfirmationDialog
+from gajim.gtk.dialogs import DialogButton
+from gajim.gtk.dialogs import NewConfirmationDialog
from gajim.gtk.dialogs import ConfirmationDialogDoubleRadio
from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk.dialogs import PassphraseDialog
from gajim.gtk.dialogs import YesNoDialog
-from gajim.gtk.dialogs import DialogButton
-from gajim.gtk.dialogs import NewConfirmationDialog
-from gajim.gtk.util import get_builder
from gajim.gtk.const import Setting
from gajim.gtk.const import SettingKind
from gajim.gtk.const import SettingType
+from gajim.gtk.settings import SettingsDialog
+from gajim.gtk.settings import SettingsBox
+from gajim.gtk.util import get_builder
log = logging.getLogger('gajim.gtk.accounts')
@@ -180,7 +179,7 @@ class AccountsWindow(Gtk.ApplicationWindow):
# Detect if we have opened windows for this account
- def remove(account):
+ def remove():
if (account in app.interface.instances and
'remove_account' in app.interface.instances[account]):
dialog = app.interface.instances[account]['remove_account']
@@ -191,14 +190,17 @@ class AccountsWindow(Gtk.ApplicationWindow):
app.interface.instances[account]['remove_account'] = \
RemoveAccountWindow(account)
if win_opened:
- ConfirmationDialog(
- _('You have opened chat in account %s') % account,
- _('All chat and groupchat windows will be closed. '
+ NewConfirmationDialog(
+ _('Remove Account'),
+ _('You still have open chats in your account %s') % account,
+ _('All chat and group chat windows will be closed.\n'
'Do you want to continue?'),
- on_response_ok=(remove, account),
- transient_for=self)
+ [DialogButton.make('Cancel'),
+ DialogButton.make('Remove',
+ callback=remove)],
+ transient_for=self).show()
else:
- remove(account)
+ remove()
def remove_account(self, account):
del self._need_relogin[account]
@@ -649,7 +651,7 @@ class AccountRow(Gtk.ListBoxRow):
[DialogButton.make('Cancel',
callback=lambda: switch.set_active(True)),
DialogButton.make('Remove',
- text=_('Disable Account'),
+ text=_('_Disable Account'),
callback=_disable)],
transient_for=self.get_toplevel()).show()
return Gdk.EVENT_STOP
@@ -1047,11 +1049,15 @@ class RemoveAccountWindow:
if self.account in app.connections and \
app.connections[self.account].connected:
- ConfirmationDialog(
- _('Account "%s" is connected to the server') % self.account,
+ NewConfirmationDialog(
+ _('Remove Account'),
+ _('Account \'%s\' is still connected to the '
+ 'server') % self.account,
_('If you remove it, the connection will be lost.'),
- on_response_ok=remove,
- transient_for=self._ui.remove_account_window)
+ [DialogButton.make('Cancel'),
+ DialogButton.make('Remove',
+ callback=remove)],
+ transient_for=self._ui.remove_account_window).show()
else:
remove()
=====================================
gajim/gtk/themes.py
=====================================
@@ -320,7 +320,8 @@ class Themes(Gtk.ApplicationWindow):
_('Delete Theme'),
_('Do you want to permanently delete this theme?'),
[DialogButton.make('Cancel'),
- DialogButton.make('Delete', callback=_remove_theme)],
+ DialogButton.make('Delete',
+ callback=_remove_theme)],
transient_for=self).show()
@staticmethod
=====================================
gajim/gtkgui_helpers.py
=====================================
@@ -147,11 +147,14 @@ def scale_pixbuf_from_data(data, size):
pixbuf = get_pixbuf_from_data(data)
return scale_pixbuf(pixbuf, size)
+
def on_avatar_save_as_menuitem_activate(widget, avatar, default_name=''):
+ from gajim.gtk.dialogs import DialogButton
from gajim.gtk.dialogs import ErrorDialog
- from gajim.gtk.dialogs import ConfirmationDialog
+ from gajim.gtk.dialogs import NewConfirmationDialog
from gajim.gtk.dialogs import FTOverwriteConfirmationDialog
from gajim.gtk.filechoosers import AvatarSaveDialog
+
def on_continue(response, file_path):
if response < 0:
return
@@ -169,7 +172,7 @@ def on_avatar_save_as_menuitem_activate(widget, avatar, default_name=''):
image_format = 'png'
file_path += '.png'
else:
- image_format = extension[1:] # remove leading dot
+ image_format = extension[1:] # remove leading dot
# Save image
try:
@@ -179,13 +182,23 @@ def on_avatar_save_as_menuitem_activate(widget, avatar, default_name=''):
if os.path.exists(file_path):
os.remove(file_path)
new_file_path = '.'.join(file_path.split('.')[:-1]) + '.png'
- def on_ok(file_path, pixbuf):
+
+ def _on_ok(file_path, pixbuf):
pixbuf.savev(file_path, 'png', [], [])
- ConfirmationDialog(_('Extension not supported'),
- _('Image cannot be saved in %(type)s format. Save as '
- '%(new_filename)s?') % {'type': image_format,
- 'new_filename': new_file_path},
- on_response_ok=(on_ok, new_file_path, pixbuf))
+
+ NewConfirmationDialog(
+ _('Error While Saving'),
+ _('Extension not supported'),
+ _('Image cannot be saved in %(type)s format.\n'
+ 'Save as %(new_filename)s?') % {
+ 'type': image_format,
+ 'new_filename': new_file_path},
+ [DialogButton.make('Cancel'),
+ DialogButton.make('OK',
+ text=_('_Save'),
+ callback=_on_ok,
+ args=[new_file_path,
+ pixbuf])]).show()
def on_ok(file_path):
if os.path.exists(file_path):
=====================================
gajim/history_manager.py
=====================================
@@ -568,11 +568,12 @@ class HistoryManager:
_('Delete'),
ngettext('Delete Conversation', 'Delete Conversations', paths_len),
ngettext('Do you want to permanently delete this '
- 'conversation with <b>%s</b>',
- 'Do you want to permanently delete these Conversations',
+ 'conversation with <b>%s</b>?',
+ 'Do you want to permanently delete these conversations?',
paths_len, liststore[list_of_paths[0]][0]),
[DialogButton.make('Cancel'),
- DialogButton.make('Delete', callback=on_ok)],
+ DialogButton.make('Delete',
+ callback=on_ok)],
transient_for=self._ui.history_manager_window).show()
def _delete_logs(self, liststore, list_of_paths):
@@ -609,7 +610,8 @@ class HistoryManager:
'Do you want to permanently delete these messages',
paths_len),
[DialogButton.make('Cancel'),
- DialogButton.make('Delete', callback=on_ok)],
+ DialogButton.make('Delete',
+ callback=on_ok)],
transient_for=self._ui.history_manager_window).show()
def on_search_db_button_clicked(self, widget):
=====================================
gajim/roster_window.py
=====================================
@@ -64,15 +64,14 @@ from gajim.common.dbus import location
from gajim.common import ged
from gajim.message_window import MessageWindowMgr
-from gajim.gtk.dialogs import ConfirmationDialog
-from gajim.gtk.dialogs import ConfirmationDialogCheck
+from gajim.gtk.dialogs import DialogButton
+from gajim.gtk.dialogs import NewConfirmationDialog
+from gajim.gtk.dialogs import NewConfirmationCheckDialog
from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk.dialogs import InputDialog
from gajim.gtk.dialogs import WarningDialog
from gajim.gtk.dialogs import InformationDialog
from gajim.gtk.dialogs import NonModalConfirmationDialog
-from gajim.gtk.dialogs import NewConfirmationCheckDialog
-from gajim.gtk.dialogs import DialogButton
from gajim.gtk.dialogs import InvitationReceivedDialog
from gajim.gtk.join_groupchat import JoinGroupchatWindow
from gajim.gtk.single_message import SingleMessageWindow
@@ -2249,7 +2248,7 @@ class RosterWindow:
dlg.dialog.present() # show it on current workspace
def change_status(self, widget, account, status):
- def change(account, status):
+ def _change(account, status):
def on_response(message, pep_dict):
if message is None:
# user pressed Cancel to change status message dialog
@@ -2259,13 +2258,20 @@ class RosterWindow:
self.get_status_message(status, on_response)
if status == 'invisible' and self.connected_rooms(account):
- ConfirmationDialog(
+ NewConfirmationDialog(
+ _('Disconnect for Invisibility'),
_('You are participating in one or more group chats'),
_('Changing your status to invisible will result in '
- 'disconnection from those group chats. Are you sure you want '
- 'to go invisible?'), on_response_ok=(change, account, status))
+ 'disconnection from those group chats.\n'
+ 'Are you sure you want to go invisible?'),
+ [DialogButton.make('Cancel'),
+ DialogButton.make('Remove',
+ text=_('_Disconnect'),
+ callback=_change,
+ args=[account,
+ status])]).show()
else:
- change(account, status)
+ _change(account, status)
def update_status_combobox(self):
# table to change index in connection.connected to index in combobox
@@ -2351,14 +2357,20 @@ class RosterWindow:
elif app.config.get('quit_on_roster_x_button'):
self.on_quit_request()
else:
- def on_ok(checked):
- if checked:
+ def _on_ok(is_checked):
+ if is_checked:
app.config.set('quit_on_roster_x_button', True)
self.on_quit_request()
- ConfirmationDialogCheck(_('Really quit Gajim?'),
- _('Are you sure you want to quit Gajim?'),
- _('Always close Gajim'), on_response_ok=on_ok)
- return True # do NOT destroy the window
+ NewConfirmationCheckDialog(
+ _('Quit Gajim'),
+ _('You are about to quit Gajim'),
+ _('Are you sure you want to quit Gajim?'),
+ _('_Always quit when closing Gajim'),
+ [DialogButton.make('Cancel'),
+ DialogButton.make('Remove',
+ text=_('_Quit'),
+ callback=_on_ok)]).show()
+ return True # Do NOT destroy the window
def prepare_quit(self):
if self.save_done:
@@ -2444,10 +2456,18 @@ class RosterWindow:
break
if transfer_active:
- ConfirmationDialog(_('You have running file transfers'),
- _('If you quit now, the file(s) being transferred will '
- 'be stopped. Do you still want to quit?'),
- on_response_ok=(on_continue3, message, pep_dict))
+ NewConfirmationDialog(
+ _('Stop File Transfers'),
+ _('You still have running file transfers'),
+ _('If you quit now, the file(s) being transferred will '
+ 'be lost.\n'
+ 'Do you still want to quit?'),
+ [DialogButton.make('Cancel'),
+ DialogButton.make('Remove',
+ text=_('_Quit'),
+ callback=on_continue3,
+ args=[message,
+ pep_dict])]).show()
return
on_continue3(message, pep_dict)
@@ -2476,11 +2496,18 @@ class RosterWindow:
break
if unread or recent:
- ConfirmationDialog(_('You have unread messages'),
+ NewConfirmationDialog(
+ _('Unread Messages'),
+ _('You still have unread messages'),
_('Messages will only be available for reading them later '
- 'if you have history enabled and contact is in your '
- 'roster.'), on_response_ok=(on_continue2,
- message, pep_dict))
+ 'if storing chat history is enabled and if the contact '
+ 'is in your contact list.'),
+ [DialogButton.make('Cancel'),
+ DialogButton.make('Remove',
+ text=_('_Quit'),
+ callback=on_continue2,
+ args=[message,
+ pep_dict])]).show()
return
on_continue2(message, pep_dict)
@@ -2726,7 +2753,7 @@ class RosterWindow:
self.remove_contact(contact.jid, account, backend=True)
return
- def remove(list_):
+ def remove():
for (contact, account) in list_:
full_jid = contact.get_full_jid()
app.connections[account].get_module('Gateway').unsubscribe(full_jid)
@@ -2741,13 +2768,14 @@ class RosterWindow:
has_unread_events = True
break
if has_unread_events:
- ErrorDialog(_('You have unread messages'),
- _('You must read them before removing this transport.'))
+ ErrorDialog(
+ _('You have unread messages'),
+ _('You must read them before removing this transport.'))
return
if len(list_) == 1:
- pritext = _('Transport "%s" will be removed') % list_[0][0].jid
+ pritext = _('Transport \'%s\' will be removed') % list_[0][0].jid
sectext = _('You will no longer be able to send and receive '
- 'messages from contacts using this transport.')
+ 'messages from and to contacts using this transport.')
else:
pritext = _('Transports will be removed')
jids = ''
@@ -2755,9 +2783,16 @@ class RosterWindow:
jids += '\n ' + contact.get_shown_name() + ','
jids = jids[:-1] + '.'
sectext = _('You will no longer be able to send and receive '
- 'messages to contacts from these transports: %s') % jids
- ConfirmationDialog(pritext, sectext,
- on_response_ok=(remove, list_), transient_for=self.window)
+ 'messages from and to contacts using these '
+ 'transports:\n%s') % jids
+ NewConfirmationDialog(
+ _('Remove Transport'),
+ pritext,
+ sectext,
+ [DialogButton.make('Cancel'),
+ DialogButton.make('Remove',
+ callback=remove)],
+ transient_for=self.window).show()
def _nec_blocking(self, obj):
for jid in obj.changed:
@@ -2817,17 +2852,17 @@ class RosterWindow:
if confirm_block == 'no':
_block_it()
return
- NewConfirmationCheckDialog(_('Block Contact'),
- _('Really block this contact?'),
- _('This contact will see you offline and '
- 'you will not receive messages sent to '
- 'you by this contact.'),
- _('_Do not ask me again'),
- [DialogButton.make('Cancel'),
- DialogButton.make('Remove',
- text=_('Block Contact'),
- callback=_block_it)],
- modal=False).show()
+ NewConfirmationCheckDialog(
+ _('Block Contact'),
+ _('Really block this contact?'),
+ _('This contact will see you offline and you will not receive '
+ 'any messages sent to you by this contact.'),
+ _('_Do not ask me again'),
+ [DialogButton.make('Cancel'),
+ DialogButton.make('Remove',
+ text=_('_Block Contact'),
+ callback=_block_it)],
+ modal=False).show()
def on_unblock(self, widget, list_, group=None):
"""
@@ -2915,20 +2950,25 @@ class RosterWindow:
old_text), on_canceled, transient_for=self.window)
def on_remove_group_item_activated(self, widget, group, account):
- def on_ok(checked):
+ def _on_ok(is_checked):
for contact in app.contacts.get_contacts_from_group(account,
group):
- if not checked:
+ if not is_checked:
self.remove_contact_from_groups(contact.jid, account,
[group])
else:
- app.connections[account].get_module('Presence').unsubscribe(contact.jid)
+ app.connections[account].get_module(
+ 'Presence').unsubscribe(contact.jid)
self.remove_contact(contact.jid, account, backend=True)
- ConfirmationDialogCheck(_('Remove Group'),
- _('Do you want to remove group %s from the roster?') % group,
- _('Also remove all contacts in this group from your roster'),
- on_response_ok=on_ok)
+ NewConfirmationCheckDialog(
+ _('Remove Group'),
+ _('Remove Group'),
+ _('Do you want to remove %s from the contact list?') % group,
+ _('_Also remove all contacts of this group from contact list'),
+ [DialogButton.make('Cancel'),
+ DialogButton.make('Remove',
+ callback=_on_ok)]).show()
def on_edit_groups(self, widget, list_):
dialogs.EditGroupsDialog(list_)
@@ -3322,42 +3362,62 @@ class RosterWindow:
if len(list_) == 1:
contact = list_[0][0]
- pritext = _('Contact "%s" will be removed from your roster') % \
- contact.get_shown_name()
- sectext = _('You are about to remove "%(name)s" (%(jid)s) from '
- 'your roster.\n') % {'name': contact.get_shown_name(),
- 'jid': contact.jid}
+ title = _('Remove Contact')
+ pritext = _('Remove contact from contact list')
+ sectext = _('You are about to remove \'%(name)s\' (%(jid)s) from '
+ 'your contact list.\n') % {
+ 'name': contact.get_shown_name(),
+ 'jid': contact.jid}
if contact.sub == 'to':
- ConfirmationDialog(pritext, sectext + \
- _('By removing this contact you also remove authorization '
- 'resulting in them always seeing you as offline.'),
- on_response_ok=on_ok2)
+ NewConfirmationDialog(
+ title,
+ pritext,
+ sectext + \
+ _('By removing this contact you also remove authorization. '
+ 'This means the contact will see you as offline.'),
+ [DialogButton.make('Cancel'),
+ DialogButton.make('Remove',
+ callback=on_ok2)]).show()
elif _('Not in Roster') in contact.get_shown_groups():
# Contact is not in roster
- ConfirmationDialog(pritext, sectext + \
- _('Do you want to continue?'), on_response_ok=on_ok2)
+ NewConfirmationDialog(
+ title,
+ pritext,
+ sectext + \
+ _('Do you want to continue?'),
+ [DialogButton.make('Cancel'),
+ DialogButton.make('Remove',
+ callback=on_ok2)]).show()
else:
NewConfirmationCheckDialog(
- _('Remove'),
- pritext, sectext + \
- _('By removing this contact you also by default remove '
- 'authorization resulting in them always seeing you as'
- ' offline.'),
+ title,
+ pritext,
+ sectext + \
+ _('By removing this contact you also remove authorization. '
+ 'This means the contact will see you as offline.'),
_('_I want this contact to know my status after removal'),
[DialogButton.make('Cancel'),
- DialogButton.make('Remove', callback=on_ok)],
- modal=False).show()
+ DialogButton.make('Remove',
+ callback=on_ok)],
+ modal=False).show()
else:
# several contact to remove at the same time
- pritext = _('Contacts will be removed from your roster')
+ pritext = _('Remove contacts from contact list')
jids = ''
for contact, _account in list_:
- jids += '\n ' + contact.get_shown_name() + ' (%s)' % \
- contact.jid + ','
- sectext = _('By removing these contacts:%s\nyou also remove '
- 'authorization resulting in them always seeing you as '
- 'offline.') % jids
- ConfirmationDialog(pritext, sectext, on_response_ok=on_ok2)
+ jids += '%(name)s (%(jid)s)\n' % {
+ 'name': contact.get_shown_name(),
+ 'jid': contact.jid}
+ sectext = _('By removing the following contacts, you will also '
+ 'remove authorization. This means they will see you '
+ 'as offline:\n\n%s') % jids
+ NewConfirmationDialog(
+ _('Remove Contacts'),
+ pritext,
+ sectext,
+ [DialogButton.make('Cancel'),
+ DialogButton.make('Remove',
+ callback=on_ok2)]).show()
def on_status_combobox_changed(self, widget):
"""
@@ -3452,12 +3512,17 @@ class RosterWindow:
def on_cancel():
self.update_status_combobox()
- ConfirmationDialog(
+ NewConfirmationDialog(
+ _('Disconnect for Invisibility'),
_('You are participating in one or more group chats'),
_('Changing your status to invisible will result in '
- 'disconnection from those group chats. Are you sure you '
- 'want to go invisible?'), on_response_ok=on_ok,
- on_response_cancel=on_cancel)
+ 'disconnection from those group chats.\n'
+ 'Are you sure you want to go invisible?'),
+ [DialogButton.make('Cancel',
+ callback=on_cancel),
+ DialogButton.make('Remove',
+ text=_('_Disconnect'),
+ callback=on_ok)]).show()
return
self.get_status_message(status, on_continue)
@@ -4103,15 +4168,19 @@ class RosterWindow:
if confirm_metacontacts == 'no' or dest_family == source_family:
merge_contacts()
return
- pritext = _('You are about to create a metacontact. Are you sure you '
- 'want to continue?')
- sectext = _('Metacontacts are a way to regroup several contacts in one '
- 'line. Generally it is used when the same person has several '
- 'XMPP- or transport -accounts.')
- dlg = ConfirmationDialogCheck(pritext, sectext,
- _('_Do not ask me again'), on_response_ok=merge_contacts)
- if not confirm_metacontacts: # First time we see this window
- dlg.checkbutton.set_active(True)
+ pritext = _('You are about to create a metacontact')
+ sectext = _('Metacontacts are a way to regroup several contacts in '
+ 'one single contact. Generally it is used when the same '
+ 'person has several XMPP- or Transport-Accounts.')
+ NewConfirmationCheckDialog(
+ _('Create Metacontact'),
+ pritext,
+ sectext,
+ _('_Do not ask me again'),
+ [DialogButton.make('Cancel'),
+ DialogButton.make('OK',
+ text=_('_Create'),
+ callback=merge_contacts)]).show()
def on_drop_in_group(self, widget, account, c_source, grp_dest,
is_big_brother, context, etime, grp_source=None):
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0411d8fe34cf17b234eb1eebd07cc0a014…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0411d8fe34cf17b234eb1eebd07cc0a014…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
d0029580 by Daniel Brötzmann at 2019-06-19T21:42:41Z
RosterWindow: Enable invite on drop to group chat
- - - - -
a59679f5 by Daniel Brötzmann at 2019-06-19T21:42:41Z
Roster build_invite_submenu: Enable MUC invite menu for offline contacts
- - - - -
2 changed files:
- gajim/gui_menu_builder.py
- gajim/roster_window.py
Changes:
=====================================
gajim/gui_menu_builder.py
=====================================
@@ -97,7 +97,7 @@ show_bookmarked=False, force_resource=False):
if len(contact_list) > 1: # several resources
invite_to_new_room_menuitem.set_submenu(build_resources_submenu(
contact_list, account, roster.on_invite_to_new_room, cap=NS_MUC))
- elif len(list_) == 1 and contact.supports(NS_MUC):
+ elif len(list_) == 1:
invite_menuitem.set_sensitive(True)
# use resource if it's self contact
if contact.jid == app.get_jid_from_account(account) or force_resource:
=====================================
gajim/roster_window.py
=====================================
@@ -4271,8 +4271,12 @@ class RosterWindow:
return
if type_dest == 'groupchat':
- # drop on a minimized groupchat
- # TODO: Invite to groupchat if type_dest = contact
+ # Drop on a minimized groupchat
+ if type_source != 'contact':
+ return
+ contact_jid = data
+ con = app.connections[account_dest]
+ con.get_module('MUC').invite(jid_dest, contact_jid)
return
if type_source == 'group':
@@ -4287,6 +4291,9 @@ class RosterWindow:
new_grp = grp_source_list[-1]
elif type_dest == 'group':
grp_dest = model[iter_dest][Column.JID]
+ # Don't allow to drop on e.g. Groupchats group
+ if grp_dest in helpers.special_groups:
+ return
grp_dest_list = grp_dest.split(delimiter)
# Do not allow to drop on a subgroup of source group
if grp_source_list[0] != grp_dest_list[0]:
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/4e47062a6daeaf0cf088d12a7a5785ec9…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/4e47062a6daeaf0cf088d12a7a5785ec9…
You're receiving this email because of your account on dev.gajim.org.