Initial version

This commit is contained in:
Gergely Polonkai 2014-10-13 16:13:52 +02:00
commit 5469e9a5a0
12 changed files with 318 additions and 0 deletions

38
.gitignore vendored Normal file
View File

@ -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

3
Makefile.am Normal file
View File

@ -0,0 +1,3 @@
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
SUBDIRS = src po

33
autogen.sh Executable file
View File

@ -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" "$@"

51
configure.ac Normal file
View File

@ -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}
"

4
po/POTFILES.in Normal file
View File

@ -0,0 +1,4 @@
src/application.vala
src/window.vala
src/main.vala
[type: gettext/glade]src/resources/ui/gg-window.ui

36
src/Makefile.am Normal file
View File

@ -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

63
src/application.vala Normal file
View File

@ -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 ("<Primary>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 ();
}
}
}

8
src/config.vapi Normal file
View File

@ -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;
}

9
src/main.vala Normal file
View File

@ -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);
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/eu/polonkai/gergely/gnome-gitlab">
<file>ui/gg-window.ui</file>
</gresource>
</gresources>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<template class="GnomeGitlabWindow" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="header_bar">
</object>
</child>
</template>
</interface>

55
src/window.vala Normal file
View File

@ -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);
}
}
}