[gnome-terminal] Add configure switch to disable s/key support
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] Add configure switch to disable s/key support
- Date: Tue, 10 Aug 2010 12:48:13 +0000 (UTC)
commit bc2a36db0589d7e2874b75a383372d9816d5ab06
Author: Christian Persch <chpe gnome org>
Date: Tue Aug 10 14:26:38 2010 +0200
Add configure switch to disable s/key support
configure.ac | 29 ++++++++++++++++++++++++++++-
src/Makefile.am | 11 +++++++++--
src/terminal-screen.c | 30 +++++++++++++++++++++---------
src/terminal-window.c | 7 ++++++-
4 files changed, 64 insertions(+), 13 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7445e83..8df8a19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,7 +82,10 @@ PKG_CHECK_MODULES([TERM],
gconf-2.0 >= $GCONF_REQUIRED
$PLATFORM_DEPS])
-# Check the smclient backend
+# ********
+# smclient
+# ********
+
SMCLIENT_PKGS=
AC_MSG_CHECKING([which smclient backend to use])
AC_ARG_WITH([smclient],
@@ -110,7 +113,10 @@ AM_CONDITIONAL([WITH_SMCLIENT_XSMP],[test "$with_smclient" = "xsmp"])
AM_CONDITIONAL([WITH_SMCLIENT_WIN32],[test "$with_smclient" = "win32"])
AM_CONDITIONAL([WITH_SMCLIENT_QUARTZ],[test "$with_smclient" = "quartz"])
+# *****
# GConf
+# *****
+
AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
if test x"$GCONFTOOL" = xno; then
@@ -129,6 +135,26 @@ if test "$GTK_BUILDER_CONVERT" = "false"; then
AC_MSG_ERROR([gtk-builder-convert not found])
fi
+# *****
+# S/Key
+# *****
+
+AC_MSG_CHECKING([whether to enable s/key support])
+AC_ARG_ENABLE([skey],
+ [AS_HELP_STRING([--disable-skey],[disable s/key support (default: enabled)])],
+ [],[enable_skey=yes])
+AC_MSG_RESULT([$enable_skey])
+
+if test "$enable_skey" = "yes"; then
+ AC_DEFINE([ENABLE_SKEY],[1],[Define if s/key support is enabled])
+fi
+
+AM_CONDITIONAL([ENABLE_SKEY],[test "$enable_skey" = "yes"])
+
+# *************
+# Documentation
+# *************
+
GNOME_DOC_INIT
# ****************************
@@ -165,4 +191,5 @@ gnome-terminal-$VERSION:
compiler: ${CC}
using smclient: ${with_smclient}
+ s/key support: ${enable_skey}
"
diff --git a/src/Makefile.am b/src/Makefile.am
index c05e85f..af271e6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,8 @@
NULL =
+if ENABLE_SKEY
SUBDIRS = skey
+endif
bin_PROGRAMS = gnome-terminal
@@ -16,8 +18,6 @@ gnome_terminal_SOURCES= \
eggshell.h \
profile-editor.c \
profile-editor.h \
- skey-popup.c \
- skey-popup.h \
terminal.c \
terminal-accels.c \
terminal-accels.h \
@@ -51,6 +51,13 @@ gnome_terminal_SOURCES= \
terminal-window.h \
$(NULL)
+if ENABLE_SKEY
+gnome_terminal_SOURCES += \
+ skey-popup.c \
+ skey-popup.h \
+ $(NULL)
+endif
+
nodist_gnome_terminal_SOURCES= $(BUILT_SOURCES)
gnome_terminal_CPPFLAGS = \
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index ed6647f..d70e834 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -1,6 +1,6 @@
/*
* Copyright © 2001 Havoc Pennington
- * Copyright © 2007, 2008 Christian Persch
+ * Copyright © 2007, 2008, 2010 Christian Persch
*
* Gnome-terminal is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -136,7 +136,6 @@ static char* terminal_screen_check_match (TerminalScreen *scree
int column,
int row,
int *flavor);
-static void terminal_screen_skey_match_remove (TerminalScreen *screen);
static guint signals[LAST_SIGNAL];
@@ -166,17 +165,22 @@ static const TerminalRegexPattern url_regex_patterns[] = {
{ "news:[[:alnum:]\\Q^_{|}~!\"#$%&'()*+,./;:=?`\\E]+", FLAVOR_AS_IS, G_REGEX_CASELESS },
};
+static GRegex **url_regexes;
+static TerminalURLFlavour *url_regex_flavors;
+static guint n_url_regexes;
+
+#ifdef ENABLE_SKEY
static const TerminalRegexPattern skey_regex_patterns[] = {
{ "s/key [[:digit:]]* [-[:alnum:]]*", FLAVOR_AS_IS },
{ "otp-[a-z0-9]* [[:digit:]]* [-[:alnum:]]*", FLAVOR_AS_IS },
};
-static GRegex **url_regexes;
-static TerminalURLFlavour *url_regex_flavors;
-static guint n_url_regexes;
static GRegex **skey_regexes;
static guint n_skey_regexes;
+static void terminal_screen_skey_match_remove (TerminalScreen *screen);
+#endif /* ENABLE_SKEY */
+
G_DEFINE_TYPE (TerminalScreen, terminal_screen, VTE_TYPE_TERMINAL)
static char *
@@ -597,8 +601,6 @@ terminal_screen_class_init (TerminalScreenClass *klass)
n_url_regexes = G_N_ELEMENTS (url_regex_patterns);
url_regexes = g_new0 (GRegex*, n_url_regexes);
url_regex_flavors = g_new0 (TerminalURLFlavour, n_url_regexes);
- n_skey_regexes = G_N_ELEMENTS (skey_regex_patterns);
- skey_regexes = g_new0 (GRegex*, n_skey_regexes);
for (i = 0; i < n_url_regexes; ++i)
{
@@ -616,6 +618,10 @@ terminal_screen_class_init (TerminalScreenClass *klass)
url_regex_flavors[i] = url_regex_patterns[i].flavor;
}
+#ifdef ENABLE_SKEY
+ n_skey_regexes = G_N_ELEMENTS (skey_regex_patterns);
+ skey_regexes = g_new0 (GRegex*, n_skey_regexes);
+
for (i = 0; i < n_skey_regexes; ++i)
{
GError *error = NULL;
@@ -627,6 +633,7 @@ terminal_screen_class_init (TerminalScreenClass *klass)
g_error_free (error);
}
}
+#endif /* ENABLE_SKEY */
/* This fixes bug #329827 */
app = terminal_app_get ();
@@ -966,6 +973,7 @@ terminal_screen_profile_notify_cb (TerminalProfile *profile,
vte_terminal_set_scrollback_lines (vte_terminal, lines);
}
+#ifdef ENABLE_SKEY
if (!prop_name || prop_name == I_(TERMINAL_PROFILE_USE_SKEY))
{
if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_SKEY))
@@ -989,6 +997,7 @@ terminal_screen_profile_notify_cb (TerminalProfile *profile,
terminal_screen_skey_match_remove (screen);
}
}
+#endif /* ENABLE_SKEY */
if (!prop_name ||
prop_name == I_(TERMINAL_PROFILE_BACKGROUND_TYPE) ||
@@ -1579,7 +1588,6 @@ terminal_screen_button_press (GtkWidget *widget,
GdkEventButton *event)
{
TerminalScreen *screen = TERMINAL_SCREEN (widget);
- TerminalScreenPrivate *priv = screen->priv;
gboolean (* button_press_event) (GtkWidget*, GdkEventButton*) =
GTK_WIDGET_CLASS (terminal_screen_parent_class)->button_press_event;
int char_width, char_height, row, col;
@@ -1606,8 +1614,10 @@ terminal_screen_button_press (GtkWidget *widget,
{
gboolean handled = FALSE;
+#ifdef ENABLE_SKEY
if (matched_flavor != FLAVOR_SKEY ||
- terminal_profile_get_property_boolean (priv->profile, TERMINAL_PROFILE_USE_SKEY))
+ terminal_profile_get_property_boolean (screen->priv->profile, TERMINAL_PROFILE_USE_SKEY))
+#endif
{
g_signal_emit (screen, signals[MATCH_CLICKED], 0,
matched_string,
@@ -2196,6 +2206,7 @@ terminal_screen_get_cell_size (TerminalScreen *screen,
*cell_height_pixels = vte_terminal_get_char_height (terminal);
}
+#ifdef ENABLE_SKEY
static void
terminal_screen_skey_match_remove (TerminalScreen *screen)
{
@@ -2217,6 +2228,7 @@ terminal_screen_skey_match_remove (TerminalScreen *screen)
l = next;
}
}
+#endif /* ENABLE_SKEY */
static char*
terminal_screen_check_match (TerminalScreen *screen,
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 8cd3191..899e77a 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -27,7 +27,6 @@
#endif
#include <gdk/gdkkeysyms.h>
-#include "skey-popup.h"
#include "terminal-accels.h"
#include "terminal-app.h"
#include "terminal-debug.h"
@@ -40,6 +39,10 @@
#include "terminal-util.h"
#include "terminal-window.h"
+#ifdef ENABLE_SKEY
+#include "skey-popup.h"
+#endif
+
struct _TerminalWindowPrivate
{
GtkActionGroup *action_group;
@@ -1387,9 +1390,11 @@ screen_match_clicked_cb (TerminalScreen *screen,
switch (flavour)
{
+#ifdef ENABLE_SKEY
case FLAVOR_SKEY:
terminal_skey_do_popup (GTK_WINDOW (window), screen, match);
break;
+#endif
default:
gtk_widget_grab_focus (GTK_WIDGET (screen));
terminal_util_open_url (GTK_WIDGET (window), match, flavour,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]