diff --git a/gajim/data/gui/subscription_request_popup_menu.ui b/gajim/data/gui/subscription_request_popup_menu.ui deleted file mode 100644 index e250672f4..000000000 --- a/gajim/data/gui/subscription_request_popup_menu.ui +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - False - - - True - False - _Start Chat - True - - - - - - True - False - _Information - True - - - - - diff --git a/gajim/data/gui/subscription_request_window.ui b/gajim/data/gui/subscription_request_window.ui index 835bb00d3..8fc15f436 100644 --- a/gajim/data/gui/subscription_request_window.ui +++ b/gajim/data/gui/subscription_request_window.ui @@ -1,35 +1,88 @@ - + - + True False - gtk-add - - - True - False - gtk-cancel - - - - False - 12 - Subscription Request - False - dialog - - + True False - vertical - 5 + _Start Chat + True + + + + + + True + False + _Information + True + + + + + + True + False + 18 + 18 + 18 + 18 + vertical + 5 + + + True + False + + + False + False + 0 + + + + + 100 + True + True + 5 + in - + True - False + True + False + word + False + + + + + True + True + 1 + + + + + True + False + 5 + 12 + end + + + _Close + True + True + True + False + True + False @@ -38,154 +91,66 @@ - - 100 + + _Deny True True - 5 - in + True + False + Deny authorization from contact so he or she cannot know when you're connected + True + + + + False + False + 1 + + + + + True + True + True + subscription_request_popup_menu + False - + True - True - False - word - False - textbuffer1 + False + applications-system-symbolic True True - 1 + 2 - + + Au_thorize True - False - 5 - 12 - end - - - gtk-close - True - True - True - False - True - - - - False - False - 0 - - - - - _Deny - True - True - True - False - Deny authorization from contact so he or she cannot know when you're connected - image2 - True - - - - False - False - 1 - - - - - True - True - False - - - - True - False - 2 - - - True - False - gtk-execute - - - False - False - 0 - - - - - True - False - _Actions - True - - - False - False - 1 - - - - - True - False - down - - - False - False - 2 - - - - - - - False - False - 2 - - - - - Au_thorize - True - True - True - True - False - Authorize contact so he or she can know when you're connected - image1 - True - - - - False - False - 3 - - + True + True + False + Authorize contact so he or she can know when you're connected + True + False False - 2 + 3 + + False + False + 2 + diff --git a/gajim/dialogs.py b/gajim/dialogs.py index d468aaed0..8d16d4664 100644 --- a/gajim/dialogs.py +++ b/gajim/dialogs.py @@ -2269,10 +2269,18 @@ class DoubleInputDialog: else: self.cancel_handler() -class SubscriptionRequestWindow: +class SubscriptionRequestWindow(Gtk.ApplicationWindow): def __init__(self, jid, text, account, user_nick=None): + Gtk.ApplicationWindow.__init__(self) + self.set_name('SubscriptionRequest') + self.set_application(app.app) + self.set_show_menubar(False) + self.set_resizable(False) + self.set_position(Gtk.WindowPosition.CENTER) + self.set_title(_('Subscription Request')) + xml = gtkgui_helpers.get_gtk_builder('subscription_request_window.ui') - self.window = xml.get_object('subscription_request_window') + self.add(xml.get_object('subscription_box')) self.jid = jid self.account = account self.user_nick = user_nick @@ -2282,10 +2290,16 @@ class SubscriptionRequestWindow: % {'account': account, 'jid': self.jid} else: prompt_text = _('Subscription request from %s') % self.jid - xml.get_object('from_label').set_text(prompt_text) - xml.get_object('message_textview').get_buffer().set_text(text) + + from_label = xml.get_object('from_label') + from_label.set_text(prompt_text) + + textview = xml.get_object('message_textview') + textview.get_buffer().set_text(text) + + self.set_default(xml.get_object('authorize_button')) xml.connect_signals(self) - self.window.show_all() + self.show_all() def on_subscription_request_window_destroy(self, widget): """ @@ -2295,21 +2309,15 @@ class SubscriptionRequestWindow: # remove us from open windows del app.interface.instances[self.account]['sub_request'][self.jid] - def prepare_popup_menu(self): - xml = gtkgui_helpers.get_gtk_builder('subscription_request_popup_menu.ui') - menu = xml.get_object('subscription_request_popup_menu') - xml.connect_signals(self) - return menu - def on_close_button_clicked(self, widget): - self.window.destroy() + self.destroy() def on_authorize_button_clicked(self, widget): """ Accept the request """ app.connections[self.account].send_authorization(self.jid) - self.window.destroy() + self.destroy() contact = app.contacts.get_contact(self.account, self.jid) if not contact or _('Not in Roster') in contact.groups: AddNewContactWindow(self.account, self.jid, self.user_nick) @@ -2342,16 +2350,7 @@ class SubscriptionRequestWindow: contact = app.contacts.get_contact(self.account, self.jid) if contact and _('Not in Roster') in contact.get_shown_groups(): app.interface.roster.remove_contact(self.jid, self.account) - self.window.destroy() - - def on_actions_button_clicked(self, widget): - """ - Popup action menu - """ - menu = self.prepare_popup_menu() - menu.show_all() - gtkgui_helpers.popup_emoticons_under_button(menu, widget, - self.window.get_window()) + self.destroy() class JoinGroupchatWindow(Gtk.ApplicationWindow): def __init__(self, account, room_jid, password=None, automatic=None): diff --git a/gajim/gtkgui_helpers.py b/gajim/gtkgui_helpers.py index 10c2e6959..f0751b0f0 100644 --- a/gajim/gtkgui_helpers.py +++ b/gajim/gtkgui_helpers.py @@ -151,43 +151,6 @@ def get_completion_liststore(entry): entry.set_completion(completion) return liststore - -def popup_emoticons_under_button(menu, button, parent_win): - """ - Popup the emoticons menu under button, which is in parent_win - """ - window_x1, window_y1 = parent_win.get_origin()[1:] - - def position_menu_under_button(menu, _x=None, _y=None, data=None): - # inline function, which will not keep refs, when used as CB - alloc = button.get_allocation() - button_x, button_y = alloc.x, alloc.y - translated_coordinates = button.translate_coordinates( - app.interface.roster.window, 0, 0) - if translated_coordinates: - button_x, button_y = translated_coordinates - - # now convert them to X11-relative - window_x, window_y = window_x1, window_y1 - x = window_x + button_x - y = window_y + button_y - - menu_height = menu.get_preferred_size()[0].height - - ## should we pop down or up? - if (y + alloc.height + menu_height < Gdk.Screen.height()): - # now move the menu below the button - y += alloc.height - else: - # now move the menu above the button - y -= menu_height - - # push_in is True so all the menuitems are always inside screen - push_in = True - return (x, y, push_in) - - menu.popup(None, None, position_menu_under_button, None, 1, 0) - def get_theme_font_for_option(theme, option): """ Return string description of the font, stored in theme preferences diff --git a/gajim/gui_interface.py b/gajim/gui_interface.py index cc2bc3cc5..492b5da69 100644 --- a/gajim/gui_interface.py +++ b/gajim/gui_interface.py @@ -499,7 +499,7 @@ class Interface: account = obj.conn.name if helpers.allow_popup_window(account) or not self.systray_enabled: if obj.jid in self.instances[account]['sub_request']: - self.instances[account]['sub_request'][obj.jid].window.destroy() + self.instances[account]['sub_request'][obj.jid].destroy() self.instances[account]['sub_request'][obj.jid] = \ dialogs.SubscriptionRequestWindow(obj.jid, obj.status, account, obj.user_nick) @@ -829,7 +829,7 @@ class Interface: self.roster.draw_contact(obj.jid, account) if obj.jid in self.instances[account]['sub_request'] and obj.sub in ( 'from', 'both'): - self.instances[account]['sub_request'][obj.jid].window.destroy() + self.instances[account]['sub_request'][obj.jid].destroy() def handle_event_bookmarks(self, obj): # ('BOOKMARKS', account, [{name,jid,autojoin,password,nick}, {}])