Add app menu

parent f5df2195
......@@ -2,6 +2,48 @@
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkPopoverMenu" id="appmenu_popover">
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">app.new-window</property>
<property name="text" translatable="yes">Open new window</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">app.about</property>
<property name="text" translatable="yes">About Remotely</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="submenu">main</property>
</packing>
</child>
</object>
<object class="GtkPopoverMenu" id="connection_popover">
<property name="can_focus">False</property>
<child>
......@@ -202,6 +244,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="popover">appmenu_popover</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
......@@ -304,7 +347,6 @@
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
......
......@@ -18,13 +18,37 @@
int main (string[] args) {
var app = new Gtk.Application ("de.haeckerfelix.Remotely", ApplicationFlags.FLAGS_NONE);
app.activate.connect (() => {
var win = app.active_window;
if (win == null) {
win = new Remotely.Window (app);
}
win.present ();
});
var action = new GLib.SimpleAction ("about", null);
action.activate.connect (() => { show_about_dialog (app.active_window); });
app.add_action (action);
action = new GLib.SimpleAction ("new-window", null);
action.activate.connect (() => { new_window(app); });
app.add_action (action);
app.activate.connect (() => { new_window(app); });
return app.run (args);
}
private void new_window(Gtk.Application app){
var win = new Remotely.Window (app);
win.present ();
}
private void show_about_dialog(Gtk.Window window){
string[] authors = { "Felix Häcker <haeckerfelix@gnome.org>" };
string[] artists = { "Tobias Bernard" };
Gtk.show_about_dialog (window,
"artists", artists,
"authors", authors,
"program-name", "Remotely",
"license-type", Gtk.License.GPL_3_0,
"logo-icon-name", "de.haeckerfelix.Remotely",
"version", "1.0",
"comments", _("A simple VNC client"),
"website", "https://gitlab.gnome.org/World/Remotely ",
"website-label", _("Project Homepage"));
}
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