[gitg] Make use of shortcuts window optional
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Make use of shortcuts window optional
- Date: Sun, 31 Jan 2016 11:01:55 +0000 (UTC)
commit 3aa366423109d50b397e26bdfd2873713817880a
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Sun Jan 31 11:44:08 2016 +0100
Make use of shortcuts window optional
configure.ac | 24 ++++++++++++++++--------
gitg/Makefile.am | 4 ++++
gitg/gitg-application.vala | 17 ++++++++++++++++-
3 files changed, 36 insertions(+), 9 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1bdeb4d..4836345 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,14 +86,6 @@ AC_DEFINE_UNQUOTED(GITG_LIBDIR,"$GITG_LIBDIR", [lib dir])
AC_CHECK_LIB([m], [sinf])
-GLIB_REQUIRED_VERSION=2.38
-GTK_REQUIRED_VERSION=3.12.0
-GTKSOURCEVIEW_REQUIRED_VERSION=3.10
-INTROSPECTION_REQUIRED=0.10.1
-LIBGIT2_GLIB_REQUIRED_VERSION=0.23.5
-LIBGIT2_GLIB_REQUIRED_MAX_VERSION=0.24.0
-LIBXML_REQUIRED_VERSION=2.9.0
-
gdk_targets=`$PKG_CONFIG --variable=targets gdk-3.0`
for target in $gdk_targets;
@@ -137,6 +129,14 @@ esac
AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
+GLIB_REQUIRED_VERSION=2.38
+GTK_REQUIRED_VERSION=3.18.0
+GTKSOURCEVIEW_REQUIRED_VERSION=3.10
+INTROSPECTION_REQUIRED=0.10.1
+LIBGIT2_GLIB_REQUIRED_VERSION=0.23.5
+LIBGIT2_GLIB_REQUIRED_MAX_VERSION=0.24.0
+LIBXML_REQUIRED_VERSION=2.9.0
+
PKG_CHECK_MODULES(LIBGITG, [
gthread-2.0 >= $GLIB_REQUIRED_VERSION
glib-2.0 >= $GLIB_REQUIRED_VERSION
@@ -160,6 +160,14 @@ PKG_CHECK_MODULES(XML, [
libxml-2.0 >= $LIBXML_REQUIRED_VERSION
])
+GTK_SHORTCUTS_WINDOW_REQUIRED_VERSION=3.19
+
+PKG_CHECK_EXISTS(gtk+-3.0 >= $GTK_SHORTCUTS_WINDOW_REQUIRED_VERSION,
+ [gtk_shortcuts_window=yes],
+ [gtk_shortcuts_window=no])
+
+AM_CONDITIONAL(GTK_SHORTCUTS_WINDOW, test "$gtk_shortcuts_window" = "yes")
+
AC_SUBST(GIO_SYSTEM_PKG)
AM_CONDITIONAL(GDK_WINDOWING_X11, test "$gdk_windowing_x11" = "yes")
AM_CONDITIONAL(GDK_WINDOWING_QUARTZ, test "$gdk_windowing_quartz" = "yes")
diff --git a/gitg/Makefile.am b/gitg/Makefile.am
index cba3577..2ed44ee 100644
--- a/gitg/Makefile.am
+++ b/gitg/Makefile.am
@@ -31,6 +31,10 @@ gitg_gitg_VALAFLAGS = \
--vapidir "$(top_builddir)/libgitg-ext" \
--gresources "$(top_srcdir)/gitg/resources/gitg-resources.xml"
+if GTK_SHORTCUTS_WINDOW
+ gitg_gitg_VALAFLAGS += --define GTK_SHORTCUTS_WINDOW
+endif
+
gitg_gitg_LDADD = \
libgitg/libgitg-1.0.la \
libgitg-ext/libgitg-ext-1.0.la \
diff --git a/gitg/gitg-application.vala b/gitg/gitg-application.vala
index 9c8acab..8b6c426 100644
--- a/gitg/gitg-application.vala
+++ b/gitg/gitg-application.vala
@@ -69,7 +69,10 @@ public class Application : Gtk.Application
}
private PreferencesDialog d_preferences;
+
+#if GTK_SHORTCUTS_WINDOW
private Gtk.ShortcutsWindow d_shortcuts;
+#endif
static construct
{
@@ -271,6 +274,8 @@ public class Application : Gtk.Application
private void on_shortcuts_activated()
{
+#if GTK_SHORTCUTS_WINDOW
+
unowned List<Gtk.Window> wnds = get_windows();
// Create shortcuts window if needed
@@ -289,6 +294,7 @@ public class Application : Gtk.Application
}
d_shortcuts.present();
+#endif
}
private void on_app_author_details_global_activated()
@@ -310,9 +316,14 @@ public class Application : Gtk.Application
{"about", on_app_about_activated},
{"quit", on_app_quit_activated},
{"author-details-global", on_app_author_details_global_activated},
- {"preferences", on_preferences_activated},
+ {"preferences", on_preferences_activated}
+ };
+
+#if GTK_SHORTCUTS_WINDOW
+ private static const ActionEntry[] shortcut_window_entries = {
{"shortcuts", on_shortcuts_activated}
};
+#endif
struct Accel
{
@@ -371,6 +382,10 @@ public class Application : Gtk.Application
// Application menu entries
add_action_entries(app_entries, this);
+#if GTK_SHORTCUTS_WINDOW
+ add_action_entries(shortcut_window_entries, this);
+#endif
+
const Accel[] single_accels = {
{"app.new", "<Primary>N",},
{"app.quit", "<Primary>Q"},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]