diff --git a/src/Makefile.am b/src/Makefile.am index 11333f9..ffcbba4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,6 +21,7 @@ gg-resources.c: $(res_src) $(resource_files) VALA_SOURCES = \ gg-application.vala \ gg-window.vala \ + gg-preferences.vala \ gg-main.vala gnome_gitlab_SOURCES = \ diff --git a/src/gg-application.vala b/src/gg-application.vala index fbe5f1a..9cfdec1 100644 --- a/src/gg-application.vala +++ b/src/gg-application.vala @@ -8,6 +8,7 @@ namespace GnomeGitlab }; const GLib.ActionEntry[] action_entries = { + { "preferences", on_preferences_activate }, { "quit", on_quit_activate } }; @@ -59,5 +60,12 @@ namespace GnomeGitlab { quit (); } + + void on_preferences_activate () + { + Preferences.show ((Window)get_active_window ()); + + return; + } } } diff --git a/src/gg-preferences.vala b/src/gg-preferences.vala new file mode 100644 index 0000000..667b389 --- /dev/null +++ b/src/gg-preferences.vala @@ -0,0 +1,28 @@ +namespace GnomeGitlab +{ + [GtkTemplate (ui = "/eu/polonkai/gergely/gnome-gitlab/ui/gg-preferences.ui")] + + public class Preferences : Gtk.Dialog + { + private static GLib.Once instance; + + private Preferences () { + response.connect (() => { + hide (); + }); + } + + public static void show (Window parent) + { + Preferences inst; + + inst = instance.once (() => { return new Preferences (); }); + + if (parent != inst.get_transient_for ()) { + inst.set_transient_for (parent); + } + + inst.present (); + } + } +} diff --git a/src/resources/gnome-gitlab.gresource.xml b/src/resources/gnome-gitlab.gresource.xml index 32ec4bc..718fbb8 100644 --- a/src/resources/gnome-gitlab.gresource.xml +++ b/src/resources/gnome-gitlab.gresource.xml @@ -2,5 +2,6 @@ ui/gg-window.ui + ui/gg-preferences.ui diff --git a/src/resources/ui/gg-preferences.ui b/src/resources/ui/gg-preferences.ui new file mode 100644 index 0000000..f01443c --- /dev/null +++ b/src/resources/ui/gg-preferences.ui @@ -0,0 +1,19 @@ + + + + + diff --git a/src/resources/ui/gg-window.ui b/src/resources/ui/gg-window.ui index ee1717d..3c2d9f2 100644 --- a/src/resources/ui/gg-window.ui +++ b/src/resources/ui/gg-window.ui @@ -38,6 +38,16 @@ True + + + Manage GitLab instances + app.preferences + + + False + False + + no-instances