|
1 | 1 | /*
|
2 |
| -* Copyright (c) 2011-2018 Alecaddd (http://alecaddd.com) |
| 2 | +* Copyright (c) 2017-2020 Alecaddd (https://alecaddd.com) |
3 | 3 | *
|
4 | 4 | * This program is free software; you can redistribute it and/or
|
5 | 5 | * modify it under the terms of the GNU General Public
|
|
8 | 8 | *
|
9 | 9 | * This program is distributed in the hope that it will be useful,
|
10 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
| -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | 12 | * General Public License for more details.
|
13 | 13 | *
|
14 | 14 | * You should have received a copy of the GNU General Public
|
@@ -65,13 +65,13 @@ public class Sequeler.Layouts.HeaderBar : Gtk.HeaderBar {
|
65 | 65 | mode_switch.active = true;
|
66 | 66 | }
|
67 | 67 |
|
68 |
| - var new_window_item = new_menuitem (_("New Window"), {"<Control>n"}); |
| 68 | + var new_window_item = new_menuitem (_("New Window"), "<Control>n"); |
69 | 69 | new_window_item.action_name = Sequeler.Services.ActionManager.ACTION_PREFIX + Sequeler.Services.ActionManager.ACTION_NEW_WINDOW;
|
70 | 70 |
|
71 |
| - var new_connection_item = new_menuitem (_("New Connection"), {"<Control><Shift>n"}); |
| 71 | + var new_connection_item = new_menuitem (_("New Connection"), "<Control><Shift>n"); |
72 | 72 | new_connection_item.action_name = Sequeler.Services.ActionManager.ACTION_PREFIX + Sequeler.Services.ActionManager.ACTION_NEW_CONNECTION;
|
73 | 73 |
|
74 |
| - var quit_item = new_menuitem (_("Quit"), {"<Control>q"}); |
| 74 | + var quit_item = new_menuitem (_("Quit"), "<Control>q"); |
75 | 75 | quit_item.action_name = Sequeler.Services.ActionManager.ACTION_PREFIX + Sequeler.Services.ActionManager.ACTION_QUIT;
|
76 | 76 |
|
77 | 77 | var menu_separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL);
|
@@ -109,29 +109,12 @@ public class Sequeler.Layouts.HeaderBar : Gtk.HeaderBar {
|
109 | 109 | pack_end (mode_switch);
|
110 | 110 | }
|
111 | 111 |
|
112 |
| - private Gtk.Button new_menuitem (string label, string[] accels) { |
113 |
| - var item_label = new Gtk.Label (label); |
114 |
| - item_label.halign = Gtk.Align.START; |
115 |
| - item_label.hexpand = true; |
116 |
| - item_label.margin_start = 6; |
117 |
| - |
118 |
| - var item_accel_label = new Gtk.Label (Granite.markup_accel_tooltip (accels)); |
119 |
| - item_accel_label.halign = Gtk.Align.END; |
120 |
| - item_accel_label.margin_end = item_accel_label.margin_start = 6; |
121 |
| - item_accel_label.use_markup = true; |
122 |
| - |
123 |
| - var item_grid = new Gtk.Grid (); |
124 |
| - item_grid.add (item_label); |
125 |
| - item_grid.add (item_accel_label); |
126 |
| - |
127 |
| - var item = new Gtk.Button (); |
128 |
| - item.add (item_grid); |
129 |
| - item.get_style_context ().add_class (Gtk.STYLE_CLASS_MENUITEM); |
130 |
| - item.clicked.connect (() => { |
131 |
| - menu_popover.hide (); |
132 |
| - }); |
| 112 | + private Gtk.ModelButton new_menuitem (string label, string accels) { |
| 113 | + var button = new Gtk.ModelButton (); |
| 114 | + button.get_child ().destroy (); |
| 115 | + button.add (new Granite.AccelLabel (label, accels)); |
133 | 116 |
|
134 |
| - return item; |
| 117 | + return button; |
135 | 118 | }
|
136 | 119 |
|
137 | 120 | public async void toggle_logout () {
|
|
0 commit comments