Commit 3a3b5aff authored by Philipp Hörist's avatar Philipp Hörist

Move some dialogs into gtk module

parent bff5f14b
......@@ -6,7 +6,6 @@ from gajim.common import app
from gajim import gtkgui_helpers
from gajim import gui_menu_builder
from gajim.common import passwords
from gajim import dialogs
from gajim import config
from gajim.common import helpers
from gajim.common import ged
......@@ -14,6 +13,8 @@ from gajim.common.connection import Connection
from gajim.common.zeroconf.connection_zeroconf import ConnectionZeroconf
from gajim.options_dialog import OptionsDialog, OptionsBox
from gajim.common.const import Option, OptionKind, OptionType
from gajim.gtk import ConfirmationDialog
from gajim.gtk import YesNoDialog
class AccountsWindow(Gtk.ApplicationWindow):
......@@ -143,7 +144,7 @@ class AccountsWindow(Gtk.ApplicationWindow):
account, 'offline', _('Be right back.'))
GLib.timeout_add(500, login, account, show_before, status_before)
dialogs.YesNoDialog(
YesNoDialog(
_('Relogin now?'),
_('If you want all the changes to apply instantly, '
'you must relogin.'),
......@@ -197,7 +198,7 @@ class AccountsWindow(Gtk.ApplicationWindow):
app.interface.instances[account]['remove_account'] = \
config.RemoveAccountWindow(account)
if win_opened:
dialogs.ConfirmationDialog(
ConfirmationDialog(
_('You have opened chat in account %s') % account,
_('All chat and groupchat windows will be closed. '
'Do you want to continue?'),
......
......@@ -33,7 +33,7 @@ from gajim.common import dataforms
from gajim.common import ged
from gajim import gtkgui_helpers
from gajim import dialogs
from gajim.gtk import HigDialog
from gajim import dataforms_widget
class CommandWindow:
......@@ -322,7 +322,7 @@ class CommandWindow:
dialog.destroy()
cb()
dialog = dialogs.HigDialog(self.window, Gtk.MessageType.WARNING,
dialog = HigDialog(self.window, Gtk.MessageType.WARNING,
Gtk.ButtonsType.YES_NO, _('Cancel confirmation'),
_('You are in process of executing command. Do you really want to '
'cancel it?'), on_response_yes=on_yes)
......
......@@ -28,14 +28,21 @@ import gajim.plugins.gui
from gajim import history_window
from gajim import disco
from gajim.gtk.history_sync import HistorySyncAssistant
from gajim.server_info import ServerInfoDialog
from gajim.gtk.server_info import ServerInfoDialog
from gajim.gtk.mam_preferences import MamPreferences
from gajim.gtk import JoinGroupchatWindow
from gajim.gtk import StartChatDialog
from gajim.gtk import AddNewContactWindow
from gajim.gtk import SingleMessageWindow
from gajim.gtk import XMLConsoleWindow
from gajim.gtk import AboutDialog
from gajim.gtk import PrivacyListsWindow
# General Actions
def on_add_contact_jid(action, param):
dialogs.AddNewContactWindow(None, param.get_string())
AddNewContactWindow(None, param.get_string())
# Application Menu Actions
......@@ -79,7 +86,7 @@ def on_new_chat(action, param):
if 'start_chat' in app.interface.instances:
app.interface.instances['start_chat'].present()
else:
app.interface.instances['start_chat'] = dialogs.StartChatDialog()
app.interface.instances['start_chat'] = StartChatDialog()
# Accounts Actions
......@@ -103,7 +110,7 @@ def on_send_server_message(action, param):
account = param.get_string()
server = app.config.get_per('accounts', account, 'hostname')
server += '/announce/online'
dialogs.SingleMessageWindow(account, server, 'send')
SingleMessageWindow(account, server, 'send')
def on_service_disco(action, param):
......@@ -127,23 +134,23 @@ def on_join_gc(action, param):
return
else:
account = param.get_string()
window = app.get_app_window(dialogs.JoinGroupchatWindow)
window = app.get_app_window(JoinGroupchatWindow)
if window is None:
dialogs.JoinGroupchatWindow(account, None)
JoinGroupchatWindow(account, None)
else:
window.present()
def on_add_contact(action, param):
window = app.get_app_window(dialogs.AddNewContactWindow)
window = app.get_app_window(AddNewContactWindow)
if window is None:
dialogs.AddNewContactWindow(param.get_string())
AddNewContactWindow(param.get_string())
else:
window.present()
def on_single_message(action, param):
dialogs.SingleMessageWindow(param.get_string(), action='send')
SingleMessageWindow(param.get_string(), action='send')
def on_merge_accounts(action, param):
......@@ -206,7 +213,7 @@ def on_privacy_lists(action, param):
interface.instances[account]['privacy_lists'].window.present()
else:
interface.instances[account]['privacy_lists'] = \
dialogs.PrivacyListsWindow(account)
PrivacyListsWindow(account)
def on_server_info(action, param):
......@@ -224,7 +231,7 @@ def on_xml_console(action, param):
interface.instances[account]['xml_console'].present()
else:
interface.instances[account]['xml_console'] = \
dialogs.XMLConsoleWindow(account)
XMLConsoleWindow(account)
def on_manage_proxies(action, param):
......@@ -241,14 +248,14 @@ def on_set_motd(action, param):
account = param.get_string()
server = app.config.get_per('accounts', account, 'hostname')
server += '/announce/motd'
dialogs.SingleMessageWindow(account, server, 'send')
SingleMessageWindow(account, server, 'send')
def on_update_motd(action, param):
account = param.get_string()
server = app.config.get_per('accounts', account, 'hostname')
server += '/announce/motd/update'
dialogs.SingleMessageWindow(account, server, 'send')
SingleMessageWindow(account, server, 'send')
def on_delete_motd(action, param):
......@@ -279,7 +286,7 @@ def on_features(action, param):
def on_about(action, param):
dialogs.AboutDialog()
AboutDialog()
# View Actions
......
......@@ -37,6 +37,8 @@ from gajim import gtkgui_helpers
from gajim import gui_menu_builder
from gajim import message_control
from gajim import dialogs
from gajim.gtk import ConfirmationDialog
from gajim.gtk import AddNewContactWindow
from gajim.common import app
from gajim.common import helpers
......@@ -337,7 +339,7 @@ class ChatControl(ChatControlBase):
'information-' + self.control_id).set_enabled(online)
def _on_add_to_roster(self, action, param):
dialogs.AddNewContactWindow(self.account, self.contact.jid)
AddNewContactWindow(self.account, self.contact.jid)
def _on_information(self, action, param):
app.interface.roster.on_info(None, self.contact, self.account)
......@@ -1208,7 +1210,7 @@ class ChatControl(ChatControlBase):
def on_cancel():
on_no(self)
dialogs.ConfirmationDialog(
ConfirmationDialog(
#%s is being replaced in the code with JID
_('You just received a new message from "%s"') % \
self.contact.jid,
......
......@@ -37,7 +37,7 @@ from gi.repository import Gio
from gajim import gtkgui_helpers
from gajim import message_control
from gajim import dialogs
from gajim.gtk import NonModalConfirmationDialog
from gajim import history_window
from gajim import notify
import re
......@@ -1160,7 +1160,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
prim_text = _('Really send file?')
sec_text = _('If you send a file to %s, your real JID will '
'be revealed.') % gc_contact.name
dialog = dialogs.NonModalConfirmationDialog(prim_text,
dialog = NonModalConfirmationDialog(prim_text,
sec_text, on_response_ok=(_on_ok, gc_contact))
dialog.popup()
return
......
......@@ -955,7 +955,7 @@ class GcMessageReceivedEvent(nec.NetworkIncomingEvent):
if self.msg_obj.form_node:
# It could be a voice request. See
# http://www.xmpp.org/extensions/xep-0045.html#voiceapprove
from gajim.dialogs import SingleMessageWindow
from gajim.gtk import SingleMessageWindow
SingleMessageWindow(
self.conn.name, self.fjid,
action='receive', from_whom=self.fjid,
......
......@@ -52,6 +52,12 @@ from gajim.gajim_themes_window import GajimThemesWindow
from gajim.advanced_configuration_window import AdvancedConfigurationWindow
from gajim import dataforms_widget
from gajim import gui_menu_builder
from gajim.gtk import AspellDictError
from gajim.gtk import ConfirmationDialog
from gajim.gtk import ConfirmationDialogDoubleRadio
from gajim.gtk import ErrorDialog
from gajim.gtk import InputDialog
from gajim.gtk import WarningDialog
from gajim.common import helpers
from gajim.common import app
......@@ -653,7 +659,7 @@ class PreferencesWindow:
if gspell_lang is None:
gspell_lang = Gspell.language_get_default()
if gspell_lang is None:
dialogs.AspellDictError(lang)
AspellDictError(lang)
app.config.set('use_speller', False)
widget.set_active(False)
else:
......@@ -1682,7 +1688,7 @@ class GroupchatConfigWindow:
return
model = self.affiliation_treeview[affiliation].get_model()
model.append((jid, '', '', ''))
dialogs.InputDialog(title, prompt, ok_handler=on_ok)
InputDialog(title, prompt, ok_handler=on_ok)
def on_remove_button_clicked(self, widget, affiliation):
selection = self.affiliation_treeview[affiliation].get_selection()
......@@ -1785,7 +1791,7 @@ class RemoveAccountWindow:
app.connections[self.account].change_status('offline', 'offline')
if self.remove_and_unregister_radiobutton.get_active():
if not self.account in app.connections:
dialogs.ErrorDialog(
ErrorDialog(
_('Account is disabled'),
_('To unregister from a server, account must be '
'enabled.'),
......@@ -1813,7 +1819,7 @@ class RemoveAccountWindow:
if self.account in app.connections and \
app.connections[self.account].connected:
dialogs.ConfirmationDialog(
ConfirmationDialog(
_('Account "%s" is connected to the server') % self.account,
_('If you remove it, the connection will be lost.'),
on_response_ok=remove,
......@@ -1829,7 +1835,7 @@ class RemoveAccountWindow:
# action of unregistration has failed, we don't remove the account
# Error message is send by connect_and_auth()
if not res:
dialogs.ConfirmationDialogDoubleRadio(
ConfirmationDialogDoubleRadio(
_('Connection to server %s failed') % self.account,
_('What would you like to do?'),
_('Remove only from Gajim'),
......@@ -2036,7 +2042,7 @@ class ManageBookmarksWindow:
if self.server_entry.get_text() == '' or \
self.room_entry.get_text() == '':
dialogs.ErrorDialog(_('This bookmark has invalid data'),
ErrorDialog(_('This bookmark has invalid data'),
_('Please be sure to fill out server and room fields or remove this'
' bookmark.'))
return False
......@@ -2166,7 +2172,7 @@ class ManageBookmarksWindow:
try:
nick = helpers.parse_resource(nick)
except helpers.InvalidFormat:
dialogs.ErrorDialog(_('Invalid nickname'),
ErrorDialog(_('Invalid nickname'),
_('Character not allowed'), transient_for=self.window)
self.nick_entry.set_text(model[iter_][6])
return True
......@@ -2182,7 +2188,7 @@ class ManageBookmarksWindow:
if not server:
return
if '@' in server:
dialogs.ErrorDialog(_('Invalid server'),
ErrorDialog(_('Invalid server'),
_('Character not allowed'), transient_for=self.window)
widget.set_text(server.replace('@', ''))
......@@ -2193,7 +2199,7 @@ class ManageBookmarksWindow:
try:
room_jid = helpers.parse_jid(room_jid)
except helpers.InvalidFormat as e:
dialogs.ErrorDialog(_('Invalid server'),
ErrorDialog(_('Invalid server'),
_('Character not allowed'), transient_for=self.window)
self.server_entry.set_text(model[iter_][2].split('@')[1])
return True
......@@ -2221,7 +2227,7 @@ class ManageBookmarksWindow:
try:
room_jid = helpers.parse_jid(room_jid)
except helpers.InvalidFormat:
dialogs.ErrorDialog(_('Invalid room'),
ErrorDialog(_('Invalid room'),
_('Character not allowed'), transient_for=self.window)
return True
model[iter_][2] = room_jid
......@@ -2439,7 +2445,7 @@ class AccountCreationWizardWindow:
pritext = _('Invalid username')
sectext = _(
'You must provide a username to configure this account.')
dialogs.ErrorDialog(pritext, sectext)
ErrorDialog(pritext, sectext)
return
server = self.xml.get_object('server_comboboxtext_entry').\
get_text().strip()
......@@ -2457,7 +2463,7 @@ class AccountCreationWizardWindow:
jid = helpers.parse_jid(jid)
except helpers.InvalidFormat as s:
pritext = _('Invalid JID')
dialogs.ErrorDialog(pritext, str(s))
ErrorDialog(pritext, str(s))
return
self.account = server
......@@ -2478,7 +2484,7 @@ class AccountCreationWizardWindow:
get_text()
if not server:
dialogs.ErrorDialog(_('Invalid server'),
ErrorDialog(_('Invalid server'),
_('Please provide a server on which you want to register.'))
return
self.account = server
......@@ -2502,7 +2508,7 @@ class AccountCreationWizardWindow:
try:
custom_port = int(custom_port)
except Exception:
dialogs.ErrorDialog(_('Invalid entry'),
ErrorDialog(_('Invalid entry'),
_('Custom port must be a port number.'))
return
config['custom_port'] = custom_port
......@@ -2535,7 +2541,7 @@ class AccountCreationWizardWindow:
with open(my_ca_certs) as f:
certs = f.read()
if self.ssl_cert in certs:
dialogs.ErrorDialog(_('Certificate Already in File'),
ErrorDialog(_('Certificate Already in File'),
_('This certificate is already in file %s, so it\'s '
'not added again.') % my_ca_certs)
else:
......@@ -2766,7 +2772,7 @@ class AccountCreationWizardWindow:
def save_account(self, login, server, savepass, password, anonymous=False):
if self.account in app.connections:
dialogs.ErrorDialog(_('Account name is in use'),
ErrorDialog(_('Account name is in use'),
_('You already have an account using this name.'))
return
con = connection.Connection(self.account)
......@@ -2899,7 +2905,7 @@ class ManagePEPServicesWindow:
def node_not_removed(self, jid, node, msg):
if jid != app.get_jid_from_account(self.account):
return
dialogs.WarningDialog(_('PEP node was not removed'),
WarningDialog(_('PEP node was not removed'),
_('PEP node %(node)s was not removed: %(message)s') % {'node': node,
'message': msg})
......
......@@ -38,7 +38,11 @@ from gajim import dialogs
import queue
import urllib
from gajim import gtkgui_helpers
from gajim.gtk import AddNewContactWindow
from gajim.gtk import util
from gajim.gtk.util import load_icon
from gajim.gtk.util import get_builder
from gajim.gtk.util import get_cursor
from gajim.common import app
from gajim.common import helpers
from gajim.common import i18n
......@@ -164,11 +168,6 @@ class ConversationTextview(GObject.GObject):
)
)
MESSAGE_CORRECTED_PIXBUF = gtkgui_helpers.get_icon_pixmap(
'document-edit-symbolic')
MESSAGE_ENCRYPTED_PIXBUF = gtkgui_helpers.get_icon_pixmap(
'channel-secure-croped-symbolic')
def __init__(self, account, used_in_history_window = False):
"""
If used_in_history_window is True, then we do not show Clear menuitem in
......@@ -330,11 +329,11 @@ class ConversationTextview(GObject.GObject):
if len(text) > 50:
text = text[:47] + '…'
tooltip.set_text(text)
window.set_cursor(gtkgui_helpers.get_cursor('HAND2'))
window.set_cursor(get_cursor('HAND2'))
self.cursor_changed = True
return True
if tag_name in ('url', 'mail', 'xmpp', 'sth_at_sth'):
window.set_cursor(gtkgui_helpers.get_cursor('HAND2'))
window.set_cursor(get_cursor('HAND2'))
self.cursor_changed = True
return False
try:
......@@ -344,7 +343,7 @@ class ConversationTextview(GObject.GObject):
except KeyError:
pass
if self.cursor_changed:
window.set_cursor(gtkgui_helpers.get_cursor('XTERM'))
window.set_cursor(get_cursor('XTERM'))
self.cursor_changed = False
return False
......@@ -370,7 +369,7 @@ class ConversationTextview(GObject.GObject):
def scroll_to_end(self, force=False):
if self.autoscroll or force:
gtkgui_helpers.scroll_to_end(self.tv.get_parent())
util.scroll_to_end(self.tv.get_parent())
def correct_message(self, correct_id, kind, name):
allowed = True
......@@ -674,10 +673,10 @@ class ConversationTextview(GObject.GObject):
app.interface.join_gc_minimal(self.account, room_jid)
def on_add_to_roster_activate(self, widget, jid):
dialogs.AddNewContactWindow(self.account, jid)
AddNewContactWindow(self.account, jid)
def make_link_menu(self, event, kind, text):
xml = gtkgui_helpers.get_gtk_builder('chat_context_menu.ui')
xml = get_builder('chat_context_menu.ui')
menu = xml.get_object('chat_context_menu')
childs = menu.get_children()
if kind == 'url':
......@@ -1142,8 +1141,9 @@ class ConversationTextview(GObject.GObject):
self.print_time(text, kind, tim, simple, direction_mark,
other_tags_for_time, iter_)
icon = load_icon('channel-secure-croped-symbolic', self.tv, pixbuf=True)
if encrypted:
buffer_.insert_pixbuf(iter_, self.MESSAGE_ENCRYPTED_PIXBUF)
buffer_.insert_pixbuf(iter_, icon)
# If there's a displaymarking, print it here.
if displaymarking:
......@@ -1185,8 +1185,9 @@ class ConversationTextview(GObject.GObject):
# Show Correction Icon
buffer_.create_tag(tag_name=msg_stanza_id)
buffer_.insert(iter_, ' ')
icon = load_icon('document-edit-symbolic', self.tv, pixbuf=True)
buffer_.insert_pixbuf(
iter_, ConversationTextview.MESSAGE_CORRECTED_PIXBUF)
iter_, icon)
tag_start_iter = iter_.copy()
tag_start_iter.backward_chars(2)
buffer_.apply_tag_by_name(msg_stanza_id, tag_start_iter, iter_)
......
......@@ -128,3 +128,8 @@ button.flat.link { padding: 0; border: 0; }
/*SendFileDialog*/
#SendFileDialog grid {padding: 12px}
#SendFileDialog grid list { background-color: @theme_bg_color}
/*Icon colors*/
.success-color { color: @success_color; }
.error-color { color: @error_color; }
.warning-color { color: @warning_color; }
......@@ -22,8 +22,8 @@ from collections import namedtuple
from gi.repository import GLib
from gajim.common.app import app
from gajim.dialogs import ErrorDialog
from gajim.dialogs import InformationDialog
from gajim.gtk import ErrorDialog
from gajim.gtk import InformationDialog
Message = namedtuple('Message', ['title', 'text', 'dialog'])
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -52,7 +52,8 @@ from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import Pango
from gajim import dialogs
from gajim.gtk import ErrorDialog
from gajim.gtk import InformationDialog
from gajim import gtkgui_helpers
from gajim import groups
from gajim import adhoc_commands
......@@ -526,7 +527,7 @@ class ServiceDiscoveryWindow(object):
# Check connection
if app.connections[account].connected < 2:
dialogs.ErrorDialog(_('You are not connected to the server'),
ErrorDialog(_('You are not connected to the server'),
_('Without a connection, you can not browse available services'))
raise RuntimeError('You must be connected to browse services')
......@@ -722,14 +723,14 @@ _('Without a connection, you can not browse available services'))
if not self.address_comboboxtext:
# We can't travel anywhere else.
self.destroy()
dialogs.ErrorDialog(_('The service could not be found'),
ErrorDialog(_('The service could not be found'),
_('There is no service at the address you entered, or it is '
'not responding. Check the address and try again.'),
transient_for=self.window)
return
klass = self.cache.get_browser(identities, features)
if not klass:
dialogs.ErrorDialog(_('The service is not browsable'),
ErrorDialog(_('The service is not browsable'),
_('This type of service does not contain any items to browse.'),
transient_for=self.window)
return
......@@ -772,7 +773,7 @@ _('Without a connection, you can not browse available services'))
jid = helpers.parse_jid(jid)
except helpers.InvalidFormat as s:
pritext = _('Invalid Server Name')
dialogs.ErrorDialog(pritext, str(s))
ErrorDialog(pritext, str(s))
return
self.travel(jid, '')
......@@ -782,7 +783,7 @@ _('Without a connection, you can not browse available services'))
jid = helpers.parse_jid(jid)
except helpers.InvalidFormat as s:
pritext = _('Invalid Server Name')
dialogs.ErrorDialog(pritext, str(s),
ErrorDialog(pritext, str(s),
transient_for=self.window)
return
if jid == self.jid: # jid has not changed
......@@ -1081,7 +1082,7 @@ class AgentBrowser:
if not self.window.address_comboboxtext:
# We can't travel anywhere else.
self.window.destroy()
dialogs.ErrorDialog(_('The service is not browsable'),
ErrorDialog(_('The service is not browsable'),
_('This service does not contain any items to browse.'),
transient_for=self.window.window)
return
......@@ -1772,7 +1773,7 @@ class MucBrowser(AgentBrowser):
}
if room_jid in con.get_module('Bookmarks').bookmarks:
dialogs.ErrorDialog(
ErrorDialog(
_('Bookmark already set'),
_('Group Chat "%s" is already in your bookmarks.') % room_jid,
transient_for=self.window.window)
......@@ -1783,7 +1784,7 @@ class MucBrowser(AgentBrowser):
gui_menu_builder.build_bookmark_menu(self.account)
dialogs.InformationDialog(
InformationDialog(
_('Bookmark has been added successfully'),
_('You can manage your bookmarks via Actions menu in your roster.'),
transient_for=self.window.window)
......
......@@ -36,7 +36,12 @@ from datetime import datetime
from gajim import gtkgui_helpers
from gajim import tooltips
from gajim import dialogs
from gajim.gtk import HigDialog
from gajim.gtk import InformationDialog
from gajim.gtk import YesNoDialog
from gajim.gtk import ErrorDialog
from gajim.gtk import FTOverwriteConfirmationDialog
from gajim.gtk import NonModalConfirmationDialog
from gajim.common import app
from gajim.common import helpers
......@@ -247,7 +252,7 @@ class FileTransfersWindow:
sectext += recipient
if file_props.type_ == 'r':
sectext += '\n\t' + _('Saved in: %s') % file_path
dialog = dialogs.HigDialog(app.interface.roster.window, Gtk.MessageType.INFO,
dialog = HigDialog(app.interface.roster.window, Gtk.MessageType.INFO,
Gtk.ButtonsType.NONE, _('File transfer completed'), sectext)
if file_props.type_ == 'r':
button = Gtk.Button.new_with_mnemonic(_('Open _Containing Folder'))
......@@ -263,14 +268,14 @@ class FileTransfersWindow:
"""
Show error dialog to the recipient saying that transfer has been canceled
"""
dialogs.InformationDialog(_('File transfer cancelled'), _('Connection with peer cannot be established.'))
InformationDialog(_('File transfer cancelled'), _('Connection with peer cannot be established.'))
self.tree.get_selection().unselect_all()
def show_send_error(self, file_props):
"""
Show error dialog to the sender saying that transfer has been canceled
"""
dialogs.InformationDialog(_('File transfer cancelled'),
InformationDialog(_('File transfer cancelled'),
_('Connection with peer cannot be established.'))
self.tree.get_selection().unselect_all()
......@@ -283,7 +288,7 @@ class FileTransfersWindow:
sectext += '\n\t' + _('Recipient: %s') % jid
if error_msg:
sectext += '\n\t' + _('Error message: %s') % error_msg
dialogs.ErrorDialog(_('File transfer stopped'), sectext)
ErrorDialog(_('File transfer stopped'), sectext)
self.tree.get_selection().unselect_all()
def show_hash_error(self, jid, file_props, account):
......@@ -318,7 +323,7 @@ class FileTransfersWindow:
file_name = os.path.basename(file_props.file_name)
else:
file_name = file_props.name
dialogs.YesNoDialog(('File transfer error'),
YesNoDialog(('File transfer error'),
_('The file %(file)s has been received, but it seems to have '
'been damaged along the way.\nDo you want to download it again?') % \
{'file': file_name}, on_response_yes=(on_yes, jid, file_props,
......@@ -335,7 +340,7 @@ class FileTransfersWindow:
if gtkgui_helpers.file_is_locked(file_path):
pritext = _('Gajim can not read this file')
sextext = _('Another process is using this file.')
dialogs.ErrorDialog(pritext, sextext)
ErrorDialog(pritext, sextext)
return
if isinstance(contact, str):
......@@ -378,7 +383,7 @@ class FileTransfersWindow:
if not os.access(file_path, os.W_OK):
file_name = GLib.markup_escape_text(os.path.basename(
file_path))
dialogs.ErrorDialog(
ErrorDialog(
_('Cannot overwrite existing file "%s"' % file_name),
_('A file with this name already exists and you do not '
'have permission to overwrite it.'))
......@@ -395,7 +400,7 @@ class FileTransfersWindow:
file_props.offset = dl_size
self._start_receive(file_path, account, contact, file_props)
dialog = dialogs.FTOverwriteConfirmationDialog(
dialog = FTOverwriteConfirmationDialog(
_('This file already exists'), _('What do you want to do?'),
propose_resume=not dl_finished, on_response=on_response)
dialog.set_destroy_with_parent(True)
......@@ -406,7 +411,7 @@ class FileTransfersWindow:
# read-only bit is used to mark special folder under
# windows, not to mark that a folder is read-only.
# See ticket #3587
dialogs.ErrorDialog(_('Directory "%s" is not writable') % \
ErrorDialog(_('Directory "%s" is not writable') % \
dirname, _('You do not have permission to create files '
'in this directory.'))
return
......@@ -445,7 +450,7 @@ class FileTransfersWindow:
def on_response_cancel(account, file_props):
app.connections[account].send_file_rejection(file_props)
dialog = dialogs.NonModalConfirmationDialog(prim_text, sec_text,
dialog = NonModalConfirmationDialog(prim_text, sec_text,
on_response_ok=(on_response_ok, account, contact, file_props),
on_response_cancel=(on_response_cancel, account, file_props))
dialog.connect('delete-event', lambda widget, event:
......@@ -674,10 +679,10 @@ class FileTransfersWindow:
if os.path.isfile(file_path):
stat = os.stat(file_path)
else:
dialogs.ErrorDialog(_('Invalid File'), _('File: ') + file_path)
ErrorDialog(_('Invalid File'), _('File: ') + file_path)
return None
if stat[6] == 0:
dialogs.ErrorDialog(_('Invalid File'),
ErrorDialog(_('Invalid File'),
_('It is not possible to send empty files'))
return None
file_props = FilesProp.getNewFileProp(account,
......
......@@ -25,15 +25,17 @@
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Pango
from gajim import dialogs
from gajim import gtkgui_helpers
from gajim.common import app
from gajim.gtk import ErrorDialog
from gajim.gtk.util import get_builder
class GajimThemesWindow:
def __init__(self):
self.xml = gtkgui_helpers.get_gtk_builder('gajim_themes_window.ui')
self.xml = get_builder('gajim_themes_window.ui')
self.window = self.xml.get_object('gajim_themes_window')
self.window.set_transient_for(app.interface.instances[
'preferences'].window)
......@@ -94,7 +96,7 @@ class GajimThemesWindow:
if old_name == new_name:
return
if old_name == 'default':
dialogs.ErrorDialog(
ErrorDialog(
_('You cannot make changes to the default theme'),
_('Please create a new clean theme.'))
return
......@@ -183,7 +185,7 @@ class GajimThemesWindow:
if not iter_:
return
if self.current_theme == app.config.get('roster_theme'):
dialogs.ErrorDialog(
ErrorDialog(
_('You cannot delete your current theme'),
_('Pick another theme to use first.'))
return
......
......@@ -41,11 +41,11 @@ from gajim import gtkgui_helpers
from gajim import gui_menu_builder
from gajim import message_control