def __init__(self, account, on_ok, on_cancel): pritext = _('Insecure connection') sectext = _( 'You are about to connect to the account %(account)s ' '(%(server)s) insecurely. This means conversations will not be ' 'encrypted, and is strongly discouraged.\nAre you sure you want ' 'to do that?') % { 'account': account, 'server': app.get_hostname_from_account(account) } checktext1 = _('Yes, I really want to connect insecurely') tooltip1 = _('Gajim will NOT connect unless you check this box') checktext2 = _('_Do not ask me again') ConfirmationDialogDoubleCheck.__init__(self, pritext, sectext, checktext1, checktext2, tooltip1=tooltip1, on_response_ok=on_ok, on_response_cancel=on_cancel, is_modal=False) self.ok_button = self.get_widget_for_response(Gtk.ResponseType.OK) self.ok_button.set_sensitive(False) self.checkbutton1.connect('clicked', self.on_checkbutton_clicked) self.set_title(_('Insecure connection'))
def __init__(self, account): flags = Gtk.DialogFlags.DESTROY_WITH_PARENT super().__init__(_('Server Info'), None, flags) self.account = account self.set_transient_for(app.interface.roster.window) self.set_resizable(False) grid = Gtk.Grid() grid.set_name('ServerInfoGrid') grid.set_row_spacing(10) grid.set_hexpand(True) self.info_listbox = Gtk.ListBox() self.info_listbox.set_selection_mode(Gtk.SelectionMode.NONE) self.info_listbox.set_header_func(self.header_func, 'Information') grid.attach(self.info_listbox, 0, 0, 1, 1) self.feature_listbox = Gtk.ListBox() self.feature_listbox.set_selection_mode(Gtk.SelectionMode.NONE) self.feature_listbox.set_header_func(self.header_func, 'Features') grid.attach(self.feature_listbox, 0, 1, 1, 1) box = self.get_content_area() box.pack_start(grid, True, True, 0) box.set_property('margin', 12) box.set_spacing(18) self.connect('response', self.on_response) self.connect('destroy', self.on_destroy) app.ged.register_event_handler('version-result-received', ged.CORE, self._nec_version_result_received) app.ged.register_event_handler('server-disco-received', ged.GUI1, self._server_disco_received) self.version = '' self.uptime = '' self.hostname = app.get_hostname_from_account(account) con = app.connections[account] con.get_module('SoftwareVersion').request_os_info(self.hostname, None) self.request_last_activity() for feature in self.get_features(): self.add_feature(feature) for info in self.get_infos(): self.add_info(info) self.show_all()
def init_accounts(self): """ Initialize listStore with existing accounts """ model = self.accounts_treeview.get_model() model.clear() for remote_account in app.connections: if remote_account == self.account: # Do not show the account we're sync'ing continue iter_ = model.append() model.set(iter_, 0, remote_account, 1, app.get_hostname_from_account(remote_account))
def __init__(self, account): Gtk.ApplicationWindow.__init__(self) EventHelper.__init__(self) self.set_name('ServerInfo') self.set_application(app.app) self.set_position(Gtk.WindowPosition.CENTER) self.set_default_size(400, 600) self.set_show_menubar(False) self.set_title(_('Server Info')) self.set_type_hint(Gdk.WindowTypeHint.DIALOG) self.account = account self._destroyed = False self._ui = get_builder('server_info.ui') self.add(self._ui.server_info_notebook) self.connect('destroy', self.on_destroy) self.connect('key-press-event', self._on_key_press) self._ui.connect_signals(self) self.register_events([ ('server-disco-received', ged.GUI1, self._server_disco_received), ]) self.version = '' self.hostname = app.get_hostname_from_account(account) self._ui.server_hostname.set_text(self.hostname) con = app.connections[account] con.get_module('SoftwareVersion').request_software_version( self.hostname, callback=self._software_version_received) con.get_module('LastActivity').request_last_activity( self.hostname, callback=self._on_last_activity) server_info = con.get_module('Discovery').server_info self._add_contact_addresses(server_info.dataforms) self.cert = con.certificate self._add_connection_info() self.feature_listbox = Gtk.ListBox() self.feature_listbox.set_name('ServerInfo') self.feature_listbox.set_selection_mode(Gtk.SelectionMode.NONE) self._ui.features_scrolled.add(self.feature_listbox) for feature in self.get_features(): self.add_feature(feature) self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) self.show_all()
def on_ok_button_clicked(self, widget): model = self.contacts_treeview.get_model() iter_ = model.get_iter_first() while iter_: if model[iter_][0]: # it is selected remote_jid = model[iter_][1] message = 'I\'m synchronizing my contacts from my %s account, could you please add this address to your contact list?' % \ app.get_hostname_from_account(self.remote_account) remote_contact = app.contacts.get_first_contact_from_jid( self.remote_account, remote_jid) # keep same groups and same nickname app.interface.roster.req_sub(self, remote_jid, message, self.local_account, groups=remote_contact.groups, nickname=remote_contact.name, auto_auth=True) iter_ = model.iter_next(iter_) self.dialog.destroy()
def __init__(self, account): super().__init__(title=_('Server Info'), transient_for=None, destroy_with_parent=True) self.account = account self._destroyed = False self.set_transient_for(app.interface.roster.window) self.set_resizable(True) self.set_size_request(300, 500) grid = Gtk.Grid() grid.set_name('ServerInfoGrid') grid.set_row_spacing(10) grid.set_hexpand(True) self.info_listbox = Gtk.ListBox() self.info_listbox.set_selection_mode(Gtk.SelectionMode.NONE) self.info_listbox.set_header_func(self.header_func, 'Information') grid.attach(self.info_listbox, 0, 0, 1, 1) self.feature_listbox = Gtk.ListBox() self.feature_listbox.set_selection_mode(Gtk.SelectionMode.NONE) self.feature_listbox.set_header_func(self.header_func, 'Features') grid.attach(self.feature_listbox, 0, 1, 1, 1) self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) clipboard_button = Gtk.Button(halign=Gtk.Align.END) clp_image = Gtk.Image.new_from_icon_name('edit-copy-symbolic', Gtk.IconSize.BUTTON) clipboard_button.set_image(clp_image) clipboard_button.set_tooltip_text(_('Copy info to clipboard')) clipboard_button.connect('clicked', self.on_clipboard_button_clicked) box = self.get_content_area() scrolled = Gtk.ScrolledWindow() scrolled.set_max_content_height(500) scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) scrolled.add(grid) box.pack_start(scrolled, True, True, 0) box.pack_start(clipboard_button, False, True, 0) box.set_property('margin', 12) box.set_spacing(18) self.connect('response', self.on_response) self.connect('destroy', self.on_destroy) app.ged.register_event_handler('server-disco-received', ged.GUI1, self._server_disco_received) self.version = '' self.uptime = '' self.hostname = app.get_hostname_from_account(account) con = app.connections[account] con.get_module('SoftwareVersion').request_software_version( self.hostname, callback=self._software_version_received) self.request_last_activity() for feature in self.get_features(): self.add_feature(feature) for info in self.get_infos(): self.add_info(info) self.show_all()