Commit 5ce0c65c authored by Philipp Hörist's avatar Philipp Hörist Committed by Philipp Hörist
Browse files

Move chat options menu

Putting it into the header forced GTK Window Decorations, that makes
the application look alien on all systems except Gnome.
parent c609d3c5
......@@ -107,6 +107,8 @@ def __init__(self, parent_win, contact, acct, session, resource=None):
# Menu for the HeaderBar
self.control_menu = gui_menu_builder.get_singlechat_menu(
self.control_id)
settings_menu = self.xml.get_object('settings_menu')
settings_menu.set_menu_model(self.control_menu)
self._audio_banner_image = self.xml.get_object('audio_banner_image')
self._video_banner_image = self.xml.get_object('video_banner_image')
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.1 -->
<!-- Generated with glade 3.20.2 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkAdjustment" id="adjustment1">
......@@ -626,58 +626,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<object class="GtkMenuButton" id="emoticons_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Show a list of emoticons (Alt+M)</property>
<property name="relief">none</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">face-smile-symbolic</property>
</object>
</child>
<style>
<class name="chatcontrol-actionbar-button"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="formattings_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="has_tooltip">True</property>
<property name="relief">none</property>
<property name="popup">formattings_menu</property>
<child>
<object class="GtkImage" id="image10">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">format-text-bold-symbolic</property>
<property name="icon_size">1</property>
</object>
</child>
<style>
<class name="chatcontrol-actionbar-button"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="label_selector">
<property name="visible">True</property>
......@@ -687,7 +635,7 @@
<property name="expand">True</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">2</property>
<property name="position">0</property>
</packing>
</child>
<child>
......@@ -791,7 +739,31 @@ audio-mic-volume-low</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">3</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="settings_menu">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">open-menu-symbolic</property>
</object>
</child>
<style>
<class name="chatcontrol-actionbar-button"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
<child>
......@@ -818,7 +790,7 @@ audio-mic-volume-low</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">4</property>
<property name="position">3</property>
</packing>
</child>
<child>
......@@ -843,7 +815,7 @@ audio-mic-volume-low</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">5</property>
<property name="position">4</property>
</packing>
</child>
<child>
......@@ -870,9 +842,61 @@ audio-mic-volume-low</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="emoticons_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Show a list of emoticons (Alt+M)</property>
<property name="relief">none</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">face-smile-symbolic</property>
</object>
</child>
<style>
<class name="chatcontrol-actionbar-button"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="formattings_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="has_tooltip">True</property>
<property name="relief">none</property>
<property name="popup">formattings_menu</property>
<child>
<object class="GtkImage" id="image10">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">format-text-bold-symbolic</property>
<property name="icon_size">1</property>
</object>
</child>
<style>
<class name="chatcontrol-actionbar-button"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">7</property>
</packing>
</child>
<child>
<placeholder/>
</child>
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.1 -->
<!-- Generated with glade 3.20.2 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkMenu" id="formattings_menu">
......@@ -222,17 +222,16 @@
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<object class="GtkMenuButton" id="emoticons_button">
<object class="GtkMenuButton" id="settings_menu">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Show a list of emoticons (Alt+M)</property>
<property name="relief">none</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">face-smile-symbolic</property>
<property name="icon_name">open-menu-symbolic</property>
</object>
</child>
<style>
......@@ -242,24 +241,23 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="formattings_button">
<property name="visible">True</property>
<object class="GtkButton" id="authentication_button">
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="has_tooltip">True</property>
<property name="no_show_all">True</property>
<property name="relief">none</property>
<property name="popup">formattings_menu</property>
<child>
<object class="GtkImage" id="image10">
<object class="GtkImage" id="lock_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">format-text-bold-symbolic</property>
<property name="stock">gtk-dialog-authentication</property>
<property name="icon_size">1</property>
</object>
</child>
......@@ -269,24 +267,23 @@
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="authentication_button">
<object class="GtkMenuButton" id="encryption_menu">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="no_show_all">True</property>
<property name="tooltip_text" translatable="yes">Choose an encryption</property>
<property name="relief">none</property>
<child>
<object class="GtkImage" id="lock_image">
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-dialog-authentication</property>
<property name="icon_size">1</property>
<property name="icon_name">channel-secure-symbolic</property>
</object>
</child>
<style>
......@@ -295,38 +292,48 @@
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkComboBox" id="label_selector">
<object class="GtkButton" id="sendfile_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">mail-attachment-symbolic</property>
</object>
</child>
<style>
<class name="chatcontrol-actionbar-button"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="encryption_menu">
<object class="GtkMenuButton" id="emoticons_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Choose an encryption</property>
<property name="tooltip_text" translatable="yes">Show a list of emoticons (Alt+M)</property>
<property name="relief">none</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">channel-secure-symbolic</property>
<property name="icon_name">face-smile-symbolic</property>
</object>
</child>
<style>
......@@ -336,22 +343,25 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">5</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="sendfile_button">
<object class="GtkMenuButton" id="formattings_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="has_tooltip">True</property>
<property name="relief">none</property>
<property name="popup">formattings_menu</property>
<child>
<object class="GtkImage">
<object class="GtkImage" id="image10">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">mail-attachment-symbolic</property>
<property name="icon_name">format-text-bold-symbolic</property>
<property name="icon_size">1</property>
</object>
</child>
<style>
......@@ -360,9 +370,23 @@
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">6</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkComboBox" id="label_selector">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">7</property>
</packing>
</child>
</object>
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.20.2 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkEventBox" id="chat_tab_ebox">
......@@ -64,25 +64,6 @@
</object>
</child>
</object>
<object class="GtkHeaderBar" id="headerbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkMenuButton" id="header_menu">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">open-menu-symbolic</property>
</object>
</child>
</object>
</child>
</object>
<object class="GtkApplicationWindow" id="message_window">
<property name="name">MessageWindow</property>
<property name="can_focus">False</property>
......@@ -96,5 +77,8 @@
<property name="scrollable">True</property>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.20.2 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkAccelGroup" id="accelgroup1"/>
......@@ -115,29 +115,8 @@
</child>
</object>
</child>
</object>
<object class="GtkHeaderBar" id="headerbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title">Gajim</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkMenuButton" id="header_menu">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">open-menu-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>
......@@ -482,6 +482,8 @@ def __init__(self, parent_win, contact, acct, is_continued=False):
self.gc_tooltip = tooltips.GCTooltip()
self.control_menu = gui_menu_builder.get_groupchat_menu(self.control_id)
settings_menu = self.xml.get_object('settings_menu')
settings_menu.set_menu_model(self.control_menu)
app.ged.register_event_handler('gc-presence-received', ged.GUI1,
self._nec_gc_presence_received)
......
......@@ -101,18 +101,6 @@ def __init__(self, acct, type_, parent_window=None, parent_paned=None):
orig_window.destroy()
del orig_window
# Set headermenu
# single-window mode: show the header menu on the roster window
# all other modes: add the headerbar to the new window
# A headerbar has to be set before the window calls show()
if parent_window:
self.header_menu = app.interface.roster.header_menu
self.header_menu.show()
else:
self.header_menu = self.xml.get_object('header_menu')
headerbar = self.xml.get_object('headerbar')
self.window.set_titlebar(headerbar)
# NOTE: we use 'connect_after' here because in
# MessageWindowMgr._new_window we register handler that saves window
# state when closing it, and it should be called before
......@@ -170,9 +158,6 @@ def __init__(self, acct, type_, parent_window=None, parent_paned=None):
self.notebook.set_show_border(app.config.get('tabs_border'))
self.show_icon()
def set_header_menu(self, menu):
self.header_menu.set_menu_model(menu)
def change_account_name(self, old_name, new_name):
if old_name in self._controls:
self._controls[new_name] = self._controls[old_name]
......@@ -589,7 +574,6 @@ def remove_tab(self, ctrl, method, reason = None, force = False):
ask any confirmation
"""
def close(ctrl):
self.remove_headermenu(self.notebook, ctrl)
if reason is not None: # We are leaving gc with a status message
ctrl.shutdown(reason)
else: # We are leaving gc without status message or it's a chat
......@@ -627,7 +611,6 @@ def on_no(ctrl):
def on_minimize(ctrl):
if method != self.CLOSE_COMMAND:
self.remove_headermenu(self.notebook, ctrl)
ctrl.minimize()
self.check_tabs()
return
......@@ -639,13 +622,6 @@ def on_minimize(ctrl):
else:
ctrl.allow_shutdown(method, on_yes, on_no, on_minimize)
def remove_headermenu(self, notebook, ctrl):
page_num = notebook.page_num(ctrl.widget)
if page_num == notebook.get_current_page():
self.set_header_menu(None)
elif notebook.get_n_pages() == 1:
self.set_header_menu(None)
def check_tabs(self):
if self.parent_paned:
# Do nothing in single window mode
......@@ -866,7 +842,6 @@ def _on_notebook_switch_page(self, notebook, page, page_num):
new_ctrl = self._widget_to_control(notebook.get_nth_page(page_num))
new_ctrl.set_control_active(True)
self.show_title(control = new_ctrl)
self.set_header_menu(new_ctrl.control_menu)
control = self.get_active_control()
if isinstance(control, ChatControlBase):
......@@ -1321,7 +1296,6 @@ def reconfig(self):
gtkgui_helpers.resize_window(w.window,
app.config.get('roster_width'),
app.config.get('roster_height'))
self.hide_header_bar(self.parent_win)
self._windows = {}
......@@ -1335,12 +1309,6 @@ def reconfig(self):
ctrl.update_actions()
mw.new_tab(ctrl)
@staticmethod
def hide_header_bar(parent_win):
header_bar = parent_win.get_titlebar()
for child in header_bar.get_children():
child.hide()
def save_opened_controls(self):
if not app.config.get('remember_opened_chat_controls'):
return
......
......@@ -5675,13 +5675,6 @@ def __init__(self, application: Gtk.Application):
app.interface.msg_win_mgr.connect('window-delete',
self.on_message_window_delete)
# Set headermenu but hide it.
# MessageWindow will show it if we are in single-window mode
headerbar = self.xml.get_object('headerbar')
self.window.set_titlebar(headerbar)
self.header_menu = self.xml.get_object('header_menu')
self.header_menu.hide()
self.advanced_menus = [] # We keep them to destroy them
if app.config.get('roster_window_skip_taskbar'):
self.window.set_property('skip-taskbar-hint', True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment