commit 5469e9a5a09b5160cbba75646af0e7d632b81fc4 Author: Gergely Polonkai Date: Mon Oct 13 16:13:52 2014 +0200 Initial version diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c5e799e --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +*~ +/src/*.c +/src/*.o +/src/.deps/ +/src/gnome-gitlab +/src/*.stamp + +Makefile +Makefile.in + +/libtool +/ABOUT-NLS +/aclocal.m4 +/compile +/autom4te.cache/ +/config.guess +/config.h +/config.h.in +/config.log +/config.rpath +/config.status +/config.sub +/configure +/depcomp +/install-sh +/m4/ +/missing +/ltmain.sh +/stamp-h1 + +/po/Makefile.in.in +/po/Makevars.template +/po/POTFILES +/po/Rules-quot +/po/*.sed +/po/*.header +/po/*.sin +/po/stamp-it \ No newline at end of file diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..47ff8cf --- /dev/null +++ b/Makefile.am @@ -0,0 +1,3 @@ +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} + +SUBDIRS = src po diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..7aa59cb --- /dev/null +++ b/autogen.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +test -n "$srcdir" || srcdir=`dirname "$0"` +test -n "$srcdir" || srcdir=. + +OLDDIR=`pwd` +cd $srcdir + +AUTORECONF=`which autoreconf` +if test -z $AUTORECONF; then + echo "*** No autoreconf found, please install it ***" + exit 1 +fi + +INTLTOOLIZE=`which intltoolize` +if test -z $INTLTOOLIZE; then + echo "*** No intltoolize found, please install the intltool package ***" + exit 1 +fi + +GNOMEDOC=`which yelp-build` +if test -z $GNOMEDOC; then + echo "*** The tools to build the documentation are not found," + echo " please intall the yelp-tools package ***" + exit 1 +fi + +autopoint --force || exit $? +AUTOPOINT='intltoolize --automake --copy' autoreconf --force --install --verbose + +cd $OLDDIR +test -n "$NOCONFIGURE" || "$srcdir/configure" "$@" diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..03b1741 --- /dev/null +++ b/configure.ac @@ -0,0 +1,51 @@ +AC_INIT([gnome-gitlab], [0.1], [gergely@polonkai.eu], [gnome-gitlab]) +AC_CONFIG_HEADERS([config.h]) +AM_INIT_AUTOMAKE([-Wall foreign]) +AM_SILENT_RULES([no]) +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_SRCDIR([src/main.vala]) +IT_PROG_INTLTOOL(0.40) +AM_GNU_GETTEXT([external]) +AM_GNU_GETTEXT_VERSION([0.17]) +GETTEXT_PACKAGE=AC_PACKAGE_NAME +AC_SUBST([GETTEXT_PACKAGE]) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The name of the gettext domain]) + +AC_PROG_CC +AC_PROG_CC_STDC +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AM_PROG_VALAC([0.23.3]) + +AC_PATH_PROG([GLIB_COMPILE_RESOURCES], glib-compile-resources) + +GLIB_GSETTINGS + +LT_INIT([disable-static]) + +PKG_PROG_PKG_CONFIG([0.22]) + +PKG_CHECK_MODULES(GITLAB, [ + glib-2.0 >= 2.39, + gtk+-3.0 >= 3.0 +]) + +YELP_HELP_INIT + +AC_CONFIG_FILES([ + Makefile + src/Makefile + po/Makefile.in +]) + +AC_OUTPUT + +echo " + gnome-gitlab ${VERSION} + + prefix: ${prefix} + Vala compiler: ${VALAC} + C compiler: ${CC} + + Now type 'make' to build ${PACKAGE} +" diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..f523ce4 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,4 @@ +src/application.vala +src/window.vala +src/main.vala +[type: gettext/glade]src/resources/ui/gg-window.ui \ No newline at end of file diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..07d8789 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,36 @@ +res_dir = $(srcdir)/resources +res_src = $(res_dir)/gnome-gitlab.gresource.xml +resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir=$(res_dir) $(res_src)) +AM_CPPFLAGS = \ + -DGETTEXT_PACKAGE=\""$(GETTEXT_PACKAGE)"\" \ + -DGNOMELOCALEDIR=\""$(localedir)"\" + +AM_VALAFLAGS = \ + --target-glib=2.38 \ + --pkg gtk+-3.0 \ + --gresources $(res_src) + +bin_PROGRAMS = gnome-gitlab +BUILT_SOURCES = \ + gl-resources.c + +gl-resources.c: $(res_src) $(resource_files) + $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)/resources --generate-source $< + +VALA_SOURCES = \ + application.vala \ + window.vala \ + main.vala + +gnome_gitlab_SOURCES = \ + $(BUILT_SOURCES) \ + $(VALA_SOURCES) \ + $(srcdir)/config.vapi + +AM_CFLAGS = \ + $(GITLAB_CFLAGS) \ + -Wall + +gnome_gitlab_LDADD = \ + $(GITLAB_LIBS) \ + -lm diff --git a/src/application.vala b/src/application.vala new file mode 100644 index 0000000..fbe5f1a --- /dev/null +++ b/src/application.vala @@ -0,0 +1,63 @@ +namespace GnomeGitlab +{ + public class Application : Gtk.Application + { + const OptionEntry[] option_entries = { + { "version", 'v', 0, OptionArg.NONE, null, N_("Print version information and exit"), null }, + { null } + }; + + const GLib.ActionEntry[] action_entries = { + { "quit", on_quit_activate } + }; + + private Window window; + + private void ensure_window () + { + if (window == null) { + window = new Window (this); + window.destroy.connect (() => { + window = null; + }); + } + } + + public Application () + { + Object (application_id: "eu.polonkai.gergely.gnome-gitlab"); + + add_main_option_entries (option_entries); + add_action_entries (action_entries, this); + } + + protected override void activate () + { + ensure_window (); + window.present (); + } + + protected override void startup () + { + base.startup (); + + add_accelerator ("n", "win.new", null); + } + + protected override int handle_local_options (GLib.VariantDict options) + { + if (options.contains("version")) { + print ("%s %s\n", Environment.get_application_name (), Config.VERSION); + + return 0; + } + + return -1; + } + + void on_quit_activate () + { + quit (); + } + } +} diff --git a/src/config.vapi b/src/config.vapi new file mode 100644 index 0000000..b286a75 --- /dev/null +++ b/src/config.vapi @@ -0,0 +1,8 @@ +[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")] +namespace Config { + public const string VERSION; + public const string GETTEXT_PACKAGE; + public const string GNOMELOCALEDIR; + public const string DATADIR; +} + diff --git a/src/main.vala b/src/main.vala new file mode 100644 index 0000000..925a564 --- /dev/null +++ b/src/main.vala @@ -0,0 +1,9 @@ +int +main (string[] args) +{ + Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.GNOMELOCALEDIR); + Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8"); + + var app = new GnomeGitlab.Application (); + return app.run (args); +} diff --git a/src/resources/gnome-gitlab.gresource.xml b/src/resources/gnome-gitlab.gresource.xml new file mode 100644 index 0000000..32ec4bc --- /dev/null +++ b/src/resources/gnome-gitlab.gresource.xml @@ -0,0 +1,6 @@ + + + + ui/gg-window.ui + + diff --git a/src/resources/ui/gg-window.ui b/src/resources/ui/gg-window.ui new file mode 100644 index 0000000..807fb34 --- /dev/null +++ b/src/resources/ui/gg-window.ui @@ -0,0 +1,12 @@ + + + + + + diff --git a/src/window.vala b/src/window.vala new file mode 100644 index 0000000..1bb30a4 --- /dev/null +++ b/src/window.vala @@ -0,0 +1,55 @@ +namespace GnomeGitlab +{ + [GtkTemplate (ui = "/eu/polonkai/gergely/gnome-gitlab/ui/gg-window.ui")] + + public class Window : Gtk.ApplicationWindow + { + private const GLib.ActionEntry[] action_entries = { + { "help", on_help_activate }, + { "about", on_about_activate }, + }; + + [GtkChild] + private Gtk.HeaderBar header_bar; + + public Window (Application app) + { + Object (application: app); + + add_action_entries (action_entries, this); + + show_all (); + } + + private void on_help_activate () + { + try { + Gtk.show_uri (get_screen (), "help:gnome-gitlab", Gtk.get_current_event_time ()); + } catch (Error e) { + warning (_("Failed to show help: %s"), e.message); + } + } + + private void on_about_activate () + { + const string copyright = "Copyright \xc2\xa9 2014 Gergely Polonkai\n"; + + const string authors[] = { + "Gergely Polonkai", + null + }; + + Gtk.show_about_dialog (this, + "program-name", _("Gnome Gitlab"), + "logo-icon-name", "gnome-gitlab", + "version", Config.VERSION, + "comments", _("GitLab frontend"), + "copyright", copyright, + "authors", authors, + "license-type", Gtk.License.GPL_3_0, + "wrap-license", false, + "translator-credits", _("translator-credits"), + null); + } + } +}