[gnome-terminal] Start gsettings port
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] Start gsettings port
- Date: Thu, 3 May 2012 19:01:09 +0000 (UTC)
commit 2bff4b63ed3ceef6055e35563e9b0b33ad57349d
Author: Christian Persch <chpe gnome org>
Date: Wed May 4 20:25:35 2011 +0200
Start gsettings port
This introduces a couple of regressions, the most important one
being that there can only be one profile (supporting multi-profile
depends on gsettingslist in glib). Also, profile data migration
isn't working yet.
Makefile.am | 2 +
configure.ac | 43 +-
po/POTFILES.in | 2 +-
src/Makefile.am | 43 +-
src/extra-strings.c | 6 +-
src/gnome-terminal.schemas.in | 1285 ----------------
src/migration.c | 590 +++++++
src/org.gnome.Terminal.Preferences.gschema.xml.in | 310 ++++
src/profile-editor.c | 1017 +++++++------
src/profile-editor.h | 20 +-
src/profile-preferences.glade | 961 ++++--------
src/terminal-accels.c | 811 +++--------
src/terminal-accels.h | 12 +-
src/terminal-app.c | 739 +++-------
src/terminal-app.h | 65 +-
src/terminal-close-button.c | 42 +-
src/terminal-debug.c | 4 +-
src/terminal-debug.h | 4 +-
src/terminal-encoding.c | 40 +-
src/terminal-encoding.h | 12 +-
src/terminal-enums.h | 46 +
src/terminal-intl.h | 12 +-
src/terminal-options.c | 6 +-
src/terminal-profile.c | 1686 ---------------------
src/terminal-profile.h | 190 ---
src/terminal-schemas.h | 75 +
src/terminal-screen-container.c | 117 +--
src/terminal-screen-container.h | 12 +-
src/terminal-screen.c | 480 ++----
src/terminal-screen.h | 27 +-
src/terminal-search-dialog.c | 4 -
src/terminal-tabs-menu.c | 8 -
src/terminal-util.c | 480 ++----
src/terminal-util.h | 44 +-
src/terminal-window.c | 293 +---
src/terminal-window.h | 12 +-
src/terminal.c | 24 +-
src/terminal.xml | 2 +-
38 files changed, 2834 insertions(+), 6692 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 27547fd..abfc4c9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,6 +2,8 @@ SUBDIRS = src po help
NULL =
+ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}
+
DISTCHECK_CONFIGURE_FLAGS = \
--disable-scrollkeeper \
--disable-schemas-install \
diff --git a/configure.ac b/configure.ac
index 407dc01..cad379c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,26 +40,21 @@ GNOME_COMPILE_WARNINGS([maximum])
AM_GLIB_GNU_GETTEXT
GLIB_REQUIRED=2.26.0
-GIO_REQUIRED=2.26.0
-GCONF_REQUIRED=2.31.3
+GIO_REQUIRED=2.27.0
GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=0.1.0
AC_MSG_CHECKING([which gtk+ version to compile against])
AC_ARG_WITH([gtk],
- [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 3.0)])],
+ [AS_HELP_STRING([--with-gtk=3.0],[which gtk+ version to compile against (default: 3.0)])],
[case "$with_gtk" in
- 2.0|3.0) ;;
- *) AC_MSG_ERROR([invalid gtk version specified]) ;;
+ 3.0) ;;
+ 2.0) AC_MSG_ERROR([unsupported gtk version $with_gtk specified]) ;;
+ *) AC_MSG_ERROR([invalid gtk version $with_gtk specified]) ;;
esac],
[with_gtk=3.0])
AC_MSG_RESULT([$with_gtk])
case "$with_gtk" in
- 2.0) GTK_API_VERSION=2.0
- GTK_REQUIRED=2.18.0
- VTE_PC_VERSION=
- VTE_REQUIRED=0.26.0
- ;;
3.0) GTK_API_VERSION=3.0
GTK_REQUIRED=3.0.0
VTE_PC_VERSION=-2.90
@@ -69,7 +64,6 @@ esac
AC_MSG_CHECKING([for GDK target])
case "$with_gtk" in
- 2.0) GDK_TARGET="$($PKG_CONFIG --variable target gdk-$GTK_API_VERSION)" ;;
3.0) for target in $($PKG_CONFIG --variable targets gdk-$GTK_API_VERSION); do
GDK_TARGET="$target"
break
@@ -90,10 +84,15 @@ PKG_CHECK_MODULES([TERM],
gthread-2.0
gio-2.0 >= $GIO_REQUIRED
gtk+-$GTK_API_VERSION >= $GTK_REQUIRED
- gconf-2.0 >= $GCONF_REQUIRED
gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED
$PLATFORM_DEPS])
+# *********
+# GSettings
+# *********
+
+GLIB_GSETTINGS
+
# ********
# smclient
# ********
@@ -125,17 +124,20 @@ 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
-# *****
+# *************************
+# GConf-GSettings Migration
+# *************************
-AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
+GCONF_REQUIRED=2.31.3
-if test x"$GCONFTOOL" = xno; then
- AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
-fi
+PKG_CHECK_MODULES([MIGRATOR],[
+ gio-2.0 >= $GIO_REQUIRED
+ vte$VTE_PC_VERSION >= $VTE_REQUIRED
+ gconf-2.0 >= $GCONF_REQUIRED])
-AM_GCONF_SOURCE_2
+# ***********
+# Build tools
+# ***********
GLIB_GENMARSHAL="$($PKG_CONFIG --variable=glib_genmarshal glib-2.0)"
AC_SUBST([GLIB_GENMARSHAL])
@@ -149,7 +151,6 @@ if test "$GTK_BUILDER_CONVERT" = "false"; then
fi
case "$with_gtk" in
- 2.0) GTK_BUILDER_CONVERT_FLAGS="" ;;
3.0) GTK_BUILDER_CONVERT_FLAGS="--target-version=3.0" ;;
esac
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 5c5d8f3..c5766e7 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -5,7 +5,6 @@ gnome-terminal.desktop.in.in
src/eggsmclient.c
src/encodings-dialog.glade
src/find-dialog.glade
-src/gnome-terminal.schemas.in
src/keybinding-editor.glade
src/profile-editor.c
src/profile-manager.glade
@@ -24,3 +23,4 @@ src/terminal-tabs-menu.c
src/terminal-util.c
src/terminal-window.c
src/extra-strings.c
+src/org.gnome.Terminal.Preferences.gschema.xml.in
diff --git a/src/Makefile.am b/src/Makefile.am
index 789e48d..6d83a04 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,8 +30,7 @@ gnome_terminal_SOURCES= \
terminal-intl.h \
terminal-options.c \
terminal-options.h \
- terminal-profile.c \
- terminal-profile.h \
+ terminal-schemas.h \
terminal-screen.c \
terminal-screen.h \
terminal-screen-container.c \
@@ -105,7 +104,7 @@ endif
endif
TYPES_H_FILES = \
- terminal-profile.h \
+ terminal-enums.h \
$(NULL)
terminal-type-builtins.h: stamp-terminal-type-builtins.h
@@ -137,9 +136,27 @@ terminal-marshal.c: $(srcdir)/terminal-marshal.list
&& mv terminal-marshal.c.tmp terminal-marshal.c ) \
|| ( rm -f terminal-marshal.c.tmp && exit 1 )
-schemadir = $(GCONF_SCHEMA_FILE_DIR)
-schema_in_files = gnome-terminal.schemas.in
-schema_DATA = gnome-terminal.schemas
+
+migrationdir = $(libexecdir)/GConf/gsettings
+migration_PROGRAMS = gnome-terminal-migration
+
+gnome_terminal_migration_SOURCES = \
+ migration.c \
+ terminal-schemas.h \
+ terminal-type-builtins.c \
+ terminal-type-builtins.h \
+ $(NULL)
+
+gnome_terminal_migration_CPPFLAGS = \
+ $(AM_CPPFLAGS)
+gnome_terminal_migration_CFLAGS = \
+ $(MIGRATOR_CFLAGS) \
+ $(AM_CFLAGS)
+gnome_terminal_migration_LDFLAGS = \
+ $(AM_LDFLAGS)
+gnome_terminal_migration_LDADD = \
+ $(MIGRATOR_LIBS) \
+ $(INTLLIBS)
aboutdir = $(pkgdatadir)
about_DATA = \
@@ -163,11 +180,15 @@ builder_in_files = \
builderdir = $(pkgdatadir)
builder_DATA = $(builder_in_files:.glade=.ui)
+gsettingsschema_in_files = org.gnome.Terminal.Preferences.gschema.xml.in
+gsettings_SCHEMAS = $(gsettingsschema_in_files:.gschema.xml.in=.gschema.xml)
+
CLEANFILES = \
stamp-terminal-type-builtins.h \
gnome-terminal.schemas \
stamp-terminal-type-builtins.h \
$(builder_DATA) \
+ $(gsettings_SCHEMAS) \
$(BUILT_SOURCES)
EXTRA_DIST = \
@@ -176,17 +197,13 @@ EXTRA_DIST = \
terminal-type-builtins.h.template \
extra-strings.c \
$(about_DATA) \
- $(schema_in_files) \
$(uimanager_DATA) \
$(builder_in_files) \
+ $(gsettingsschema_in_files) \
$(NULL)
- INTLTOOL_SCHEMAS_RULE@
-
-if GCONF_SCHEMAS_INSTALL
-install-data-local:
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(top_builddir)/src/$(schema_DATA)
-endif
+ INTLTOOL_XML_NOMERGE_RULE@
+ GSETTINGS_RULES@
%.ui: %.glade
$(AM_V_GEN) $(GTK_BUILDER_CONVERT) $(GTK_BUILDER_CONVERT_FLAGS) $< $@
diff --git a/src/extra-strings.c b/src/extra-strings.c
index bab0bc4..88469a4 100644
--- a/src/extra-strings.c
+++ b/src/extra-strings.c
@@ -46,11 +46,11 @@ N_("Restart the command")
N_("Hold the terminal open")
/* Translators: Scrollbar is: ... */
-N_("On the left side")
+N_("Always visible")
/* Translators: Scrollbar is: ... */
-N_("On the right side")
+N_("Visible only when necessary")
/* Translators: Scrollbar is: ... */
-N_("Disabled")
+N_("Hidden")
/* Translators: When terminal commands set their own titles: ... */
N_("Replace initial title")
diff --git a/src/migration.c b/src/migration.c
new file mode 100644
index 0000000..f0e6337
--- /dev/null
+++ b/src/migration.c
@@ -0,0 +1,590 @@
+/*
+ * Copyright  2011 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Gnome-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <locale.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gconf/gconf-client.h>
+#include <vte/vte.h>
+
+#include "terminal-schemas.h"
+#include "terminal-type-builtins.h"
+
+static gboolean dry_run = FALSE;
+static gboolean verbose = FALSE;
+
+static const GOptionEntry options[] = {
+ { "dry-run", 0, 0, G_OPTION_ARG_NONE, &dry_run, NULL, NULL },
+ { "verbose", 0, 0, G_OPTION_ARG_NONE, &verbose, NULL, NULL },
+ { NULL }
+};
+
+#define ERROR_DOMAIN (g_intern_static_string ("gnome-terminal-migration-error"))
+
+enum {
+ ERROR_GENERIC
+};
+
+#define GCONF_PREFIX "/apps/gnome-terminal"
+#define GCONF_GLOBAL_PREFIX GCONF_PREFIX "/global"
+#define GCONF_PROFILES_PREFIX GCONF_PREFIX "/profiles"
+
+#define KEY_ALLOW_BOLD "allow_bold"
+#define KEY_BACKGROUND_COLOR "background_color"
+#define KEY_BACKGROUND_DARKNESS "background_darkness"
+#define KEY_BACKGROUND_IMAGE_FILE "background_image"
+#define KEY_BACKGROUND_TYPE "background_type"
+#define KEY_BACKSPACE_BINDING "backspace_binding"
+#define KEY_BOLD_COLOR "bold_color"
+#define KEY_BOLD_COLOR_SAME_AS_FG "bold_color_same_as_fg"
+#define KEY_CURSOR_BLINK_MODE "cursor_blink_mode"
+#define KEY_CURSOR_SHAPE "cursor_shape"
+#define KEY_CUSTOM_COMMAND "custom_command"
+#define KEY_DEFAULT_SHOW_MENUBAR "default_show_menubar"
+#define KEY_DEFAULT_SIZE_COLUMNS "default_size_columns"
+#define KEY_DEFAULT_SIZE_ROWS "default_size_rows"
+#define KEY_DELETE_BINDING "delete_binding"
+#define KEY_EXIT_ACTION "exit_action"
+#define KEY_FONT "font"
+#define KEY_FOREGROUND_COLOR "foreground_color"
+#define KEY_LOGIN_SHELL "login_shell"
+#define KEY_PALETTE "palette"
+#define KEY_SCROLL_BACKGROUND "scroll_background"
+#define KEY_SCROLLBACK_LINES "scrollback_lines"
+#define KEY_SCROLLBACK_UNLIMITED "scrollback_unlimited"
+#define KEY_SCROLLBAR_POSITION "scrollbar_position"
+#define KEY_SCROLL_ON_KEYSTROKE "scroll_on_keystroke"
+#define KEY_SCROLL_ON_OUTPUT "scroll_on_output"
+#define KEY_SILENT_BELL "silent_bell"
+#define KEY_TITLE_MODE "title_mode"
+#define KEY_TITLE "title"
+#define KEY_UPDATE_RECORDS "update_records"
+#define KEY_USE_CUSTOM_COMMAND "use_custom_command"
+#define KEY_USE_CUSTOM_DEFAULT_SIZE "use_custom_default_size"
+#define KEY_USE_SYSTEM_FONT "use_system_font"
+#define KEY_USE_THEME_COLORS "use_theme_colors"
+#define KEY_VISIBLE_NAME "visible_name"
+#define KEY_WORD_CHARS "word_chars"
+
+static const GConfEnumStringPair erase_binding_pairs[] = {
+ { VTE_ERASE_AUTO, "auto" },
+ { VTE_ERASE_ASCII_BACKSPACE, "control-h" },
+ { VTE_ERASE_ASCII_DELETE, "ascii-del" },
+ { VTE_ERASE_DELETE_SEQUENCE, "escape-sequence" },
+ { VTE_ERASE_TTY, "tty" },
+ { -1, NULL }
+};
+
+static const GConfEnumStringPair scrollbar_position_pairs[] = {
+ { GTK_POLICY_ALWAYS, "left" },
+ { GTK_POLICY_ALWAYS, "right" },
+ { GTK_POLICY_NEVER, "hidden" },
+ { -1, NULL }
+};
+
+static gboolean
+string_to_enum (GType type,
+ const char *s,
+ int *val)
+{
+ GEnumClass *klass;
+ GEnumValue *eval = NULL;
+ guint i;
+
+ klass = g_type_class_ref (type);
+ for (i = 0; i < klass->n_values; ++i) {
+ if (strcmp (klass->values[i].value_nick, s) != 0)
+ continue;
+
+ eval = &klass->values[i];
+ break;
+ }
+
+ if (eval)
+ *val = eval->value;
+
+ g_type_class_unref (klass);
+
+ return eval != NULL;
+}
+
+static void
+migrate_bool (GConfClient *client,
+ const char *gconf_path,
+ const char *gconf_key,
+ GSettings *settings,
+ const char *settings_key,
+ gboolean invert)
+{
+ GConfValue *value;
+ char *key;
+
+ key = gconf_concat_dir_and_key (gconf_path, gconf_key);
+ value = gconf_client_get_without_default (client, key, NULL);
+ g_free (key);
+
+ if (value != NULL &&
+ value->type == GCONF_VALUE_BOOL)
+ g_settings_set_boolean (settings, settings_key,
+ invert ? !gconf_value_get_bool (value)
+ : gconf_value_get_bool (value));
+
+ if (value)
+ gconf_value_free (value);
+}
+
+static void
+migrate_int (GConfClient *client,
+ const char *gconf_path,
+ const char *gconf_key,
+ GSettings *settings,
+ const char *settings_key)
+{
+ GConfValue *value;
+ char *key;
+
+ key = gconf_concat_dir_and_key (gconf_path, gconf_key);
+ value = gconf_client_get_without_default (client, key, NULL);
+ g_free (key);
+
+ if (value != NULL &&
+ value->type == GCONF_VALUE_INT)
+ g_settings_set_int (settings, settings_key, gconf_value_get_int (value));
+
+ if (value)
+ gconf_value_free (value);
+}
+
+static void
+migrate_string (GConfClient *client,
+ const char *gconf_path,
+ const char *gconf_key,
+ GSettings *settings,
+ const char *settings_key)
+{
+ GConfValue *value;
+ char *key;
+
+ key = gconf_concat_dir_and_key (gconf_path, gconf_key);
+ value = gconf_client_get_without_default (client, key, NULL);
+ g_free (key);
+
+ if (value != NULL &&
+ value->type == GCONF_VALUE_STRING)
+ g_settings_set_string (settings, settings_key, gconf_value_get_string (value));
+
+ if (value)
+ gconf_value_free (value);
+}
+
+static void
+migrate_string_list (GConfClient *client,
+ const char *gconf_path,
+ const char *gconf_key,
+ GSettings *settings,
+ const char *settings_key)
+{
+ GConfValue *value;
+ GVariantBuilder builder;
+ GSList *l;
+ char *key;
+
+ key = gconf_concat_dir_and_key (gconf_path, gconf_key);
+ value = gconf_client_get_without_default (client, key, NULL);
+ g_free (key);
+
+ if (value != NULL &&
+ value->type == GCONF_VALUE_LIST &&
+ gconf_value_get_list_type (value) == GCONF_VALUE_STRING) {
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("as"));
+
+ for (l = gconf_value_get_list (value); l != NULL; l = l->next)
+ g_variant_builder_add (&builder, "s", gconf_value_get_string (l->data));
+
+ g_settings_set (settings, settings_key, "as", &builder);
+ }
+
+ if (value)
+ gconf_value_free (value);
+}
+
+static void
+migrate_enum (GConfClient *client,
+ const char *gconf_path,
+ const char *gconf_key,
+ const GConfEnumStringPair *pairs,
+ GSettings *settings,
+ const char *settings_key)
+{
+ GConfValue *value;
+ int val;
+ char *key;
+
+ key = gconf_concat_dir_and_key (gconf_path, gconf_key);
+ value = gconf_client_get_without_default (client, key, NULL);
+ g_free (key);
+
+ if (value != NULL &&
+ value->type == GCONF_VALUE_STRING &&
+ gconf_string_to_enum ((GConfEnumStringPair*) pairs, gconf_value_get_string (value), &val))
+ g_settings_set_enum (settings, settings_key, val);
+
+ if (value)
+ gconf_value_free (value);
+}
+
+static void
+migrate_genum (GConfClient *client,
+ const char *gconf_path,
+ const char *gconf_key,
+ GSettings *settings,
+ const char *settings_key,
+ GType enum_type)
+{
+ GConfValue *value;
+ int val;
+ char *key;
+
+ key = gconf_concat_dir_and_key (gconf_path, gconf_key);
+ value = gconf_client_get_without_default (client, key, NULL);
+ g_free (key);
+
+ if (value != NULL &&
+ value->type == GCONF_VALUE_STRING &&
+ string_to_enum (enum_type, gconf_value_get_string (value), &val))
+ g_settings_set_enum (settings, settings_key, val);
+
+ if (value)
+ gconf_value_free (value);
+}
+
+static gboolean
+migrate_global_prefs (GError **error)
+{
+ GConfClient *client;
+ GSettings *settings;
+
+ settings = g_settings_new (TERMINAL_SETTING_SCHEMA);
+ client = gconf_client_get_default ();
+
+ migrate_bool (client, GCONF_GLOBAL_PREFIX, "confirm_window_close",
+ settings, TERMINAL_SETTING_CONFIRM_CLOSE_KEY,
+ FALSE);
+ migrate_bool (client, GCONF_GLOBAL_PREFIX, "use_mnemonics",
+ settings, TERMINAL_SETTING_ENABLE_MNEMONICS_KEY,
+ FALSE);
+ migrate_bool (client, GCONF_GLOBAL_PREFIX, "use_menu_accelerator",
+ settings, TERMINAL_SETTING_ENABLE_MENU_BAR_ACCEL_KEY,
+ FALSE);
+ migrate_string_list (client, GCONF_GLOBAL_PREFIX, "active_encodings",
+ settings, TERMINAL_SETTING_ENCODINGS_KEY);
+
+ g_object_unref (settings);
+ g_object_unref (client);
+
+ return TRUE;
+}
+
+static void
+migrate_profile (GConfClient *client,
+ const char *gconf_id,
+ int id,
+ GError **error)
+{
+ GSettings *settings;
+ char *path;
+
+ if (verbose)
+ g_print ("Migrating profile \"%s\"\n", gconf_id);
+
+ path = g_strdup_printf (PROFILES_PATH_PREFIX, "profile%d:/", id);
+ settings = g_settings_new_with_path (TERMINAL_PROFILE_SCHEMA, path);
+ g_free (path);
+
+ path = gconf_concat_dir_and_key (GCONF_PROFILES_PREFIX, gconf_id);
+
+ migrate_string (client, path, KEY_VISIBLE_NAME,
+ settings, TERMINAL_PROFILE_VISIBLE_NAME_KEY);
+ migrate_string (client, path, KEY_FOREGROUND_COLOR,
+ settings, TERMINAL_PROFILE_FOREGROUND_COLOR_KEY);
+ migrate_string (client, path, KEY_BACKGROUND_COLOR,
+ settings, TERMINAL_PROFILE_BACKGROUND_COLOR_KEY);
+ migrate_string (client, path, KEY_BOLD_COLOR,
+ settings, TERMINAL_PROFILE_BOLD_COLOR_KEY);
+ migrate_bool (client, path, KEY_BOLD_COLOR_SAME_AS_FG,
+ settings, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG_KEY,
+ FALSE);
+ migrate_genum (client, path, KEY_TITLE_MODE,
+ settings, TERMINAL_PROFILE_TITLE_MODE_KEY,
+ TERMINAL_TYPE_TITLE_MODE);
+ migrate_string (client, path, KEY_TITLE,
+ settings, TERMINAL_PROFILE_TITLE_KEY);
+ migrate_bool (client, path, KEY_ALLOW_BOLD,
+ settings, TERMINAL_PROFILE_ALLOW_BOLD_KEY,
+ FALSE);
+ migrate_bool (client, path, KEY_SILENT_BELL,
+ settings, TERMINAL_PROFILE_AUDIBLE_BELL_KEY,
+ TRUE);
+ migrate_string (client, path, KEY_WORD_CHARS,
+ settings, TERMINAL_PROFILE_WORD_CHARS_KEY);
+ migrate_bool (client, path, KEY_USE_CUSTOM_DEFAULT_SIZE,
+ settings, TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE_KEY,
+ FALSE);
+ migrate_int (client, path, KEY_DEFAULT_SIZE_COLUMNS,
+ settings, TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS_KEY);
+ migrate_int (client, path, KEY_DEFAULT_SIZE_ROWS,
+ settings, TERMINAL_PROFILE_DEFAULT_SIZE_ROWS_KEY);
+ migrate_enum (client, path, KEY_SCROLLBAR_POSITION,
+ scrollbar_position_pairs,
+ settings, TERMINAL_PROFILE_SCROLLBAR_POLICY_KEY);
+ { // FIX these as -1 == unlimited?
+ migrate_int (client, path, KEY_SCROLLBACK_LINES,
+ settings, TERMINAL_PROFILE_SCROLLBACK_LINES_KEY);
+ migrate_bool (client, path, KEY_SCROLLBACK_UNLIMITED,
+ settings, TERMINAL_PROFILE_SCROLLBACK_UNLIMITED_KEY,
+ FALSE);
+ }
+ migrate_bool (client, path, KEY_SCROLL_ON_KEYSTROKE,
+ settings, TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE_KEY,
+ FALSE);
+ migrate_bool (client, path, KEY_SCROLL_ON_OUTPUT,
+ settings, TERMINAL_PROFILE_SCROLL_ON_OUTPUT_KEY,
+ FALSE);
+ migrate_genum (client, path, KEY_EXIT_ACTION,
+ settings, TERMINAL_PROFILE_EXIT_ACTION_KEY,
+ TERMINAL_TYPE_EXIT_ACTION);
+ migrate_bool (client, path, KEY_LOGIN_SHELL,
+ settings, TERMINAL_PROFILE_LOGIN_SHELL_KEY,
+ FALSE);
+ migrate_bool (client, path, KEY_UPDATE_RECORDS,
+ settings, TERMINAL_PROFILE_UPDATE_RECORDS_KEY,
+ FALSE);
+ migrate_bool (client, path, KEY_USE_CUSTOM_COMMAND,
+ settings, TERMINAL_PROFILE_USE_CUSTOM_COMMAND_KEY,
+ FALSE);
+ migrate_string (client, path, KEY_CUSTOM_COMMAND,
+ settings, TERMINAL_PROFILE_CUSTOM_COMMAND_KEY);
+ migrate_genum (client, path, KEY_CURSOR_BLINK_MODE,
+ settings, TERMINAL_PROFILE_CURSOR_BLINK_MODE_KEY,
+ VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE);
+ migrate_genum (client, path, KEY_CURSOR_SHAPE,
+ settings, TERMINAL_PROFILE_CURSOR_SHAPE_KEY,
+ VTE_TYPE_TERMINAL_CURSOR_SHAPE);
+ migrate_string_list (client, path, KEY_PALETTE,
+ settings, TERMINAL_PROFILE_PALETTE_KEY);
+ migrate_string (client, path, KEY_FONT,
+ settings, TERMINAL_PROFILE_FONT_KEY);
+ migrate_enum (client, path, KEY_BACKSPACE_BINDING, erase_binding_pairs,
+ settings, TERMINAL_PROFILE_BACKSPACE_BINDING_KEY);
+ migrate_enum (client, path, KEY_DELETE_BINDING, erase_binding_pairs,
+ settings, TERMINAL_PROFILE_DELETE_BINDING_KEY);
+ migrate_bool (client, path, KEY_USE_THEME_COLORS,
+ settings, TERMINAL_PROFILE_USE_THEME_COLORS_KEY,
+ FALSE);
+ migrate_bool (client, path, KEY_USE_SYSTEM_FONT,
+ settings, TERMINAL_PROFILE_USE_SYSTEM_FONT_KEY,
+ FALSE);
+
+ g_free (path);
+ g_object_unref (settings);
+}
+
+static gboolean
+migrate_profiles (GError **error)
+{
+ GSettings *settings;
+ GConfClient *client;
+ GConfValue *value, *dvalue;
+ GSList *l;
+ char *path;
+ const char *profile, *default_profile = NULL;
+ int profile_nr;
+
+ client = gconf_client_get_default ();
+
+ dvalue = gconf_client_get_without_default (client, GCONF_GLOBAL_PREFIX "/default_profile", NULL);
+ if (dvalue != NULL &&
+ dvalue->type == GCONF_VALUE_STRING)
+ default_profile = gconf_value_get_string (dvalue);
+ if (default_profile) {
+ migrate_profile (client, default_profile, 0, error);
+
+ /* Some settings used to be per-profile but are now global;
+ * take these from the default profile.
+ */
+
+ settings = g_settings_new (TERMINAL_SETTING_SCHEMA);
+ path = gconf_concat_dir_and_key (GCONF_PROFILES_PREFIX, default_profile);
+
+ migrate_bool (client, path, KEY_DEFAULT_SHOW_MENUBAR,
+ settings, TERMINAL_SETTING_DEFAULT_SHOW_MENUBAR_KEY,
+ FALSE);
+
+ g_free (path);
+ g_object_unref (settings);
+ }
+
+ profile_nr = 0;
+
+ value = gconf_client_get (client, GCONF_GLOBAL_PREFIX "/profile_list", NULL);
+ if (value != NULL &&
+ value->type == GCONF_VALUE_LIST &&
+ gconf_value_get_list_type (value) == GCONF_VALUE_STRING) {
+ for (l = gconf_value_get_list (value); l != NULL; l = l->next) {
+ profile = gconf_value_get_string (l->data);
+
+ if (g_strcmp0 (profile, default_profile) != 0)
+ migrate_profile (client, profile, profile_nr++, error);
+ }
+ }
+
+ if (value)
+ gconf_value_free (value);
+ if (dvalue)
+ gconf_value_free (dvalue);
+ g_object_unref (client);
+
+ return TRUE;
+}
+
+static gboolean
+migrate_accels (GError **error)
+{
+ static const struct { const char *key; const char *path; } data[] = {
+ { "new_tab", "FileNewTab" },
+ { "new_window", "FileNewWindow" },
+ { "new_profile", "FileNewProfile" },
+ { "close_tab", "FileCloseTab" },
+ { "close_window", "FileCloseWindow"},
+ { "copy", "EditCopy" },
+ { "paste", "EditPaste" },
+ { "toggle_menubar", "ViewMenubar" },
+ { "full_screen", "ViewFullscreen" },
+ { "zoom_in", "ViewZoomIn" },
+ { "zoom_out", "ViewZoomOut" },
+ { "zoom_normal", "ViewZoom100" },
+ { "set_window_title", "TerminalSetTitle" },
+ { "reset", "TerminalReset" },
+ { "reset_and_clear", "TerminalResetClear" },
+ { "prev_tab", "TabsPrevious" },
+ { "next_tab", "TabsNext" },
+ { "move_tab_left", "TabsMoveLeft" },
+ { "move_tab_right", "TabsMoveRight" },
+ { "detach_tab", "TabsDetach" },
+ { "switch_to_tab_1", "TabsSwitch1" },
+ { "switch_to_tab_2", "TabsSwitch2" },
+ { "switch_to_tab_3", "TabsSwitch3" },
+ { "switch_to_tab_4", "TabsSwitch4" },
+ { "switch_to_tab_5", "TabsSwitch5" },
+ { "switch_to_tab_6", "TabsSwitch6" },
+ { "switch_to_tab_7", "TabsSwitch7" },
+ { "switch_to_tab_8", "TabsSwitch8" },
+ { "switch_to_tab_9", "TabsSwitch9" },
+ { "switch_to_tab_10", "TabsSwitch10" },
+ { "switch_to_tab_11", "TabsSwitch11" },
+ { "switch_to_tab_12", "TabsSwitch12" },
+ { "help", "HelpContents" }
+ };
+ GConfClient *client;
+ guint i;
+ char *key, *path;
+ GConfValue *value;
+ GString *str;
+
+ client = gconf_client_get_default ();
+ str = g_string_sized_new (1024);
+
+ for (i = 0; i < G_N_ELEMENTS (data); ++i) {
+ key = g_strdup_printf ("/apps/gnome-terminal/keybindings/%s", data[i].key);
+ path = g_strdup_printf ("<Actions>/Main/%s", data[i].path);
+
+ if ((value = gconf_client_get_without_default (client, key, NULL)) != NULL &&
+ value->type == GCONF_VALUE_STRING)
+ g_string_append_printf (str,
+ "(gtk_accel_path \"%s\" \"%s\")\n",
+ path, gconf_value_get_string (value));
+
+ g_free (key);
+ g_free (path);
+ if (value)
+ gconf_value_free (value);
+ }
+
+ path = g_build_filename (g_get_user_config_dir (),
+ "gnome-terminal",
+ NULL);
+ g_mkdir_with_parents (path, 0700);
+ g_free (path);
+
+ path = g_build_filename (g_get_user_config_dir (),
+ "gnome-terminal",
+ "accels",
+ NULL);
+ g_file_set_contents (path, str->str, str->len, NULL);
+ g_free (path);
+
+ g_string_free (str, TRUE);
+ g_object_unref (client);
+
+ return TRUE;
+}
+
+static gboolean
+migrate (GError **error)
+{
+ return migrate_global_prefs (error) &&
+ migrate_profiles (error) &&
+ migrate_accels (error);
+}
+
+int
+main (int argc,
+ char *argv[])
+{
+ GOptionContext *context;
+ GError *error = NULL;
+
+ setlocale (LC_ALL, "");
+
+ g_type_init ();
+
+ context = g_option_context_new ("");
+ g_option_context_add_main_entries (context, options, NULL);
+
+ if (!g_option_context_parse (context, &argc, &argv, &error)) {
+ g_option_context_free (context);
+ g_printerr ("Error parsing arguments: %s\n", error->message);
+ g_error_free (error);
+ return EXIT_FAILURE;
+ }
+ g_option_context_free (context);
+
+ if (!migrate (&error)) {
+ g_printerr ("Error: %s\n", error->message);
+ g_error_free (error);
+ return EXIT_FAILURE;
+ }
+
+ g_settings_sync ();
+
+ return EXIT_SUCCESS;
+}
diff --git a/src/org.gnome.Terminal.Preferences.gschema.xml.in b/src/org.gnome.Terminal.Preferences.gschema.xml.in
new file mode 100644
index 0000000..c3b15db
--- /dev/null
+++ b/src/org.gnome.Terminal.Preferences.gschema.xml.in
@@ -0,0 +1,310 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright  2002 Havoc Pennington
+ Copyright  2002 Jonathan Blandford
+ Copyright  2003, 2004 Mariano SuÃrez-Alvarez
+ Copyright  2005 Kjartan Maraas
+ Copyright  2005 Tony Tsui
+ Copyright  2006 Guilherme de S. Pastore
+ Copyright  2009, 2010 Behdad Esfahbod
+ Copyright  2008, 2010 Christian Persch
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ This program is distributed in the hope conf it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+-->
+<schemalist gettext-domain="gnome-terminal">
+
+ <enum id='org.gnome.Terminal.TitleMode'>
+ <value nick='replace' value='0'/>
+ <value nick='before' value='1'/>
+ <value nick='after' value='2'/>
+ <value nick='ignore' value='3'/>
+ </enum>
+
+ <enum id='org.gnome.Terminal.ScrollbarPolicy'>
+ <value nick='always' value='0'/>
+ <value nick='automatic' value='1'/>
+ <value nick='never' value='2'/>
+ </enum>
+
+ <enum id='org.gnome.Terminal.ExitAction'>
+ <value nick='close' value='0'/>
+ <value nick='restart' value='1'/>
+ <value nick='hold' value='2'/>
+ </enum>
+
+ <!-- These really belong into some vte-built enums file, but
+ using enums from other modules still has some
+ problems. Just include a copy here for now.
+ -->
+ <enum id='org.gnome.Terminal.EraseBinding'>
+ <value nick='auto' value='0'/>
+ <value nick='ascii-backspace' value='1'/>
+ <value nick='ascii-delete' value='2'/>
+ <value nick='delete-sequence' value='3'/>
+ <value nick='tty' value='4'/>
+ </enum>
+ <enum id='org.gnome.Terminal.Cursor.BlinkMode'>
+ <value nick='system' value='0'/>
+ <value nick='on' value='1'/>
+ <value nick='off' value='2'/>
+ </enum>
+ <enum id='org.gnome.Terminal.Cursor.Shape'>
+ <value nick='block' value='0'/>
+ <value nick='ibeam' value='1'/>
+ <value nick='underline' value='2'/>
+ </enum>
+
+ <!-- A terminal profile -->
+
+ <schema id="org.gnome.Terminal.Profile">
+ <key name="visible-name" type="s">
+ <default l10n="messages" context="visible-name">'Default'</default>
+ <_summary>Human-readable name of the profile</_summary>
+ <_description>Human-readable name of the profile.</_description>
+ </key>
+ <key name="foreground-color" type="s">
+ <default>'#000000'</default>
+ <_summary>Default color of text in the terminal</_summary>
+ <_description>Default color of text in the terminal, as a color specification (can be HTML-style hex digits, or a color name such as "red").</_description>
+ </key>
+ <key name="background-color" type="s">
+ <default>'#FFFFDD'</default>
+ <_summary>Default color of terminal background</_summary>
+ <_description>Default color of terminal background, as a color specification (can be HTML-style hex digits, or a color name such as "red").</_description>
+ </key>
+ <key name="bold-color" type="s">
+ <default>'#000000'</default>
+ <_summary>Default color of bold text in the terminal</_summary>
+ <_description>Default color of bold text in the terminal, as a color specification (can be HTML-style hex digits, or a color name such as "red"). This is ignored if bold_color_same_as_fg is true.</_description>
+ </key>
+ <key name="bold-color-same-as-fg" type="b">
+ <default>true</default>
+ <_summary>Whether bold text should use the same color as normal text</_summary>
+ <_description>If true, boldface text will be rendered using the same color as normal text.</_description>
+ </key>
+ <key name="title-mode" enum="org.gnome.Terminal.TitleMode">
+ <default>'replace'</default>
+ <_summary>What to do with dynamic title</_summary>
+ <_description>If the application in the terminal sets the title (most typically people have their shell set up to do this), the dynamically-set title can erase the configured title, go before it, go after it, or replace it. The possible values are "replace", "before", "after", and "ignore".</_description>
+ </key>
+ <key name="title" type="s">
+ <default l10n="messages" context="title">'Terminal'</default>
+ <_summary>Title for terminal</_summary>
+ <_description>Title to display for the terminal window or tab. This title may be replaced by or combined with the title set by the application inside the terminal, depending on the title_mode setting.</_description>
+ </key>
+ <key name="allow-bold" type="b">
+ <default>true</default>
+ <_summary>Whether to allow bold text</_summary>
+ <_description>If true, allow applications in the terminal to make text boldface.</_description>
+ </key>
+ <key name="audible-bell" type="b">
+ <default>true</default>
+ <_summary>Whether to ring the terminal bell</_summary>
+ </key>
+ <key name="word-chars" type="s">
+ <default>'-A-Za-z0-9,./?%&#:_=+ ~'</default>
+ <_summary>Characters that are considered "part of a word"</_summary>
+ <_description>When selecting text by word, sequences of these characters are considered single words. Ranges can be given as "A-Z". Literal hyphen (not expressing a range) should be the first character given.</_description>
+ </key>
+ <key name="default-show-menubar" type="b">
+ <default>true</default>
+ <_summary>Whether to show menubar in new windows/tabs</_summary>
+ <_description>True if the menubar should be shown in new window</_description>
+ </key>
+ <!-- FIXMEchpe!!! -->
+ <key name="use-custom-default-size" type="b">
+ <default>false</default>
+ <_summary>Whether to use custom terminal size for new windows</_summary>
+ <_description>If true, newly created terminal windows will have custom size specified by default_size_columns and default_size_rows.</_description>
+ </key>
+ <key name="default-size-columns" type="i">
+ <default>80</default>
+ <_summary>Default number of columns</_summary>
+ <_description>Number of columns in newly created terminal windows. Has no effect if use_custom_default_size is not enabled.</_description>
+ </key>
+ <key name="default-size-rows" type="i">
+ <default>24</default>
+ <_summary>Default number of rows</_summary>
+ <_description>Number of rows in newly created terminal windows. Has no effect if use_custom_default_size is not enabled.</_description>
+ </key>
+ <key name="scrollbar-policy" enum="org.gnome.Terminal.ScrollbarPolicy">
+ <default>'always'</default>
+ <_summary>When to show the scrollbar</_summary>
+ </key>
+ <key name="scrollback-lines" type="i">
+ <default>512</default>
+ <_summary>Number of lines to keep in scrollback</_summary>
+ <_description>Number of scrollback lines to keep around. You can scroll back in the terminal by this number of lines; lines that don't fit in the scrollback are discarded. If scrollback_unlimited is true, this value is ignored.</_description>
+ </key>
+ <key name="scrollback-unlimited" type="b">
+ <default>false</default>
+ <_summary>Whether an unlimited number of lines should be kept in scrollback</_summary>
+ <_description>If true, scrollback lines will never be discarded. The scrollback history is stored on disk temporarily, so this may cause the system to run out of disk space if there is a lot of output to the terminal.</_description>
+ </key>
+ <key name="scroll-on-keystroke" type="b">
+ <default>true</default>
+ <_summary>Whether to scroll to the bottom when a key is pressed</_summary>
+ <_description>If true, pressing a key jumps the scrollbar to the bottom.</_description>
+ </key>
+ <key name="scroll-on-output" type="b">
+ <default>false</default>
+ <_summary>Whether to scroll to the bottom when there's new output</_summary>
+ <_description>If true, whenever there's new output the terminal will scroll to the bottom.</_description>
+ </key>
+ <key name="exit-action" enum="org.gnome.Terminal.ExitAction">
+ <default>'close'</default>
+ <_summary>What to do with the terminal when the child command exits</_summary>
+ <_description>Possible values are "close" to close the terminal, and "restart" to restart the command.</_description>
+ </key>
+ <key name="login-shell" type="b">
+ <default>false</default>
+ <_summary>Whether to launch the command in the terminal as a login shell</_summary>
+ <_description>If true, the command inside the terminal will be launched as a login shell. (argv[0] will have a hyphen in front of it.)</_description>
+ </key>
+ <key name="update-records" type="b">
+ <default>true</default>
+ <_summary>Whether to update login records when launching terminal command</_summary>
+ <_description>If true, the system login records utmp and wtmp will be updated when the command inside the terminal is launched.</_description>
+ </key>
+ <key name="use-custom-command" type="b">
+ <default>false</default>
+ <_summary>Whether to run a custom command instead of the shell</_summary>
+ <_description>If true, the value of the custom_command setting will be used in place of running a shell.</_description>
+ </key>
+ <key name="cursor-blink-mode" enum="org.gnome.Terminal.Cursor.BlinkMode">
+ <default>'system'</default>
+ <_summary>Whether to blink the cursor</_summary>
+ <_description>The possible values are "system" to use the global cursor blinking settings, or "on" or "off" to set the mode explicitly.</_description>
+ </key>
+ <key name="cursor-shape" enum="org.gnome.Terminal.Cursor.Shape">
+ <default>'block'</default>
+ <_summary>The cursor appearance</_summary>
+ </key>
+ <key name="custom-command" type="s">
+ <default>''</default>
+ <_summary>Custom command to use instead of the shell</_summary>
+ <_description>Run this command in place of the shell, if use_custom_command is true.</_description>
+ </key>
+ <key name="palette" type="as">
+ <default>["#2E2E34343636",
+ "#CCCC00000000",
+ "#4E4E9A9A0606",
+ "#C4C4A0A00000",
+ "#34346565A4A4",
+ "#757550507B7B",
+ "#060698209A9A",
+ "#D3D3D7D7CFCF",
+ "#555557575353",
+ "#EFEF29292929",
+ "#8A8AE2E23434",
+ "#FCFCE9E94F4F",
+ "#72729F9FCFCF",
+ "#ADAD7F7FA8A8",
+ "#3434E2E2E2E2",
+ "#EEEEEEEEECEC"]</default>
+ <_summary>Palette for terminal applications</_summary>
+ </key>
+ <key name="font" type="s">
+ <default>'Monospace 12'</default>
+ <_summary>A pango font name and size</_summary>
+ </key>
+ <key name="backspace-binding" enum="org.gnome.Terminal.EraseBinding">
+ <default>'ascii-delete'</default>
+ <_summary>The code sequence the Backspace key generates</_summary>
+ </key>
+ <key name="delete-binding" enum="org.gnome.Terminal.EraseBinding">
+ <default>'delete-sequence'</default>
+ <_summary>The code sequence the Delete key generates</_summary>
+ </key>
+ <key name="use-theme-colors" type="b">
+ <default>true</default>
+ <_summary>Whether to use the colors from the theme for the terminal widget</_summary>
+ </key>
+ <key name="use-system-font" type="b">
+ <default>true</default>
+ <_summary>Whether to use the system monospace font</_summary>
+ </key>
+ </schema>
+
+ <!-- Profiles list -->
+
+ <!--
+ <schema id="org.gnome.Terminal.Profiles" list-of="org.gnome.Terminal.Profile" />
+ -->
+
+ <!-- Global settings -->
+
+ <schema id="org.gnome.Terminal.Settings" path="/org/gnome/terminal/">
+
+ <key name="mnemonics-enabled" type="b">
+ <default>false</default>
+ <_summary>Whether the menubar has access keys</_summary>
+ <_description>
+ Whether to have Alt+letter access keys for the menubar.
+ They may interfere with some applications run inside the terminal
+ so it's possible to turn them off.
+ </_description>
+ </key>
+
+ <key name="menu-accelerator-enabled" type="b">
+ <default>false</default>
+ <_summary>Whether the standard GTK shortcut for menubar access is enabled</_summary>
+ <_description>
+ Normally you can access the menubar with F10. This can also
+ be customized via gtkrc (gtk-menu-bar-accel =
+ "whatever"). This option allows the standard menubar
+ accelerator to be disabled.
+ </_description>
+ </key>
+
+ <key name="encodings" type="as">
+ <!-- Translators: Please note that this has to be a list of
+ valid encodings (which are to be taken from the list in src/encoding.c).
+ It has to include UTF-8 and the word 'current', which is not to be
+ translated. This is provided for customization of the default encoding
+ menu; see bug 144810 for an use case. In most cases, this should be
+ left alone.
+ -->
+ <default>["UTF-8", "current"]</default>
+ <_summary>List of available encodings</_summary>
+ <_description>
+ A subset of possible encodings are presented in
+ the Encoding submenu. This is a list of encodings
+ to appear there. The special encoding name "current"
+ means to display the encoding of the current locale.
+ </_description>
+ </key>
+
+ <key name="confirm-close" type="b">
+ <default>true</default>
+ <_summary>Whether to ask for confirmation before closing a terminal</_summary>
+ </key>
+
+ <key name="default-show-menubar" type="b">
+ <default>true</default>
+ <_summary>Whether to show the menubar in new windows</_summary>
+ </key>
+
+ <!--
+ <child name="profiles" schema="org.gnome.Terminal.Profiles" >
+ <child name="profile0" schema="org.gnome.Terminal.Profile">
+ <override name="visible-name">"Default Profile"</override>
+ </child>
+ </child>
+ -->
+
+ </schema>
+
+</schemalist>
diff --git a/src/profile-editor.c b/src/profile-editor.c
index 4f88f3b..dde34fe 100644
--- a/src/profile-editor.c
+++ b/src/profile-editor.c
@@ -1,7 +1,7 @@
/*
* Copyright  2002 Havoc Pennington
* Copyright  2002 Mathias Hasselmann
- * Copyright  2008 Christian Persch
+ * Copyright  2008, 2011 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
@@ -25,8 +25,11 @@
#include <glib.h>
#include <gio/gio.h>
+#include "terminal-enums.h"
#include "terminal-intl.h"
#include "profile-editor.h"
+#include "terminal-schemas.h"
+#include "terminal-type-builtins.h"
#include "terminal-util.h"
typedef struct _TerminalColorScheme TerminalColorScheme;
@@ -51,272 +54,171 @@ static const TerminalColorScheme color_schemes[] = {
{ 0, 0xFFFF, 0xFFFF, 0xFFFF }, { 0, 0x0000, 0x0000, 0x0000 } }
};
-static void profile_forgotten_cb (TerminalProfile *profile,
- GtkWidget *editor);
+#define TERMINAL_PALETTE_SIZE (16)
-static void profile_notify_sensitivity_cb (TerminalProfile *profile,
- GParamSpec *pspec,
- GtkWidget *editor);
+enum
+{
+ TERMINAL_PALETTE_TANGO = 0,
+ TERMINAL_PALETTE_LINUX = 1,
+ TERMINAL_PALETTE_XTERM = 2,
+ TERMINAL_PALETTE_RXVT = 3,
+ TERMINAL_PALETTE_N_BUILTINS
+};
-static void profile_colors_notify_scheme_combo_cb (TerminalProfile *profile,
- GParamSpec *pspec,
+static const GdkColor terminal_palettes[TERMINAL_PALETTE_N_BUILTINS][TERMINAL_PALETTE_SIZE] =
+{
+ /* Tango palette */
+ {
+ { 0, 0x0000, 0x0000, 0x0000 },
+ { 0, 0xcccc, 0x0000, 0x0000 },
+ { 0, 0x4e4e, 0x9a9a, 0x0606 },
+ { 0, 0xc4c4, 0xa0a0, 0x0000 },
+ { 0, 0x3434, 0x6565, 0xa4a4 },
+ { 0, 0x7575, 0x5050, 0x7b7b },
+ { 0, 0x0606, 0x9820, 0x9a9a },
+ { 0, 0xd3d3, 0xd7d7, 0xcfcf },
+ { 0, 0x5555, 0x5757, 0x5353 },
+ { 0, 0xefef, 0x2929, 0x2929 },
+ { 0, 0x8a8a, 0xe2e2, 0x3434 },
+ { 0, 0xfcfc, 0xe9e9, 0x4f4f },
+ { 0, 0x7272, 0x9f9f, 0xcfcf },
+ { 0, 0xadad, 0x7f7f, 0xa8a8 },
+ { 0, 0x3434, 0xe2e2, 0xe2e2 },
+ { 0, 0xeeee, 0xeeee, 0xecec }
+ },
+
+ /* Linux palette */
+ {
+ { 0, 0x0000, 0x0000, 0x0000 },
+ { 0, 0xaaaa, 0x0000, 0x0000 },
+ { 0, 0x0000, 0xaaaa, 0x0000 },
+ { 0, 0xaaaa, 0x5555, 0x0000 },
+ { 0, 0x0000, 0x0000, 0xaaaa },
+ { 0, 0xaaaa, 0x0000, 0xaaaa },
+ { 0, 0x0000, 0xaaaa, 0xaaaa },
+ { 0, 0xaaaa, 0xaaaa, 0xaaaa },
+ { 0, 0x5555, 0x5555, 0x5555 },
+ { 0, 0xffff, 0x5555, 0x5555 },
+ { 0, 0x5555, 0xffff, 0x5555 },
+ { 0, 0xffff, 0xffff, 0x5555 },
+ { 0, 0x5555, 0x5555, 0xffff },
+ { 0, 0xffff, 0x5555, 0xffff },
+ { 0, 0x5555, 0xffff, 0xffff },
+ { 0, 0xffff, 0xffff, 0xffff }
+ },
+
+ /* XTerm palette */
+ {
+ { 0, 0x0000, 0x0000, 0x0000 },
+ { 0, 0xcdcb, 0x0000, 0x0000 },
+ { 0, 0x0000, 0xcdcb, 0x0000 },
+ { 0, 0xcdcb, 0xcdcb, 0x0000 },
+ { 0, 0x1e1a, 0x908f, 0xffff },
+ { 0, 0xcdcb, 0x0000, 0xcdcb },
+ { 0, 0x0000, 0xcdcb, 0xcdcb },
+ { 0, 0xe5e2, 0xe5e2, 0xe5e2 },
+ { 0, 0x4ccc, 0x4ccc, 0x4ccc },
+ { 0, 0xffff, 0x0000, 0x0000 },
+ { 0, 0x0000, 0xffff, 0x0000 },
+ { 0, 0xffff, 0xffff, 0x0000 },
+ { 0, 0x4645, 0x8281, 0xb4ae },
+ { 0, 0xffff, 0x0000, 0xffff },
+ { 0, 0x0000, 0xffff, 0xffff },
+ { 0, 0xffff, 0xffff, 0xffff }
+ },
+
+ /* RXVT palette */
+ {
+ { 0, 0x0000, 0x0000, 0x0000 },
+ { 0, 0xcdcd, 0x0000, 0x0000 },
+ { 0, 0x0000, 0xcdcd, 0x0000 },
+ { 0, 0xcdcd, 0xcdcd, 0x0000 },
+ { 0, 0x0000, 0x0000, 0xcdcd },
+ { 0, 0xcdcd, 0x0000, 0xcdcd },
+ { 0, 0x0000, 0xcdcd, 0xcdcd },
+ { 0, 0xfafa, 0xebeb, 0xd7d7 },
+ { 0, 0x4040, 0x4040, 0x4040 },
+ { 0, 0xffff, 0x0000, 0x0000 },
+ { 0, 0x0000, 0xffff, 0x0000 },
+ { 0, 0xffff, 0xffff, 0x0000 },
+ { 0, 0x0000, 0x0000, 0xffff },
+ { 0, 0xffff, 0x0000, 0xffff },
+ { 0, 0x0000, 0xffff, 0xffff },
+ { 0, 0xffff, 0xffff, 0xffff }
+ }
+};
+
+static void profile_colors_notify_scheme_combo_cb (GSettings *profile,
+ const char *key,
GtkComboBox *combo);
-static void profile_palette_notify_scheme_combo_cb (TerminalProfile *profile,
- GParamSpec *pspec,
+static void profile_palette_notify_scheme_combo_cb (GSettings *profile,
+ const char *key,
GtkComboBox *combo);
-static void profile_palette_notify_colorpickers_cb (TerminalProfile *profile,
- GParamSpec *pspec,
+static void profile_palette_notify_colorpickers_cb (GSettings *profile,
+ const char *key,
GtkWidget *editor);
-static GtkWidget*
-profile_editor_get_widget (GtkWidget *editor,
- const char *widget_name)
-{
- GtkBuilder *builder;
-
- builder = g_object_get_data (G_OBJECT (editor), "builder");
- g_assert (builder != NULL);
-
- return (GtkWidget *) gtk_builder_get_object (builder, widget_name);
-}
-
-static void
-widget_and_labels_set_sensitive (GtkWidget *widget, gboolean sensitive)
+static gboolean
+palette_cmp (const GdkColor *ca,
+ const GdkColor *cb)
{
- GList *labels, *i;
+ guint i;
- labels = gtk_widget_list_mnemonic_labels (widget);
- for (i = labels; i; i = i->next)
- {
- gtk_widget_set_sensitive (GTK_WIDGET (i->data), sensitive);
- }
- g_list_free (labels);
+ for (i = 0; i < TERMINAL_PALETTE_SIZE; ++i)
+ if (!gdk_color_equal (&ca[i], &cb[i]))
+ return FALSE;
- gtk_widget_set_sensitive (widget, sensitive);
+ return TRUE;
}
-static void
-profile_forgotten_cb (TerminalProfile *profile,
- GtkWidget *editor)
+static gboolean
+palette_is_builtin (GdkColor *colors,
+ gsize n_colors,
+ guint *n)
{
- gtk_widget_destroy (editor);
-}
-
-static void
-profile_notify_sensitivity_cb (TerminalProfile *profile,
- GParamSpec *pspec,
- GtkWidget *editor)
-{
- TerminalBackgroundType bg_type;
- const char *prop_name;
-
- if (pspec)
- prop_name = pspec->name;
- else
- prop_name = NULL;
-
-#define SET_SENSITIVE(name, setting) widget_and_labels_set_sensitive (profile_editor_get_widget (editor, name), setting)
+ guint i;
- if (!prop_name ||
- prop_name == I_(TERMINAL_PROFILE_USE_CUSTOM_COMMAND) ||
- prop_name == I_(TERMINAL_PROFILE_CUSTOM_COMMAND))
- {
- gboolean use_custom_command_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_USE_CUSTOM_COMMAND);
- SET_SENSITIVE ("use-custom-command-checkbutton", !use_custom_command_locked);
- SET_SENSITIVE ("custom-command-box",
- terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_CUSTOM_COMMAND) &&
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_CUSTOM_COMMAND));
- }
+ if (n_colors != TERMINAL_PALETTE_SIZE)
+ return FALSE;
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_BACKGROUND_TYPE))
+ for (i = 0; i < TERMINAL_PALETTE_N_BUILTINS; ++i)
{
- gboolean bg_type_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_BACKGROUND_TYPE);
- SET_SENSITIVE ("solid-radiobutton", !bg_type_locked);
- SET_SENSITIVE ("image-radiobutton", !bg_type_locked);
- SET_SENSITIVE ("transparent-radiobutton", !bg_type_locked);
-
- bg_type = terminal_profile_get_property_enum (profile, TERMINAL_PROFILE_BACKGROUND_TYPE);
- if (bg_type == TERMINAL_BACKGROUND_IMAGE)
+ if (palette_cmp (colors, terminal_palettes[i]))
{
- SET_SENSITIVE ("background-image-filechooser", !terminal_profile_property_locked (profile, TERMINAL_PROFILE_BACKGROUND_IMAGE_FILE));
- SET_SENSITIVE ("scroll-background-checkbutton", !terminal_profile_property_locked (profile, TERMINAL_PROFILE_SCROLL_BACKGROUND));
- SET_SENSITIVE ("darken-background-vbox", !terminal_profile_property_locked (profile, TERMINAL_PROFILE_BACKGROUND_DARKNESS));
+ *n = i;
+ return TRUE;
}
- else if (bg_type == TERMINAL_BACKGROUND_TRANSPARENT)
- {
- SET_SENSITIVE ("background-image-filechooser", FALSE);
- SET_SENSITIVE ("scroll-background-checkbutton", FALSE);
- SET_SENSITIVE ("darken-background-vbox", !terminal_profile_property_locked (profile, TERMINAL_PROFILE_BACKGROUND_DARKNESS));
- }
- else
- {
- SET_SENSITIVE ("background-image-filechooser", FALSE);
- SET_SENSITIVE ("scroll-background-checkbutton", FALSE);
- SET_SENSITIVE ("darken-background-vbox", FALSE);
- }
- }
-
- if (!prop_name ||
- prop_name == I_(TERMINAL_PROFILE_USE_SYSTEM_FONT) ||
- prop_name == I_(TERMINAL_PROFILE_FONT))
- {
- SET_SENSITIVE ("font-hbox",
- !terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_SYSTEM_FONT) &&
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_FONT));
- SET_SENSITIVE ("system-font-checkbutton",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_USE_SYSTEM_FONT));
- }
-
- if (!prop_name ||
- prop_name == I_(TERMINAL_PROFILE_FOREGROUND_COLOR) ||
- prop_name == I_(TERMINAL_PROFILE_BACKGROUND_COLOR) ||
- prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR) ||
- prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG) ||
- prop_name == I_(TERMINAL_PROFILE_USE_THEME_COLORS))
- {
- gboolean bg_locked, use_theme_colors, fg_locked;
-
- use_theme_colors = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_THEME_COLORS);
- fg_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_FOREGROUND_COLOR);
- bg_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_BACKGROUND_COLOR);
-
- SET_SENSITIVE ("foreground-colorpicker", !use_theme_colors && !fg_locked);
- SET_SENSITIVE ("foreground-colorpicker-label", !use_theme_colors && !fg_locked);
- SET_SENSITIVE ("background-colorpicker", !use_theme_colors && !bg_locked);
- SET_SENSITIVE ("background-colorpicker-label", !use_theme_colors && !bg_locked);
- SET_SENSITIVE ("color-scheme-combobox", !use_theme_colors && !fg_locked && !bg_locked);
- SET_SENSITIVE ("color-scheme-combobox-label", !use_theme_colors && !fg_locked && !bg_locked);
- }
-
- if (!prop_name ||
- prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR) ||
- prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG) ||
- prop_name == I_(TERMINAL_PROFILE_USE_THEME_COLORS))
- {
- gboolean bold_locked, bold_same_as_fg_locked, bold_same_as_fg, use_theme_colors;
-
- use_theme_colors = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_THEME_COLORS);
- bold_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_BOLD_COLOR);
- bold_same_as_fg_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG);
- bold_same_as_fg = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG);
-
- SET_SENSITIVE ("bold-color-same-as-fg-checkbox", !use_theme_colors && !bold_same_as_fg_locked);
- SET_SENSITIVE ("bold-colorpicker", !use_theme_colors && !bold_locked && !bold_same_as_fg);
- SET_SENSITIVE ("bold-colorpicker-label", !use_theme_colors && ((!bold_same_as_fg && !bold_locked) || !bold_same_as_fg_locked));
- }
-
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_VISIBLE_NAME))
- SET_SENSITIVE ("profile-name-entry",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_VISIBLE_NAME));
-
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_DEFAULT_SHOW_MENUBAR))
- SET_SENSITIVE ("show-menubar-checkbutton",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_DEFAULT_SHOW_MENUBAR));
-
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_TITLE))
- SET_SENSITIVE ("title-entry",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_TITLE));
-
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_TITLE_MODE))
- SET_SENSITIVE ("title-mode-combobox",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_TITLE_MODE));
-
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_ALLOW_BOLD))
- SET_SENSITIVE ("allow-bold-checkbutton",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_ALLOW_BOLD));
-
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SILENT_BELL))
- SET_SENSITIVE ("bell-checkbutton",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_SILENT_BELL));
-
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_WORD_CHARS))
- SET_SENSITIVE ("word-chars-entry",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_WORD_CHARS));
-
- if (!prop_name ||
- prop_name == I_(TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE) ||
- prop_name == I_(TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS) ||
- prop_name == I_(TERMINAL_PROFILE_DEFAULT_SIZE_ROWS))
- {
- gboolean use_custom_default_size_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE);
- gboolean use_custom_default_size = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE);
- gboolean columns_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS);
- gboolean rows_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_DEFAULT_SIZE_ROWS);
-
- SET_SENSITIVE ("use-custom-default-size-checkbutton", !use_custom_default_size_locked);
- SET_SENSITIVE ("default-size-hbox", use_custom_default_size);
- SET_SENSITIVE ("default-size-label", (!columns_locked || !rows_locked));
- SET_SENSITIVE ("default-size-columns-label", !columns_locked);
- SET_SENSITIVE ("default-size-columns-spinbutton", !columns_locked);
- SET_SENSITIVE ("default-size-rows-label", !rows_locked);
- SET_SENSITIVE ("default-size-rows-spinbutton", !rows_locked);
- }
-
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLLBAR_POSITION))
- SET_SENSITIVE ("scrollbar-position-combobox",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_SCROLLBAR_POSITION));
-
- if (!prop_name ||
- prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_LINES) ||
- prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_UNLIMITED))
- {
- gboolean scrollback_lines_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_SCROLLBACK_LINES);
- gboolean scrollback_unlimited_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_SCROLLBACK_UNLIMITED);
- gboolean scrollback_unlimited = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SCROLLBACK_UNLIMITED);
-
- SET_SENSITIVE ("scrollback-label", !scrollback_lines_locked);
- SET_SENSITIVE ("scrollback-box", !scrollback_lines_locked && !scrollback_unlimited);
- SET_SENSITIVE ("scrollback-unlimited-checkbutton", !scrollback_lines_locked && !scrollback_unlimited_locked);
}
-
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE))
- SET_SENSITIVE ("scroll-on-keystroke-checkbutton",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE));
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLL_ON_OUTPUT))
- SET_SENSITIVE ("scroll-on-output-checkbutton",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_SCROLL_ON_OUTPUT));
-
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_EXIT_ACTION))
- SET_SENSITIVE ("exit-action-combobox",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_EXIT_ACTION));
+ return FALSE;
+}
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_LOGIN_SHELL))
- SET_SENSITIVE ("login-shell-checkbutton",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_LOGIN_SHELL));
+static void
+modify_palette_entry (GSettings *profile,
+ guint i,
+ const GdkColor *color)
+{
+ GdkColor *colors;
+ gsize n_colors;
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_UPDATE_RECORDS))
- SET_SENSITIVE ("update-records-checkbutton",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_UPDATE_RECORDS));
+ colors = terminal_g_settings_get_gdk_palette (profile, TERMINAL_PROFILE_PALETTE_KEY, &n_colors);
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_PALETTE))
+ if (i < n_colors)
{
- gboolean palette_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_PALETTE);
- SET_SENSITIVE ("palette-combobox", !palette_locked);
- SET_SENSITIVE ("palette-table", !palette_locked);
+ colors[i] = *color;
+ terminal_g_settings_set_gdk_palette (profile, TERMINAL_PROFILE_PALETTE_KEY,
+ colors, n_colors);
}
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_BACKSPACE_BINDING))
- SET_SENSITIVE ("backspace-binding-combobox",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_BACKSPACE_BINDING));
-
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_DELETE_BINDING))
- SET_SENSITIVE ("delete-binding-combobox",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_DELETE_BINDING));
-
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_USE_THEME_COLORS))
- SET_SENSITIVE ("use-theme-colors-checkbutton",
- !terminal_profile_property_locked (profile, TERMINAL_PROFILE_USE_THEME_COLORS));
-
-#undef SET_INSENSITIVE
+ g_free (colors);
}
static void
color_scheme_combo_changed_cb (GtkWidget *combo,
GParamSpec *pspec,
- TerminalProfile *profile)
+ GSettings *profile)
{
guint i;
@@ -325,10 +227,8 @@ color_scheme_combo_changed_cb (GtkWidget *combo,
if (i < G_N_ELEMENTS (color_schemes))
{
g_signal_handlers_block_by_func (profile, G_CALLBACK (profile_colors_notify_scheme_combo_cb), combo);
- g_object_set (profile,
- TERMINAL_PROFILE_FOREGROUND_COLOR, &color_schemes[i].foreground,
- TERMINAL_PROFILE_BACKGROUND_COLOR, &color_schemes[i].background,
- NULL);
+ terminal_g_settings_set_gdk_color (profile, TERMINAL_PROFILE_FOREGROUND_COLOR_KEY, &color_schemes[i].foreground);
+ terminal_g_settings_set_gdk_color (profile, TERMINAL_PROFILE_BACKGROUND_COLOR_KEY, &color_schemes[i].background);
g_signal_handlers_unblock_by_func (profile, G_CALLBACK (profile_colors_notify_scheme_combo_cb), combo);
}
else
@@ -338,28 +238,21 @@ color_scheme_combo_changed_cb (GtkWidget *combo,
}
static void
-profile_colors_notify_scheme_combo_cb (TerminalProfile *profile,
- GParamSpec *pspec,
+profile_colors_notify_scheme_combo_cb (GSettings *profile,
+ const char *key,
GtkComboBox *combo)
{
- const GdkColor *fg, *bg;
+ GdkColor fg, bg;
guint i;
- fg = terminal_profile_get_property_boxed (profile, TERMINAL_PROFILE_FOREGROUND_COLOR);
- bg = terminal_profile_get_property_boxed (profile, TERMINAL_PROFILE_BACKGROUND_COLOR);
+ terminal_g_settings_get_gdk_color (profile, TERMINAL_PROFILE_FOREGROUND_COLOR_KEY, &fg);
+ terminal_g_settings_get_gdk_color (profile, TERMINAL_PROFILE_BACKGROUND_COLOR_KEY, &bg);
- if (fg && bg)
- {
- for (i = 0; i < G_N_ELEMENTS (color_schemes); ++i)
- {
- if (gdk_color_equal (fg, &color_schemes[i].foreground) &&
- gdk_color_equal (bg, &color_schemes[i].background))
- break;
- }
- }
- else
+ for (i = 0; i < G_N_ELEMENTS (color_schemes); ++i)
{
- i = G_N_ELEMENTS (color_schemes);
+ if (gdk_color_equal (&fg, &color_schemes[i].foreground) &&
+ gdk_color_equal (&bg, &color_schemes[i].background))
+ break;
}
/* If we didn't find a match, then we get the last combo box item which is "custom" */
@@ -371,7 +264,7 @@ profile_colors_notify_scheme_combo_cb (TerminalProfile *profile,
static void
palette_scheme_combo_changed_cb (GtkComboBox *combo,
GParamSpec *pspec,
- TerminalProfile *profile)
+ GSettings *profile)
{
int i;
@@ -379,7 +272,8 @@ palette_scheme_combo_changed_cb (GtkComboBox *combo,
g_signal_handlers_block_by_func (profile, G_CALLBACK (profile_colors_notify_scheme_combo_cb), combo);
if (i < TERMINAL_PALETTE_N_BUILTINS)
- terminal_profile_set_palette_builtin (profile, i);
+ terminal_g_settings_set_gdk_palette (profile, TERMINAL_PROFILE_PALETTE_KEY,
+ terminal_palettes[i], TERMINAL_PALETTE_SIZE);
else
{
/* "custom" selected, no change */
@@ -388,13 +282,16 @@ palette_scheme_combo_changed_cb (GtkComboBox *combo,
}
static void
-profile_palette_notify_scheme_combo_cb (TerminalProfile *profile,
- GParamSpec *pspec,
+profile_palette_notify_scheme_combo_cb (GSettings *profile,
+ const char *key,
GtkComboBox *combo)
{
+ GdkColor *colors;
+ gsize n_colors;
guint i;
- if (!terminal_profile_get_palette_is_builtin (profile, &i))
+ colors = terminal_g_settings_get_gdk_palette (profile, TERMINAL_PROFILE_PALETTE_KEY, &n_colors);
+ if (!palette_is_builtin (colors, n_colors, &i))
/* If we didn't find a match, then we want the last combo
* box item which is "custom"
*/
@@ -403,12 +300,14 @@ profile_palette_notify_scheme_combo_cb (TerminalProfile *profile,
g_signal_handlers_block_by_func (combo, G_CALLBACK (palette_scheme_combo_changed_cb), profile);
gtk_combo_box_set_active (combo, i);
g_signal_handlers_unblock_by_func (combo, G_CALLBACK (palette_scheme_combo_changed_cb), profile);
+
+ g_free (colors);
}
static void
palette_color_notify_cb (GtkColorButton *button,
GParamSpec *pspec,
- TerminalProfile *profile)
+ GSettings *profile)
{
GtkWidget *editor;
GdkColor color;
@@ -419,21 +318,26 @@ palette_color_notify_cb (GtkColorButton *button,
editor = gtk_widget_get_toplevel (GTK_WIDGET (button));
g_signal_handlers_block_by_func (profile, G_CALLBACK (profile_palette_notify_colorpickers_cb), editor);
- terminal_profile_modify_palette_entry (profile, i, &color);
+ modify_palette_entry (profile, i, &color);
g_signal_handlers_unblock_by_func (profile, G_CALLBACK (profile_palette_notify_colorpickers_cb), editor);
}
static void
-profile_palette_notify_colorpickers_cb (TerminalProfile *profile,
- GParamSpec *pspec,
+profile_palette_notify_colorpickers_cb (GSettings *profile,
+ const char *key,
GtkWidget *editor)
{
GtkWidget *w;
- GdkColor colors[TERMINAL_PALETTE_SIZE];
- guint n_colors, i;
+ GtkBuilder *builder;
+ GdkColor *colors;
+ gsize n_colors, i;
+
+ g_assert (strcmp (key, TERMINAL_PROFILE_PALETTE_KEY) == 0);
+
+ builder = g_object_get_data (G_OBJECT (editor), "builder");
+ g_assert (builder != NULL);
- n_colors = G_N_ELEMENTS (colors);
- terminal_profile_get_palette (profile, colors, &n_colors);
+ colors = terminal_g_settings_get_gdk_palette (profile, TERMINAL_PROFILE_PALETTE_KEY, &n_colors);
n_colors = MIN (n_colors, TERMINAL_PALETTE_SIZE);
for (i = 0; i < n_colors; i++)
@@ -441,8 +345,8 @@ profile_palette_notify_colorpickers_cb (TerminalProfile *profile,
char name[32];
GdkColor old_color;
- g_snprintf (name, sizeof (name), "palette-colorpicker-%d", i + 1);
- w = profile_editor_get_widget (editor, name);
+ g_snprintf (name, sizeof (name), "palette-colorpicker-%" G_GSIZE_FORMAT, i + 1);
+ w = (GtkWidget *) gtk_builder_get_object (builder, name);
gtk_color_button_get_color (GTK_COLOR_BUTTON (w), &old_color);
if (!gdk_color_equal (&old_color, &colors[i]))
@@ -452,12 +356,13 @@ profile_palette_notify_colorpickers_cb (TerminalProfile *profile,
g_signal_handlers_unblock_by_func (w, G_CALLBACK (palette_color_notify_cb), profile);
}
}
+
+ g_free (colors);
}
static void
custom_command_entry_changed_cb (GtkEntry *entry)
{
-#if GTK_CHECK_VERSION (2, 16, 0)
const char *command;
GError *error = NULL;
@@ -479,29 +384,14 @@ custom_command_entry_changed_cb (GtkEntry *entry)
g_error_free (error);
}
-#endif /* GTK+ >= 2.16.0 */
}
static void
-visible_name_entry_changed_cb (GtkEntry *entry,
- GtkWindow *window)
+reset_compat_defaults_cb (GtkWidget *button,
+ GSettings *profile)
{
- const char *visible_name;
- char *text;
-
- visible_name = gtk_entry_get_text (entry);
-
- text = g_strdup_printf (_("Editing Profile â%sâ"), visible_name);
- gtk_window_set_title (window, text);
- g_free (text);
-}
-
-static void
-reset_compat_defaults_cb (GtkWidget *button,
- TerminalProfile *profile)
-{
- terminal_profile_reset_property (profile, TERMINAL_PROFILE_DELETE_BINDING);
- terminal_profile_reset_property (profile, TERMINAL_PROFILE_BACKSPACE_BINDING);
+ g_settings_reset (profile, TERMINAL_PROFILE_DELETE_BINDING_KEY);
+ g_settings_reset (profile, TERMINAL_PROFILE_BACKSPACE_BINDING_KEY);
}
/*
@@ -533,23 +423,6 @@ init_color_scheme_menu (GtkWidget *widget)
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget), renderer, "text", 0, NULL);
}
-static char*
-format_percent_value (GtkScale *scale,
- double val,
- void *data)
-{
- return g_strdup_printf ("%d%%", (int) (val * 100.0 + 0.5));
-}
-
-static void
-init_background_darkness_scale (GtkWidget *scale)
-{
- g_signal_connect (scale, "format-value",
- G_CALLBACK (format_percent_value),
- NULL);
-}
-
-
static void
editor_response_cb (GtkWidget *editor,
int response,
@@ -560,141 +433,21 @@ editor_response_cb (GtkWidget *editor,
terminal_util_show_help ("gnome-terminal-prefs", GTK_WINDOW (editor));
return;
}
-
- gtk_widget_destroy (editor);
-}
-
-#if 0
-static GdkPixbuf *
-create_preview_pixbuf (const gchar *filename)
-{
- GdkPixbuf *pixbuf = NULL;
- GnomeThumbnailFactory *thumbs;
- const char *mime_type = NULL;
- GFile *gfile;
- GFileInfo *file_info;
-
- if (filename == NULL)
- return NULL;
-
- gfile = g_file_new_for_uri (filename);
- file_info = g_file_query_info (gfile,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
- 0, NULL, NULL);
- if (file_info != NULL)
- mime_type = g_file_info_get_content_type (file_info);
-
- g_object_unref (gfile);
-
- if (mime_type != NULL)
- {
- thumbs = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_NORMAL);
-
- pixbuf = gnome_thumbnail_factory_generate_thumbnail (thumbs,
- filename,
- mime_type);
- g_object_unref (thumbs);
- }
- if (file_info != NULL)
- g_object_unref (file_info);
-
- return pixbuf;
-}
-
-static void
-update_image_preview (GtkFileChooser *chooser)
-{
- GtkWidget *image;
- gchar *file;
-
- image = gtk_file_chooser_get_preview_widget (GTK_FILE_CHOOSER (chooser));
- file = gtk_file_chooser_get_preview_uri (chooser);
-
- if (file != NULL) {
-
- GdkPixbuf *pixbuf = NULL;
-
- pixbuf = create_preview_pixbuf (file);
- g_free (file);
-
- if (pixbuf != NULL) {
- gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
- g_object_unref (pixbuf);
- }
- else {
- gtk_image_set_from_stock (GTK_IMAGE (image),
- "gtk-dialog-question",
- GTK_ICON_SIZE_DIALOG);
- }
- }
- gtk_file_chooser_set_preview_widget_active (chooser, file != NULL);
-}
-#endif
-
-static void
-setup_background_filechooser (GtkWidget *filechooser,
- TerminalProfile *profile)
-{
- GtkFileFilter *filter;
- const char *home_dir;
-
- filter = gtk_file_filter_new ();
- gtk_file_filter_add_pixbuf_formats (filter);
- gtk_file_filter_set_name (filter, _("Images"));
- gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (filechooser), filter);
-
- gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filechooser), TRUE);
-
- /* Start filechooser in $HOME instead of the current dir of the factory which is "/" */
- home_dir = g_get_home_dir ();
- if (home_dir)
- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filechooser), home_dir);
-
-#if 0
- GtkWidget *image_preview;
- GdkPixbuf *pixbuf = NULL;
-
- image_preview = gtk_image_new ();
- /* FIXMchpe this is bogus */
- pixbuf = create_preview_pixbuf (terminal_profile_get_property_string (profile, TERMINAL_PROFILE_BACKGROUND_IMAGE_FILE));
- if (pixbuf != NULL)
- {
- gtk_image_set_from_pixbuf (GTK_IMAGE (image_preview), pixbuf);
- g_object_unref (pixbuf);
- }
- else
- {
- gtk_image_set_from_stock (GTK_IMAGE (image_preview),
- "gtk-dialog-question",
- GTK_ICON_SIZE_DIALOG);
- }
-
- gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER (filechooser),
- image_preview);
- gtk_file_chooser_set_use_preview_label (GTK_FILE_CHOOSER (filechooser),
- FALSE);
- gtk_widget_set_size_request (image_preview, 128, -1);
- gtk_widget_show (image_preview);
-
- g_signal_connect (filechooser, "update-preview",
- G_CALLBACK (update_image_preview), NULL);
-#endif
+ gtk_widget_destroy (editor);
}
static void
-profile_editor_destroyed (GtkWidget *editor,
- TerminalProfile *profile)
+profile_editor_destroyed (GtkWidget *editor,
+ GSettings *profile)
{
- g_signal_handlers_disconnect_by_func (profile, G_CALLBACK (profile_forgotten_cb), editor);
- g_signal_handlers_disconnect_by_func (profile, G_CALLBACK (profile_notify_sensitivity_cb), editor);
g_signal_handlers_disconnect_matched (profile, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
G_CALLBACK (profile_colors_notify_scheme_combo_cb), NULL);
g_signal_handlers_disconnect_matched (profile, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
G_CALLBACK (profile_palette_notify_scheme_combo_cb), NULL);
g_signal_handlers_disconnect_matched (profile, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
G_CALLBACK (profile_palette_notify_colorpickers_cb), NULL);
-
+
g_object_set_data (G_OBJECT (profile), "editor-window", NULL);
g_object_set_data (G_OBJECT (editor), "builder", NULL);
}
@@ -732,9 +485,121 @@ terminal_profile_editor_focus_widget (GtkWidget *editor,
gtk_widget_grab_focus (widget);
}
+static gboolean
+string_to_window_title (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ const char *visible_name;
+
+ g_variant_get (variant, "&s", &visible_name);
+ g_value_take_string (value, g_strdup_printf (_("Editing Profile â%sâ"), visible_name));
+
+ return TRUE;
+}
+
+
+static gboolean
+string_to_color (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ const char *s;
+ GdkColor color;
+ gboolean retval;
+
+ g_variant_get (variant, "&s", &s);
+ retval = gdk_color_parse (s, &color);
+ if (retval)
+ g_value_set_boxed (value, &color);
+
+ return retval;
+}
+
+static GVariant *
+color_to_string (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ GdkColor *color;
+ char *s;
+ GVariant *variant;
+
+ color = g_value_get_boxed (value);
+ if (color == NULL)
+ return NULL;
+
+ s = gdk_color_to_string (color);
+ variant = g_variant_new_string (s);
+ g_free (s);
+
+ return variant;
+}
+
+static gboolean
+string_to_enum (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ GType (* get_type) (void) = user_data;
+ GEnumClass *klass;
+ GEnumValue *eval = NULL;
+ const char *s;
+ guint i;
+
+ g_variant_get (variant, "&s", &s);
+
+ klass = g_type_class_ref (get_type ());
+ for (i = 0; i < klass->n_values; ++i) {
+ if (strcmp (klass->values[i].value_nick, s) != 0)
+ continue;
+
+ eval = &klass->values[i];
+ break;
+ }
+
+ if (eval)
+ g_value_set_int (value, eval->value);
+
+ g_type_class_unref (klass);
+
+ return eval != NULL;
+}
+
+static GVariant *
+enum_to_string (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ GType (* get_type) (void) = user_data;
+ GEnumClass *klass;
+ GEnumValue *eval = NULL;
+ int val;
+ guint i;
+ GVariant *variant = NULL;
+
+ val = g_value_get_int (value);
+
+ klass = g_type_class_ref (get_type ());
+ for (i = 0; i < klass->n_values; ++i) {
+ if (klass->values[i].value != val)
+ continue;
+
+ eval = &klass->values[i];
+ break;
+ }
+
+ if (eval)
+ variant = g_variant_new_string (eval->value_nick);
+
+ g_type_class_unref (klass);
+
+ return variant;
+}
+
/**
* terminal_profile_edit:
- * @profile: a #TerminalProfile
+ * @profile: a #GSettings
* @transient_parent: a #GtkWindow, or %NULL
* @widget_name: a widget name in the profile editor's UI, or %NULL
*
@@ -743,9 +608,9 @@ terminal_profile_editor_focus_widget (GtkWidget *editor,
* switches the notebook to its containing page.
*/
void
-terminal_profile_edit (TerminalProfile *profile,
- GtkWindow *transient_parent,
- const char *widget_name)
+terminal_profile_edit (GSettings *profile,
+ GtkWindow *transient_parent,
+ const char *widget_name)
{
char *path;
GtkBuilder *builder;
@@ -795,12 +660,6 @@ terminal_profile_edit (TerminalProfile *profile,
w = (GtkWidget *) gtk_builder_get_object (builder, "color-scheme-combobox");
init_color_scheme_menu (w);
- w = (GtkWidget *) gtk_builder_get_object (builder, "darken-background-scale");
- init_background_darkness_scale (w);
-
- w = (GtkWidget *) gtk_builder_get_object (builder, "background-image-filechooser");
- setup_background_filechooser (w, profile);
-
/* Hook up the palette colorpickers and combo box */
for (i = 0; i < TERMINAL_PALETTE_SIZE; ++i)
@@ -826,8 +685,8 @@ terminal_profile_edit (TerminalProfile *profile,
profile);
}
- profile_palette_notify_colorpickers_cb (profile, NULL, editor);
- g_signal_connect (profile, "notify::" TERMINAL_PROFILE_PALETTE,
+ profile_palette_notify_colorpickers_cb (profile, TERMINAL_PROFILE_PALETTE_KEY, editor);
+ g_signal_connect (profile, "changed::" TERMINAL_PROFILE_PALETTE_KEY,
G_CALLBACK (profile_palette_notify_colorpickers_cb),
editor);
@@ -836,8 +695,8 @@ terminal_profile_edit (TerminalProfile *profile,
G_CALLBACK (palette_scheme_combo_changed_cb),
profile);
- profile_palette_notify_scheme_combo_cb (profile, NULL, GTK_COMBO_BOX (w));
- g_signal_connect (profile, "notify::" TERMINAL_PROFILE_PALETTE,
+ profile_palette_notify_scheme_combo_cb (profile, TERMINAL_PROFILE_PALETTE_KEY, GTK_COMBO_BOX (w));
+ g_signal_connect (profile, "changed::" TERMINAL_PROFILE_PALETTE_KEY,
G_CALLBACK (profile_palette_notify_scheme_combo_cb),
w);
@@ -848,82 +707,228 @@ terminal_profile_edit (TerminalProfile *profile,
profile);
profile_colors_notify_scheme_combo_cb (profile, NULL, GTK_COMBO_BOX (w));
- g_signal_connect (profile, "notify::" TERMINAL_PROFILE_FOREGROUND_COLOR,
+ g_signal_connect (profile, "changed::" TERMINAL_PROFILE_FOREGROUND_COLOR_KEY,
G_CALLBACK (profile_colors_notify_scheme_combo_cb),
w);
- g_signal_connect (profile, "notify::" TERMINAL_PROFILE_BACKGROUND_COLOR,
+ g_signal_connect (profile, "changed::" TERMINAL_PROFILE_BACKGROUND_COLOR_KEY,
G_CALLBACK (profile_colors_notify_scheme_combo_cb),
w);
-#define CONNECT_WITH_FLAGS(name, prop, flags) terminal_util_bind_object_property_to_widget (G_OBJECT (profile), prop, (GtkWidget *) gtk_builder_get_object (builder, name), flags)
-#define CONNECT(name, prop) CONNECT_WITH_FLAGS (name, prop, 0)
-#define SET_ENUM_VALUE(name, value) g_object_set_data (gtk_builder_get_object (builder, name), "enum-value", GINT_TO_POINTER (value))
-
w = GTK_WIDGET (gtk_builder_get_object (builder, "custom-command-entry"));
custom_command_entry_changed_cb (GTK_ENTRY (w));
g_signal_connect (w, "changed",
G_CALLBACK (custom_command_entry_changed_cb), NULL);
- w = GTK_WIDGET (gtk_builder_get_object (builder, "profile-name-entry"));
- g_signal_connect (w, "changed",
- G_CALLBACK (visible_name_entry_changed_cb), editor);
g_signal_connect (gtk_builder_get_object (builder, "reset-compat-defaults-button"),
"clicked",
G_CALLBACK (reset_compat_defaults_cb),
profile);
- SET_ENUM_VALUE ("image-radiobutton", TERMINAL_BACKGROUND_IMAGE);
- SET_ENUM_VALUE ("solid-radiobutton", TERMINAL_BACKGROUND_SOLID);
- SET_ENUM_VALUE ("transparent-radiobutton", TERMINAL_BACKGROUND_TRANSPARENT);
- CONNECT ("allow-bold-checkbutton", TERMINAL_PROFILE_ALLOW_BOLD);
- CONNECT ("background-colorpicker", TERMINAL_PROFILE_BACKGROUND_COLOR);
- CONNECT ("background-image-filechooser", TERMINAL_PROFILE_BACKGROUND_IMAGE_FILE);
- CONNECT ("backspace-binding-combobox", TERMINAL_PROFILE_BACKSPACE_BINDING);
- CONNECT ("bold-color-same-as-fg-checkbox", TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG);
- CONNECT ("bold-colorpicker", TERMINAL_PROFILE_BOLD_COLOR);
- CONNECT ("cursor-shape-combobox", TERMINAL_PROFILE_CURSOR_SHAPE);
- CONNECT ("custom-command-entry", TERMINAL_PROFILE_CUSTOM_COMMAND);
- CONNECT ("darken-background-scale", TERMINAL_PROFILE_BACKGROUND_DARKNESS);
- CONNECT ("default-size-columns-spinbutton", TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS);
- CONNECT ("default-size-rows-spinbutton", TERMINAL_PROFILE_DEFAULT_SIZE_ROWS);
- CONNECT ("delete-binding-combobox", TERMINAL_PROFILE_DELETE_BINDING);
- CONNECT ("exit-action-combobox", TERMINAL_PROFILE_EXIT_ACTION);
- CONNECT ("font-selector", TERMINAL_PROFILE_FONT);
- CONNECT ("foreground-colorpicker", TERMINAL_PROFILE_FOREGROUND_COLOR);
- CONNECT ("image-radiobutton", TERMINAL_PROFILE_BACKGROUND_TYPE);
- CONNECT ("login-shell-checkbutton", TERMINAL_PROFILE_LOGIN_SHELL);
- CONNECT ("profile-name-entry", TERMINAL_PROFILE_VISIBLE_NAME);
- CONNECT ("scrollback-lines-spinbutton", TERMINAL_PROFILE_SCROLLBACK_LINES);
- CONNECT ("scrollback-unlimited-checkbutton", TERMINAL_PROFILE_SCROLLBACK_UNLIMITED);
- CONNECT ("scroll-background-checkbutton", TERMINAL_PROFILE_SCROLL_BACKGROUND);
- CONNECT ("scrollbar-position-combobox", TERMINAL_PROFILE_SCROLLBAR_POSITION);
- CONNECT ("scroll-on-keystroke-checkbutton", TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE);
- CONNECT ("scroll-on-output-checkbutton", TERMINAL_PROFILE_SCROLL_ON_OUTPUT);
- CONNECT ("show-menubar-checkbutton", TERMINAL_PROFILE_DEFAULT_SHOW_MENUBAR);
- CONNECT ("solid-radiobutton", TERMINAL_PROFILE_BACKGROUND_TYPE);
- CONNECT ("system-font-checkbutton", TERMINAL_PROFILE_USE_SYSTEM_FONT);
- CONNECT ("title-entry", TERMINAL_PROFILE_TITLE);
- CONNECT ("title-mode-combobox", TERMINAL_PROFILE_TITLE_MODE);
- CONNECT ("transparent-radiobutton", TERMINAL_PROFILE_BACKGROUND_TYPE);
- CONNECT ("update-records-checkbutton", TERMINAL_PROFILE_UPDATE_RECORDS);
- CONNECT ("use-custom-command-checkbutton", TERMINAL_PROFILE_USE_CUSTOM_COMMAND);
- CONNECT ("use-custom-default-size-checkbutton", TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE);
- CONNECT ("use-theme-colors-checkbutton", TERMINAL_PROFILE_USE_THEME_COLORS);
- CONNECT ("word-chars-entry", TERMINAL_PROFILE_WORD_CHARS);
- CONNECT_WITH_FLAGS ("bell-checkbutton", TERMINAL_PROFILE_SILENT_BELL, FLAG_INVERT_BOOL);
-
-#undef CONNECT
-#undef CONNECT_WITH_FLAGS
-#undef SET_ENUM_VALUE
-
- profile_notify_sensitivity_cb (profile, NULL, editor);
- g_signal_connect (profile, "notify",
- G_CALLBACK (profile_notify_sensitivity_cb),
- editor);
- g_signal_connect (profile,
- "forgotten",
- G_CALLBACK (profile_forgotten_cb),
- editor);
+ g_settings_bind_with_mapping (profile,
+ TERMINAL_PROFILE_VISIBLE_NAME_KEY,
+ editor,
+ "title",
+ G_SETTINGS_BIND_GET |
+ G_SETTINGS_BIND_NO_SENSITIVITY,
+ (GSettingsBindGetMapping)
+ string_to_window_title, NULL, NULL, NULL);
+
+ g_settings_bind (profile,
+ TERMINAL_PROFILE_ALLOW_BOLD_KEY,
+ gtk_builder_get_object (builder, "allow-bold-checkbutton"),
+ "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind_with_mapping (profile,
+ TERMINAL_PROFILE_BACKGROUND_COLOR_KEY,
+ gtk_builder_get_object (builder,
+ "background-colorpicker"),
+ "color",
+ G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
+ (GSettingsBindGetMapping) string_to_color,
+ (GSettingsBindSetMapping) color_to_string,
+ NULL, NULL);
+ g_settings_bind_with_mapping (profile,
+ TERMINAL_PROFILE_BACKSPACE_BINDING_KEY,
+ gtk_builder_get_object (builder,
+ "backspace-binding-combobox"),
+ "active",
+ G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
+ (GSettingsBindGetMapping) string_to_enum,
+ (GSettingsBindSetMapping) enum_to_string,
+ vte_terminal_erase_binding_get_type, NULL);
+ g_settings_bind (profile, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG_KEY,
+ gtk_builder_get_object (builder,
+ "bold-color-same-as-fg-checkbox"),
+ "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_BOLD_COLOR_KEY,
+ gtk_builder_get_object (builder,
+ "bold-colorpicker"),
+ "color",
+ G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
+ (GSettingsBindGetMapping) string_to_color,
+ (GSettingsBindSetMapping) color_to_string,
+ NULL, NULL);
+ g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_CURSOR_SHAPE_KEY,
+ gtk_builder_get_object (builder,
+ "cursor-shape-combobox"),
+ "active",
+ G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
+ (GSettingsBindGetMapping) string_to_enum,
+ (GSettingsBindSetMapping) enum_to_string,
+ vte_terminal_cursor_shape_get_type, NULL);
+ g_settings_bind (profile, TERMINAL_PROFILE_CUSTOM_COMMAND_KEY,
+ gtk_builder_get_object (builder, "custom-command-entry"),
+ "text", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind (profile, TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS_KEY,
+ gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON
+ (gtk_builder_get_object
+ (builder,
+ "default-size-columns-spinbutton"))),
+ "value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind (profile, TERMINAL_PROFILE_DEFAULT_SIZE_ROWS_KEY,
+ gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON
+ (gtk_builder_get_object
+ (builder,
+ "default-size-rows-spinbutton"))),
+ "value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_DELETE_BINDING_KEY,
+ gtk_builder_get_object (builder,
+ "delete-binding-combobox"),
+ "active",
+ G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
+ (GSettingsBindGetMapping) string_to_enum,
+ (GSettingsBindSetMapping) enum_to_string,
+ vte_terminal_erase_binding_get_type, NULL);
+ g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_EXIT_ACTION_KEY,
+ gtk_builder_get_object (builder,
+ "exit-action-combobox"),
+ "active",
+ G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
+ (GSettingsBindGetMapping) string_to_enum,
+ (GSettingsBindSetMapping) enum_to_string,
+ terminal_exit_action_get_type, NULL);
+ g_settings_bind (profile, TERMINAL_PROFILE_FONT_KEY,
+ gtk_builder_get_object (builder, "font-selector"),
+ "font-name", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind_with_mapping (profile,
+ TERMINAL_PROFILE_FOREGROUND_COLOR_KEY,
+ gtk_builder_get_object (builder,
+ "foreground-colorpicker"),
+ "color",
+ G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
+ (GSettingsBindGetMapping) string_to_color,
+ (GSettingsBindSetMapping) color_to_string,
+ NULL, NULL);
+ g_settings_bind (profile, TERMINAL_PROFILE_LOGIN_SHELL_KEY,
+ gtk_builder_get_object (builder,
+ "login-shell-checkbutton"),
+ "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind (profile, TERMINAL_PROFILE_VISIBLE_NAME_KEY,
+ gtk_builder_get_object (builder, "profile-name-entry"),
+ "text", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind (profile, TERMINAL_PROFILE_SCROLLBACK_LINES_KEY,
+ gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON
+ (gtk_builder_get_object
+ (builder,
+ "scrollback-lines-spinbutton"))),
+ "value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind (profile, TERMINAL_PROFILE_SCROLLBACK_UNLIMITED_KEY,
+ gtk_builder_get_object (builder,
+ "scrollback-unlimited-checkbutton"),
+ "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind_with_mapping (profile,
+ TERMINAL_PROFILE_SCROLLBAR_POLICY_KEY,
+ gtk_builder_get_object (builder,
+ "scrollbar-policy-combobox"),
+ "active",
+ G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
+ (GSettingsBindGetMapping) string_to_enum,
+ (GSettingsBindSetMapping) enum_to_string,
+ gtk_policy_type_get_type, NULL);
+ g_settings_bind (profile, TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE_KEY,
+ gtk_builder_get_object (builder,
+ "scroll-on-keystroke-checkbutton"),
+ "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind (profile, TERMINAL_PROFILE_SCROLL_ON_OUTPUT_KEY,
+ gtk_builder_get_object (builder,
+ "scroll-on-output-checkbutton"),
+ "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind (profile, TERMINAL_PROFILE_USE_SYSTEM_FONT_KEY,
+ gtk_builder_get_object (builder,
+ "system-font-checkbutton"),
+ "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind (profile, TERMINAL_PROFILE_TITLE_KEY,
+ gtk_builder_get_object (builder, "title-entry"), "text",
+ G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_TITLE_MODE_KEY,
+ gtk_builder_get_object (builder,
+ "title-mode-combobox"),
+ "active",
+ G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET,
+ (GSettingsBindGetMapping) string_to_enum,
+ (GSettingsBindSetMapping) enum_to_string,
+ terminal_title_mode_get_type, NULL);
+ g_settings_bind (profile, TERMINAL_PROFILE_UPDATE_RECORDS_KEY,
+ gtk_builder_get_object (builder,
+ "update-records-checkbutton"),
+ "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind (profile, TERMINAL_PROFILE_USE_CUSTOM_COMMAND_KEY,
+ gtk_builder_get_object (builder,
+ "use-custom-command-checkbutton"),
+ "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind (profile, TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE_KEY,
+ gtk_builder_get_object (builder,
+ "use-custom-default-size-checkbutton"),
+ "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind (profile, TERMINAL_PROFILE_USE_THEME_COLORS_KEY,
+ gtk_builder_get_object (builder,
+ "use-theme-colors-checkbutton"),
+ "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind (profile, TERMINAL_PROFILE_WORD_CHARS_KEY,
+ gtk_builder_get_object (builder, "word-chars-entry"),
+ "text", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind (profile, TERMINAL_PROFILE_AUDIBLE_BELL_KEY,
+ gtk_builder_get_object (builder, "bell-checkbutton"),
+ "active",
+ G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+
+ g_settings_bind (profile,
+ TERMINAL_PROFILE_USE_CUSTOM_COMMAND_KEY,
+ gtk_builder_get_object (builder, "custom-command-box"),
+ "sensitive", G_SETTINGS_BIND_GET);
+ g_settings_bind (profile,
+ TERMINAL_PROFILE_USE_SYSTEM_FONT_KEY,
+ gtk_builder_get_object (builder, "font-hbox"),
+ "sensitive",
+ G_SETTINGS_BIND_GET | G_SETTINGS_BIND_INVERT_BOOLEAN);
+ g_settings_bind (profile,
+ TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE_KEY,
+ gtk_builder_get_object (builder, "default-size-hbox"),
+ "sensitive", G_SETTINGS_BIND_GET);
+ g_settings_bind_writable (profile,
+ TERMINAL_PROFILE_PALETTE_KEY,
+ gtk_builder_get_object (builder, "palette-box"),
+ "sensitive",
+ FALSE);
+
+#if 0
+ if (!prop_name ||
+ prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR_KEY) ||
+ prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG_KEY) ||
+ prop_name == I_(TERMINAL_PROFILE_USE_THEME_COLORS_KEY))
+ {
+ gboolean bold_locked, bold_same_as_fg_locked, bold_same_as_fg, use_theme_colors;
+
+ bold_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_BOLD_COLOR_KEY);
+ bold_same_as_fg_locked = terminal_profile_property_locked (profile, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG_KEY);
+ bold_same_as_fg = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG_KEY);
+
+ SET_SENSITIVE ("bold-color-same-as-fg-checkbox", !bold_same_as_fg_locked);
+ SET_SENSITIVE ("bold-colorpicker", !bold_locked && !bold_same_as_fg);
+ SET_SENSITIVE ("bold-colorpicker-label", ((!bold_same_as_fg && !bold_locked) || !bold_same_as_fg_locked));
+ }
+#endif
+
+ terminal_util_bind_mnemonic_label_sensitivity (editor);
terminal_profile_editor_focus_widget (editor, widget_name);
diff --git a/src/profile-editor.h b/src/profile-editor.h
index 2eec796..d5bb02e 100644
--- a/src/profile-editor.h
+++ b/src/profile-editor.h
@@ -1,18 +1,18 @@
/*
* Copyright  2002 Havoc Pennington
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * This programme is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * This programme is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
+ * You should have received a copy of the GNU General Public
+ * License along with this programme; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
@@ -20,14 +20,14 @@
#ifndef TERMINAL_PROFILE_EDITOR_H
#define TERMINAL_PROFILE_EDITOR_H
-#include "terminal-profile.h"
+#include <gio/gio.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
-void terminal_profile_edit (TerminalProfile *profile,
- GtkWindow *transient_parent,
- const char *widget_name);
+void terminal_profile_edit (GSettings *profile,
+ GtkWindow *transient_parent,
+ const char *widget_name);
G_END_DECLS
diff --git a/src/profile-preferences.glade b/src/profile-preferences.glade
index 5c2ecd8..be4eee2 100644
--- a/src/profile-preferences.glade
+++ b/src/profile-preferences.glade
@@ -7,7 +7,7 @@
<widget class="GtkDialog" id="profile-editor-dialog">
<property name="border_width">5</property>
<property name="visible">True</property>
- <property name="title" translatable="yes">Profile Editor</property>
+ <property name="title">Profile Editor</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
@@ -127,6 +127,7 @@
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
+ <property name="invisible_char">â</property>
<property name="activates_default">False</property>
</widget>
<packing>
@@ -253,25 +254,6 @@
</child>
<child>
- <widget class="GtkCheckButton" id="show-menubar-checkbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Show _menubar by default in new terminals</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
<widget class="GtkCheckButton" id="bell-checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -386,6 +368,7 @@ Underline</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
+ <property name="invisible_char">â</property>
<property name="activates_default">False</property>
</widget>
<packing>
@@ -465,7 +448,7 @@ Underline</property>
</child>
<child>
- <widget class="GtkHBox" id="hbox143">
+ <widget class="GtkHBox" id="default-size-columns-box">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
@@ -484,8 +467,8 @@ Underline</property>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
@@ -522,7 +505,7 @@ Underline</property>
</child>
<child>
- <widget class="GtkHBox" id="hbox142">
+ <widget class="GtkHBox" id="default-size-rows-box">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
@@ -541,8 +524,8 @@ Underline</property>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
@@ -583,7 +566,7 @@ Underline</property>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="fill">False</property>
</packing>
</child>
</widget>
@@ -713,6 +696,7 @@ Underline</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
+ <property name="invisible_char">â</property>
<property name="activates_default">False</property>
</widget>
<packing>
@@ -773,7 +757,7 @@ Keep initial title</property>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
@@ -966,6 +950,7 @@ Keep initial title</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
+ <property name="invisible_char">â</property>
<property name="activates_default">False</property>
</widget>
<packing>
@@ -1027,7 +1012,7 @@ Hold the terminal open</property>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
@@ -1167,105 +1152,21 @@ Hold the terminal open</property>
</child>
<child>
- <widget class="GtkHBox" id="hbox145">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="color-scheme-combobox-label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Built-in sche_mes:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">color-scheme-combobox</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkComboBox" id="color-scheme-combobox">
- <property name="visible">True</property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox146">
+ <widget class="GtkVBox" id="colors-box">
<property name="visible">True</property>
<property name="homogeneous">False</property>
- <property name="spacing">18</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkTable" id="table31">
+ <widget class="GtkHBox" id="hbox145">
<property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
<property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="foreground-colorpicker-label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Text color:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">foreground-colorpicker</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <property name="spacing">12</property>
<child>
- <widget class="GtkLabel" id="background-colorpicker-label">
+ <widget class="GtkLabel" id="color-scheme-combobox-label">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Background color:</property>
+ <property name="label" translatable="yes">Built-in sche_mes:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
@@ -1275,239 +1176,336 @@ Hold the terminal open</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">background-colorpicker</property>
+ <property name="mnemonic_widget">color-scheme-combobox</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkColorButton" id="background-colorpicker">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="use_alpha">False</property>
- <property name="title" translatable="yes">Choose Terminal Background Color</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkColorButton" id="foreground-colorpicker">
+ <widget class="GtkComboBox" id="color-scheme-combobox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="use_alpha">False</property>
- <property name="title" translatable="yes">Choose Terminal Text Color</property>
+ <property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
- <widget class="GtkTable" id="underline-colorpicker-label">
+ <widget class="GtkHBox" id="hbox146">
<property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">3</property>
<property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
+ <property name="spacing">18</property>
<child>
- <widget class="GtkColorButton" id="bold-colorpicker">
+ <widget class="GtkTable" id="table31">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="use_alpha">False</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
- <child>
- <widget class="GtkLabel" id="label481">
- <property name="label" translatable="yes">_Underline color:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">underline-colorpicker</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkLabel" id="foreground-colorpicker-label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Text color:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">foreground-colorpicker</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkColorButton" id="underline-colorpicker">
- <property name="can_focus">True</property>
- <property name="use_alpha">False</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkLabel" id="background-colorpicker-label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Background color:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">background-colorpicker</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkCheckButton" id="underline-color-same-as-fg-checkbox">
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Same as text color</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">True</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <child>
+ <widget class="GtkColorButton" id="background-colorpicker">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="use_alpha">False</property>
+ <property name="title" translatable="yes">Choose Terminal Background Color</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
- <child>
- <widget class="GtkLabel" id="bold-colorpicker-label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Bol_d color:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">bold-colorpicker</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
+ <child>
+ <widget class="GtkColorButton" id="foreground-colorpicker">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="use_alpha">False</property>
+ <property name="title" translatable="yes">Choose Terminal Text Color</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
</widget>
<packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">shrink|fill</property>
- <property name="y_options"></property>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="bold-color-same-as-fg-checkbox">
+ <widget class="GtkTable" id="underline-colorpicker-label">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Same as text color</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">True</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
+ <property name="n_rows">2</property>
+ <property name="n_columns">3</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+
+ <child>
+ <widget class="GtkColorButton" id="bold-colorpicker">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="use_alpha">False</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label481">
+ <property name="label" translatable="yes">_Underline color:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">underline-colorpicker</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkColorButton" id="underline-colorpicker">
+ <property name="can_focus">True</property>
+ <property name="use_alpha">False</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="underline-color-same-as-fg-checkbox">
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Same as text color</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">True</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="bold-colorpicker-label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Bol_d color:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">bold-colorpicker</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">shrink|fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="bold-color-same-as-fg-checkbox">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Same as text color</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">True</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox83">
+ <widget class="GtkVBox" id="palette-box">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
@@ -2018,337 +2016,6 @@ Custom</property>
</child>
<child>
- <widget class="GtkVBox" id="vbox86">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkRadioButton" id="solid-radiobutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Solid color</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">True</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox87">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkRadioButton" id="image-radiobutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Background image</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">solid-radiobutton</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkAlignment" id="alignment10103">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">1</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">12</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkVBox" id="vbox89">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="background-image-filechooser-label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Image _file:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">background-image-filechooser</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFileChooserButton" id="background-image-filechooser">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="title" translatable="yes">Select Background Image</property>
- <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
- <property name="local_only">True</property>
- <property name="show_hidden">False</property>
- <property name="do_overwrite_confirmation">False</property>
- <property name="width_chars">-1</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="scroll-background-checkbutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Background image _scrolls</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="transparent-radiobutton">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Transparent background</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">solid-radiobutton</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="darken-background-vbox">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="darken-background-scale-label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">S_hade transparent or image background:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">darken-background-scale</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">1</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox6">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkLabel" id="label64">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><small><i>None</i></small></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">6</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHScale" id="darken-background-scale">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="draw_value">False</property>
- <property name="value_pos">GTK_POS_BOTTOM</property>
- <property name="digits">2</property>
- <property name="update_policy">GTK_UPDATE_DELAYED</property>
- <property name="inverted">False</property>
- <property name="adjustment">0.10000000149 0 1 0.00999999977648 0.10000000149 0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label63">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><small><i>Maximum</i></small></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">1</property>
- <property name="yalign">0.5</property>
- <property name="xpad">6</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">1</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label479">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Background</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
-
- <child>
<widget class="GtkTable" id="table27">
<property name="border_width">12</property>
<property name="visible">True</property>
@@ -2359,7 +2026,7 @@ Custom</property>
<property name="column_spacing">12</property>
<child>
- <widget class="GtkLabel" id="scrollbar-position-combobox-label">
+ <widget class="GtkLabel" id="scrollbar-policy-combobox-label">
<property name="visible">True</property>
<property name="label" translatable="yes">_Scrollbar is:</property>
<property name="use_underline">True</property>
@@ -2371,7 +2038,7 @@ Custom</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
- <property name="mnemonic_widget">scrollbar-position-combobox</property>
+ <property name="mnemonic_widget">scrollbar-policy-combobox</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@@ -2486,11 +2153,11 @@ Custom</property>
<property name="spacing">0</property>
<child>
- <widget class="GtkComboBox" id="scrollbar-position-combobox">
+ <widget class="GtkComboBox" id="scrollbar-policy-combobox">
<property name="visible">True</property>
- <property name="items" translatable="yes">On the left side
-On the right side
-Disabled</property>
+ <property name="items" translatable="yes">Always visible
+Visible only when necessary
+Hidden</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
</widget>
@@ -2506,6 +2173,7 @@ Disabled</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
@@ -2566,6 +2234,7 @@ Disabled</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
diff --git a/src/terminal-accels.c b/src/terminal-accels.c
index c47f558..a7420c3 100644
--- a/src/terminal-accels.c
+++ b/src/terminal-accels.c
@@ -1,6 +1,6 @@
/*
* Copyright  2001, 2002 Havoc Pennington, Red Hat Inc.
- * Copyright  2008 Christian Persch
+ * Copyright  2008, 2011 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
@@ -22,85 +22,37 @@
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION (2, 90, 7)
-#define GDK_KEY(symbol) GDK_KEY_##symbol
-#else
-#include <gdk/gdkkeysyms.h>
-#define GDK_KEY(symbol) GDK_##symbol
-#endif
-
#include "terminal-accels.h"
#include "terminal-app.h"
#include "terminal-debug.h"
#include "terminal-intl.h"
-#include "terminal-profile.h"
+#include "terminal-schemas.h"
#include "terminal-util.h"
-/* NOTES
- *
- * There are two sources of keybindings changes, from GConf and from
- * the accel map (happens with in-place menu editing).
- *
- * When a keybinding gconf key changes, we propagate that into the
- * accel map.
- * When the accel map changes, we queue a sync to gconf.
- *
- * To avoid infinite loops, we short-circuit in both directions
- * if the value is unchanged from last known.
- *
- * In the keybinding editor, when editing or clearing an accel, we write
- * the change directly to gconf and rely on the gconf callback to
- * actually apply the change to the accel map.
- */
-
#define ACCEL_PATH_ROOT "<Actions>/Main/"
-#define ACCEL_PATH_NEW_TAB ACCEL_PATH_ROOT "FileNewTab"
-#define ACCEL_PATH_NEW_WINDOW ACCEL_PATH_ROOT "FileNewWindow"
-#define ACCEL_PATH_NEW_PROFILE ACCEL_PATH_ROOT "FileNewProfile"
-#define ACCEL_PATH_SAVE_CONTENTS ACCEL_PATH_ROOT "FileSaveContents"
-#define ACCEL_PATH_CLOSE_TAB ACCEL_PATH_ROOT "FileCloseTab"
-#define ACCEL_PATH_CLOSE_WINDOW ACCEL_PATH_ROOT "FileCloseWindow"
-#define ACCEL_PATH_COPY ACCEL_PATH_ROOT "EditCopy"
-#define ACCEL_PATH_PASTE ACCEL_PATH_ROOT "EditPaste"
-#define ACCEL_PATH_TOGGLE_MENUBAR ACCEL_PATH_ROOT "ViewMenubar"
-#define ACCEL_PATH_FULL_SCREEN ACCEL_PATH_ROOT "ViewFullscreen"
-#define ACCEL_PATH_RESET ACCEL_PATH_ROOT "TerminalReset"
-#define ACCEL_PATH_RESET_AND_CLEAR ACCEL_PATH_ROOT "TerminalResetClear"
-#define ACCEL_PATH_PREV_TAB ACCEL_PATH_ROOT "TabsPrevious"
-#define ACCEL_PATH_NEXT_TAB ACCEL_PATH_ROOT "TabsNext"
-#define ACCEL_PATH_SET_TERMINAL_TITLE ACCEL_PATH_ROOT "TerminalSetTitle"
-#define ACCEL_PATH_HELP ACCEL_PATH_ROOT "HelpContents"
-#define ACCEL_PATH_ZOOM_IN ACCEL_PATH_ROOT "ViewZoomIn"
-#define ACCEL_PATH_ZOOM_OUT ACCEL_PATH_ROOT "ViewZoomOut"
-#define ACCEL_PATH_ZOOM_NORMAL ACCEL_PATH_ROOT "ViewZoom100"
-#define ACCEL_PATH_MOVE_TAB_LEFT ACCEL_PATH_ROOT "TabsMoveLeft"
-#define ACCEL_PATH_MOVE_TAB_RIGHT ACCEL_PATH_ROOT "TabsMoveRight"
-#define ACCEL_PATH_DETACH_TAB ACCEL_PATH_ROOT "TabsDetach"
-#define ACCEL_PATH_SWITCH_TAB_PREFIX ACCEL_PATH_ROOT "TabsSwitch"
-
-#define KEY_CLOSE_TAB CONF_KEYS_PREFIX "/close_tab"
-#define KEY_CLOSE_WINDOW CONF_KEYS_PREFIX "/close_window"
-#define KEY_COPY CONF_KEYS_PREFIX "/copy"
-#define KEY_DETACH_TAB CONF_KEYS_PREFIX "/detach_tab"
-#define KEY_FULL_SCREEN CONF_KEYS_PREFIX "/full_screen"
-#define KEY_HELP CONF_KEYS_PREFIX "/help"
-#define KEY_MOVE_TAB_LEFT CONF_KEYS_PREFIX "/move_tab_left"
-#define KEY_MOVE_TAB_RIGHT CONF_KEYS_PREFIX "/move_tab_right"
-#define KEY_NEW_PROFILE CONF_KEYS_PREFIX "/new_profile"
-#define KEY_NEW_TAB CONF_KEYS_PREFIX "/new_tab"
-#define KEY_NEW_WINDOW CONF_KEYS_PREFIX "/new_window"
-#define KEY_NEXT_TAB CONF_KEYS_PREFIX "/next_tab"
-#define KEY_PASTE CONF_KEYS_PREFIX "/paste"
-#define KEY_PREV_TAB CONF_KEYS_PREFIX "/prev_tab"
-#define KEY_RESET_AND_CLEAR CONF_KEYS_PREFIX "/reset_and_clear"
-#define KEY_RESET CONF_KEYS_PREFIX "/reset"
-#define KEY_SAVE_CONTENTS CONF_KEYS_PREFIX "/save_contents"
-#define KEY_SET_TERMINAL_TITLE CONF_KEYS_PREFIX "/set_window_title"
-#define KEY_TOGGLE_MENUBAR CONF_KEYS_PREFIX "/toggle_menubar"
-#define KEY_ZOOM_IN CONF_KEYS_PREFIX "/zoom_in"
-#define KEY_ZOOM_NORMAL CONF_KEYS_PREFIX "/zoom_normal"
-#define KEY_ZOOM_OUT CONF_KEYS_PREFIX "/zoom_out"
-#define KEY_SWITCH_TAB_PREFIX CONF_KEYS_PREFIX "/switch_to_tab_"
+#define ACCEL_NEW_TAB "FileNewTab"
+#define ACCEL_NEW_WINDOW "FileNewWindow"
+#define ACCEL_NEW_PROFILE "FileNewProfile"
+#define ACCEL_SAVE_CONTENTS "FileSaveContents"
+#define ACCEL_CLOSE_TAB "FileCloseTab"
+#define ACCEL_CLOSE_WINDOW "FileCloseWindow"
+#define ACCEL_COPY "EditCopy"
+#define ACCEL_PASTE "EditPaste"
+#define ACCEL_TOGGLE_MENUBAR "ViewMenubar"
+#define ACCEL_FULL_SCREEN "ViewFullscreen"
+#define ACCEL_RESET "TerminalReset"
+#define ACCEL_RESET_AND_CLEAR "TerminalResetClear"
+#define ACCEL_PREV_TAB "TabsPrevious"
+#define ACCEL_NEXT_TAB "TabsNext"
+#define ACCEL_SET_TERMINAL_TITLE "TerminalSetTitle"
+#define ACCEL_HELP "HelpContents"
+#define ACCEL_ZOOM_IN "ViewZoomIn"
+#define ACCEL_ZOOM_OUT "ViewZoomOut"
+#define ACCEL_ZOOM_NORMAL "ViewZoom100"
+#define ACCEL_MOVE_TAB_LEFT "TabsMoveLeft"
+#define ACCEL_MOVE_TAB_RIGHT "TabsMoveRight"
+#define ACCEL_DETACH_TAB "TabsDetach"
+#define ACCEL_SWITCH_TAB_PREFIX "TabsSwitch"
#if 1
/*
@@ -119,15 +71,7 @@
typedef struct
{
const char *user_visible_name;
- const char *gconf_key;
- const char *accel_path;
- /* last values received from gconf */
- GdkModifierType gconf_mask;
- guint gconf_keyval;
- GClosure *closure;
- /* have gotten a notification from gtk */
- gboolean needs_gconf_sync;
- gboolean accel_path_unlocked;
+ const char *accel_path_suffix;
} KeyEntry;
typedef struct
@@ -139,106 +83,61 @@ typedef struct
static KeyEntry file_entries[] =
{
- { N_("New Tab"),
- KEY_NEW_TAB, ACCEL_PATH_NEW_TAB, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY (t), NULL, FALSE, TRUE },
- { N_("New Window"),
- KEY_NEW_WINDOW, ACCEL_PATH_NEW_WINDOW, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY (n), NULL, FALSE, TRUE },
- { N_("New Profile"),
- KEY_NEW_PROFILE, ACCEL_PATH_NEW_PROFILE, 0, 0, NULL, FALSE, TRUE },
+ { N_("New Tab"), ACCEL_NEW_TAB },
+ { N_("New Window"), ACCEL_NEW_WINDOW },
+ { N_("New Profile"), ACCEL_NEW_PROFILE },
#ifdef ENABLE_SAVE
- { N_("Save Contents"),
- KEY_SAVE_CONTENTS, ACCEL_PATH_SAVE_CONTENTS, 0, 0, NULL, FALSE, TRUE },
+ { N_("Save Contents"), ACCEL_SAVE_CONTENTS },
#endif
- { N_("Close Tab"),
- KEY_CLOSE_TAB, ACCEL_PATH_CLOSE_TAB, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY (w), NULL, FALSE, TRUE },
- { N_("Close Window"),
- KEY_CLOSE_WINDOW, ACCEL_PATH_CLOSE_WINDOW, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY (q), NULL, FALSE, TRUE },
+ { N_("Close Tab"), ACCEL_CLOSE_TAB },
+ { N_("Close Window"), ACCEL_CLOSE_WINDOW }
};
static KeyEntry edit_entries[] =
{
- { N_("Copy"),
- KEY_COPY, ACCEL_PATH_COPY, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY (c), NULL, FALSE, TRUE },
- { N_("Paste"),
- KEY_PASTE, ACCEL_PATH_PASTE, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY (v), NULL, FALSE, TRUE },
+ { N_("Copy"), ACCEL_COPY },
+ { N_("Paste"), ACCEL_PASTE }
};
static KeyEntry view_entries[] =
{
- { N_("Hide and Show menubar"),
- KEY_TOGGLE_MENUBAR, ACCEL_PATH_TOGGLE_MENUBAR, 0, 0, NULL, FALSE, TRUE },
- { N_("Full Screen"),
- KEY_FULL_SCREEN, ACCEL_PATH_FULL_SCREEN, 0, GDK_KEY (F11), NULL, FALSE, TRUE },
- { N_("Zoom In"),
- KEY_ZOOM_IN, ACCEL_PATH_ZOOM_IN, GDK_CONTROL_MASK, GDK_KEY (plus), NULL, FALSE, TRUE },
- { N_("Zoom Out"),
- KEY_ZOOM_OUT, ACCEL_PATH_ZOOM_OUT, GDK_CONTROL_MASK, GDK_KEY (minus), NULL, FALSE, TRUE },
- { N_("Normal Size"),
- KEY_ZOOM_NORMAL, ACCEL_PATH_ZOOM_NORMAL, GDK_CONTROL_MASK, GDK_KEY (0), NULL, FALSE, TRUE }
+ { N_("Hide and Show menubar"), ACCEL_TOGGLE_MENUBAR },
+ { N_("Full Screen"), ACCEL_FULL_SCREEN },
+ { N_("Zoom In"), ACCEL_ZOOM_IN },
+ { N_("Zoom Out"), ACCEL_ZOOM_OUT },
+ { N_("Normal Size"), ACCEL_ZOOM_NORMAL },
};
static KeyEntry terminal_entries[] =
{
- { N_("Set Title"),
- KEY_SET_TERMINAL_TITLE, ACCEL_PATH_SET_TERMINAL_TITLE, 0, 0, NULL, FALSE, TRUE },
- { N_("Reset"),
- KEY_RESET, ACCEL_PATH_RESET, 0, 0, NULL, FALSE, TRUE },
- { N_("Reset and Clear"),
- KEY_RESET_AND_CLEAR, ACCEL_PATH_RESET_AND_CLEAR, 0, 0, NULL, FALSE, TRUE },
+ { N_("Set Title"), ACCEL_SET_TERMINAL_TITLE },
+ { N_("Reset"), ACCEL_RESET },
+ { N_("Reset and Clear"), ACCEL_RESET_AND_CLEAR }
};
static KeyEntry tabs_entries[] =
{
- { N_("Switch to Previous Tab"),
- KEY_PREV_TAB, ACCEL_PATH_PREV_TAB, GDK_CONTROL_MASK, GDK_KEY (Page_Up), NULL, FALSE, TRUE },
- { N_("Switch to Next Tab"),
- KEY_NEXT_TAB, ACCEL_PATH_NEXT_TAB, GDK_CONTROL_MASK, GDK_KEY (Page_Down), NULL, FALSE, TRUE },
- { N_("Move Tab to the Left"),
- KEY_MOVE_TAB_LEFT, ACCEL_PATH_MOVE_TAB_LEFT, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY (Page_Up), NULL, FALSE, TRUE },
- { N_("Move Tab to the Right"),
- KEY_MOVE_TAB_RIGHT, ACCEL_PATH_MOVE_TAB_RIGHT, GDK_SHIFT_MASK | GDK_CONTROL_MASK, GDK_KEY (Page_Down), NULL, FALSE, TRUE },
- { N_("Detach Tab"),
- KEY_DETACH_TAB, ACCEL_PATH_DETACH_TAB, 0, 0, NULL, FALSE, TRUE },
- { N_("Switch to Tab 1"),
- KEY_SWITCH_TAB_PREFIX "1",
- ACCEL_PATH_SWITCH_TAB_PREFIX "1", GDK_MOD1_MASK, GDK_KEY (1), NULL, FALSE, TRUE },
- { N_("Switch to Tab 2"),
- KEY_SWITCH_TAB_PREFIX "2",
- ACCEL_PATH_SWITCH_TAB_PREFIX "2", GDK_MOD1_MASK, GDK_KEY (2), NULL, FALSE, TRUE },
- { N_("Switch to Tab 3"),
- KEY_SWITCH_TAB_PREFIX "3",
- ACCEL_PATH_SWITCH_TAB_PREFIX "3", GDK_MOD1_MASK, GDK_KEY (3), NULL, FALSE, TRUE },
- { N_("Switch to Tab 4"),
- KEY_SWITCH_TAB_PREFIX "4",
- ACCEL_PATH_SWITCH_TAB_PREFIX "4", GDK_MOD1_MASK, GDK_KEY (4), NULL, FALSE, TRUE },
- { N_("Switch to Tab 5"),
- KEY_SWITCH_TAB_PREFIX "5",
- ACCEL_PATH_SWITCH_TAB_PREFIX "5", GDK_MOD1_MASK, GDK_KEY (5), NULL, FALSE, TRUE },
- { N_("Switch to Tab 6"),
- KEY_SWITCH_TAB_PREFIX "6",
- ACCEL_PATH_SWITCH_TAB_PREFIX "6", GDK_MOD1_MASK, GDK_KEY (6), NULL, FALSE, TRUE },
- { N_("Switch to Tab 7"),
- KEY_SWITCH_TAB_PREFIX "7",
- ACCEL_PATH_SWITCH_TAB_PREFIX "7", GDK_MOD1_MASK, GDK_KEY (7), NULL, FALSE, TRUE },
- { N_("Switch to Tab 8"),
- KEY_SWITCH_TAB_PREFIX "8",
- ACCEL_PATH_SWITCH_TAB_PREFIX "8", GDK_MOD1_MASK, GDK_KEY (8), NULL, FALSE, TRUE },
- { N_("Switch to Tab 9"),
- KEY_SWITCH_TAB_PREFIX "9",
- ACCEL_PATH_SWITCH_TAB_PREFIX "9", GDK_MOD1_MASK, GDK_KEY (9), NULL, FALSE, TRUE },
- { N_("Switch to Tab 10"),
- KEY_SWITCH_TAB_PREFIX "10",
- ACCEL_PATH_SWITCH_TAB_PREFIX "10", GDK_MOD1_MASK, GDK_KEY (0), NULL, FALSE, TRUE },
- { N_("Switch to Tab 11"),
- KEY_SWITCH_TAB_PREFIX "11",
- ACCEL_PATH_SWITCH_TAB_PREFIX "11", 0, 0, NULL, FALSE, TRUE },
- { N_("Switch to Tab 12"),
- KEY_SWITCH_TAB_PREFIX "12",
- ACCEL_PATH_SWITCH_TAB_PREFIX "12", 0, 0, NULL, FALSE, TRUE }
+ { N_("Switch to Previous Tab"), ACCEL_PREV_TAB },
+ { N_("Switch to Next Tab"), ACCEL_NEXT_TAB },
+ { N_("Move Tab to the Left"), ACCEL_MOVE_TAB_LEFT },
+ { N_("Move Tab to the Right"), ACCEL_MOVE_TAB_RIGHT },
+ { N_("Detach Tab"), ACCEL_DETACH_TAB },
+ { N_("Switch to Tab 1"), ACCEL_SWITCH_TAB_PREFIX "1" },
+ { N_("Switch to Tab 2"), ACCEL_SWITCH_TAB_PREFIX "2" },
+ { N_("Switch to Tab 3"), ACCEL_SWITCH_TAB_PREFIX "3" },
+ { N_("Switch to Tab 4"), ACCEL_SWITCH_TAB_PREFIX "4" },
+ { N_("Switch to Tab 5"), ACCEL_SWITCH_TAB_PREFIX "5" },
+ { N_("Switch to Tab 6"), ACCEL_SWITCH_TAB_PREFIX "6" },
+ { N_("Switch to Tab 7"), ACCEL_SWITCH_TAB_PREFIX "7" },
+ { N_("Switch to Tab 8"), ACCEL_SWITCH_TAB_PREFIX "8" },
+ { N_("Switch to Tab 9"), ACCEL_SWITCH_TAB_PREFIX "9" },
+ { N_("Switch to Tab 10"), ACCEL_SWITCH_TAB_PREFIX "10" },
+ { N_("Switch to Tab 11"), ACCEL_SWITCH_TAB_PREFIX "11" },
+ { N_("Switch to Tab 12"), ACCEL_SWITCH_TAB_PREFIX "12" }
};
static KeyEntry help_entries[] = {
- { N_("Contents"), KEY_HELP, ACCEL_PATH_HELP, 0, GDK_KEY (F1), NULL, FALSE, TRUE }
+ { N_("Contents"), ACCEL_HELP }
};
static KeyEntryList all_entries[] =
@@ -254,41 +153,22 @@ static KeyEntryList all_entries[] =
enum
{
ACTION_COLUMN,
- KEYVAL_COLUMN,
+ ACCEL_PATH_COLUMN,
N_COLUMNS
};
-static void keys_change_notify (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data);
-
-static void accel_changed_callback (GtkAccelGroup *accel_group,
- guint keyval,
- GdkModifierType modifier,
- GClosure *accel_closure,
- gpointer data);
+static void accel_map_changed_callback (GtkAccelMap *accel_map,
+ const char *accel_path,
+ guint keyval,
+ GdkModifierType modifier,
+ gpointer data);
-static gboolean binding_from_string (const char *str,
- guint *accelerator_key,
- GdkModifierType *accelerator_mods);
-
-static gboolean binding_from_value (GConfValue *value,
- guint *accelerator_key,
- GdkModifierType *accelerator_mods);
-
-static gboolean sync_idle_cb (gpointer data);
-
-static guint sync_idle_id = 0;
-static GtkAccelGroup *notification_group = NULL;
-/* never set gconf keys in response to receiving a gconf notify. */
-static int inside_gconf_notify = 0;
+static guint save_id = 0;
static GtkWidget *edit_keys_dialog = NULL;
static GtkTreeStore *edit_keys_store = NULL;
-static guint gconf_notify_id;
-static GHashTable *gconf_key_to_entry;
+static gboolean dirty = FALSE;
-static char*
+static char *
binding_name (guint keyval,
GdkModifierType mask)
{
@@ -298,90 +178,71 @@ binding_name (guint keyval,
return g_strdup ("disabled");
}
-static const char *
-key_from_gconf_key (const char *gconf_key)
+static char *
+get_accel_map_filename (void)
{
- const char *last_slash = strrchr (gconf_key, '/');
- if (last_slash)
- return ++last_slash;
- return NULL;
+ return g_build_filename (g_get_user_config_dir (),
+ "gnome-terminal",
+ "accels",
+ NULL);
}
-void
-terminal_accels_init (void)
+static gboolean
+save_cb (gpointer data)
{
- GConfClient *conf;
- guint i, j;
+ char *path;
- conf = gconf_client_get_default ();
-
- gconf_client_add_dir (conf, CONF_KEYS_PREFIX,
- GCONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
- gconf_notify_id =
- gconf_client_notify_add (conf,
- CONF_KEYS_PREFIX,
- keys_change_notify,
- NULL, NULL, NULL);
-
- gconf_key_to_entry = g_hash_table_new (g_str_hash, g_str_equal);
+ _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
+ "saving accel map");
- notification_group = gtk_accel_group_new ();
+ save_id = 0;
- for (i = 0; i < G_N_ELEMENTS (all_entries); ++i)
- {
- for (j = 0; j < all_entries[i].n_elements; ++j)
- {
- KeyEntry *key_entry;
+ if (!dirty)
+ return FALSE;
- key_entry = &(all_entries[i].key_entry[j]);
+ dirty = FALSE;
- g_hash_table_insert (gconf_key_to_entry,
- (gpointer) key_from_gconf_key (key_entry->gconf_key),
- key_entry);
+ path = get_accel_map_filename ();
+ gtk_accel_map_save (path);
+ g_free (path);
- key_entry->closure = g_closure_new_simple (sizeof (GClosure), key_entry);
+ return FALSE; /* don't run again */
+}
- g_closure_ref (key_entry->closure);
- g_closure_sink (key_entry->closure);
-
- gtk_accel_group_connect_by_path (notification_group,
- I_(key_entry->accel_path),
- key_entry->closure);
+static void
+schedule_save (void)
+{
+ if (save_id != 0)
+ return;
- gconf_client_notify (conf, key_entry->gconf_key);
- }
- }
+ dirty = TRUE;
- g_object_unref (conf);
-
- g_signal_connect (notification_group, "accel-changed",
- G_CALLBACK (accel_changed_callback), NULL);
+ save_id = g_timeout_add_seconds (5, save_cb, NULL);
}
void
-terminal_accels_shutdown (void)
+terminal_accels_init (void)
{
- GConfClient *conf;
+ char *path;
- conf = gconf_client_get_default ();
- gconf_client_notify_remove (conf, gconf_notify_id);
- gconf_client_remove_dir (conf, CONF_KEYS_PREFIX, NULL);
- g_object_unref (conf);
+ g_signal_connect (gtk_accel_map_get (), "changed",
+ G_CALLBACK (accel_map_changed_callback), NULL);
+
+ path = get_accel_map_filename ();
+ gtk_accel_map_load (path);
+ g_free (path);
+}
- if (sync_idle_id != 0)
+void
+terminal_accels_shutdown (void)
+{
+ if (save_id != 0)
{
- g_source_remove (sync_idle_id);
- sync_idle_id = 0;
+ g_source_remove (save_id);
+ save_id = 0;
- sync_idle_cb (NULL);
+ save_cb (NULL);
}
-
- g_hash_table_destroy (gconf_key_to_entry);
- gconf_key_to_entry = NULL;
-
- g_object_unref (notification_group);
- notification_group = NULL;
}
static gboolean
@@ -390,13 +251,10 @@ update_model_foreach (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data)
{
- KeyEntry *key_entry = NULL;
-
- gtk_tree_model_get (model, iter,
- KEYVAL_COLUMN, &key_entry,
- -1);
+ guint accel_path_quark;
- if (key_entry == (KeyEntry *) data)
+ gtk_tree_model_get (model, iter, ACCEL_PATH_COLUMN, &accel_path_quark, -1);
+ if (accel_path_quark == GPOINTER_TO_UINT (data))
{
gtk_tree_model_row_changed (model, path, iter);
return TRUE;
@@ -405,226 +263,20 @@ update_model_foreach (GtkTreeModel *model,
}
static void
-keys_change_notify (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
-{
- GConfValue *val;
- KeyEntry *key_entry;
- GdkModifierType mask;
- guint keyval;
-
- _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
- "key %s changed\n",
- gconf_entry_get_key (entry));
-
- val = gconf_entry_get_value (entry);
-
-#ifdef GNOME_ENABLE_DEBUG
- _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS)
- {
- if (val == NULL)
- _terminal_debug_print (TERMINAL_DEBUG_ACCELS, " changed to be unset\n");
- else if (val->type != GCONF_VALUE_STRING)
- _terminal_debug_print (TERMINAL_DEBUG_ACCELS, " changed to non-string value\n");
- else
- _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
- " changed to \"%s\"\n",
- gconf_value_get_string (val));
- }
-#endif
-
- key_entry = g_hash_table_lookup (gconf_key_to_entry, key_from_gconf_key (gconf_entry_get_key (entry)));
- if (!key_entry)
- {
- /* shouldn't really happen, but let's be safe */
- _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
- " WARNING: KeyEntry for changed key not found, bailing out\n");
- return;
- }
-
- if (!binding_from_value (val, &keyval, &mask))
- {
- const char *str = val->type == GCONF_VALUE_STRING ? gconf_value_get_string (val) : NULL;
- g_printerr ("The value \"%s\" of configuration key %s is not a valid accelerator\n",
- str ? str : "(null)",
- key_entry->gconf_key);
- return;
- }
-
- key_entry->gconf_keyval = keyval;
- key_entry->gconf_mask = mask;
-
- /* Unlock the path, so we can change its accel */
- if (!key_entry->accel_path_unlocked)
- gtk_accel_map_unlock_path (key_entry->accel_path);
-
- /* sync over to GTK */
- _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
- "changing path %s to %s\n",
- key_entry->accel_path,
- binding_name (keyval, mask)); /* memleak */
- inside_gconf_notify += 1;
- /* Note that this may return FALSE, e.g. when the entry was already set correctly. */
- gtk_accel_map_change_entry (key_entry->accel_path,
- keyval, mask,
- TRUE);
- inside_gconf_notify -= 1;
-
- /* Lock the path if the gconf key isn't writable */
- key_entry->accel_path_unlocked = gconf_entry_get_is_writable (entry);
- if (!key_entry->accel_path_unlocked)
- gtk_accel_map_lock_path (key_entry->accel_path);
-
- /* This seems necessary to update the tree model, since sometimes the
- * notification on the notification_group seems not to be emitted correctly.
- * Without this change, when trying to set an accel to e.g. Alt-T (while the main
- * menu in the terminal windows is _Terminal with Alt-T mnemonic) only displays
- * the accel change after a re-expose of the row.
- * FIXME: Find out *why* the accel-changed signal is wrong here!
- */
- if (edit_keys_store)
- gtk_tree_model_foreach (GTK_TREE_MODEL (edit_keys_store), update_model_foreach, key_entry);
-}
-
-static void
-accel_changed_callback (GtkAccelGroup *accel_group,
- guint keyval,
- GdkModifierType modifier,
- GClosure *accel_closure,
- gpointer data)
-{
- /* FIXME because GTK accel API is so nonsensical, we get
- * a notify for each closure, on both the added and the removed
- * accelerator. We just use the accel closure to find our
- * accel entry, then update the value of that entry.
- * We use an idle function to avoid setting the entry
- * in gconf when the accelerator gets removed and then
- * setting it again when it gets added.
- */
- KeyEntry *key_entry;
-
- _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
- "Changed accel %s closure %p\n",
- binding_name (keyval, modifier), /* memleak */
- accel_closure);
-
- if (inside_gconf_notify)
- {
- _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
- "Ignoring change from gtk because we're inside a gconf notify\n");
- return;
- }
-
- key_entry = accel_closure->data;
- g_assert (key_entry);
-
- key_entry->needs_gconf_sync = TRUE;
-
- if (sync_idle_id == 0)
- sync_idle_id = g_idle_add (sync_idle_cb, NULL);
-}
-
-static gboolean
-binding_from_string (const char *str,
- guint *accelerator_key,
- GdkModifierType *accelerator_mods)
-{
- if (str == NULL ||
- strcmp (str, "disabled") == 0)
- {
- *accelerator_key = 0;
- *accelerator_mods = 0;
- return TRUE;
- }
-
- gtk_accelerator_parse (str, accelerator_key, accelerator_mods);
- if (*accelerator_key == 0 &&
- *accelerator_mods == 0)
- return FALSE;
-
- return TRUE;
-}
-
-static gboolean
-binding_from_value (GConfValue *value,
- guint *accelerator_key,
- GdkModifierType *accelerator_mods)
-{
- if (value == NULL)
- {
- /* unset */
- *accelerator_key = 0;
- *accelerator_mods = 0;
- return TRUE;
- }
-
- if (value->type != GCONF_VALUE_STRING)
- return FALSE;
-
- return binding_from_string (gconf_value_get_string (value),
- accelerator_key,
- accelerator_mods);
-}
-
-static void
-add_key_entry_to_changeset (gpointer key,
- KeyEntry *key_entry,
- GConfChangeSet *changeset)
+accel_map_changed_callback (GtkAccelMap *accel_map,
+ const char *accel_path,
+ guint keyval,
+ GdkModifierType modifier,
+ gpointer data)
{
- GtkAccelKey gtk_key;
-
- if (!key_entry->needs_gconf_sync)
- return;
-
- key_entry->needs_gconf_sync = FALSE;
-
- if (gtk_accel_map_lookup_entry (key_entry->accel_path, >k_key) &&
- (gtk_key.accel_key != key_entry->gconf_keyval ||
- gtk_key.accel_mods != key_entry->gconf_mask))
- {
- char *accel_name;
-
- accel_name = binding_name (gtk_key.accel_key, gtk_key.accel_mods);
- gconf_change_set_set_string (changeset, key_entry->gconf_key, accel_name);
- g_free (accel_name);
- }
-}
-
-static gboolean
-sync_idle_cb (gpointer data)
-{
- GConfClient *conf;
- GConfChangeSet *changeset;
- GError *error = NULL;
-
_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
- "gconf sync handler\n");
-
- sync_idle_id = 0;
-
- conf = gconf_client_get_default ();
+ "Changed accel path %s to %s\n",
+ accel_path,
+ binding_name (keyval, modifier) /* memleak */);
- changeset = gconf_change_set_new ();
- g_hash_table_foreach (gconf_key_to_entry, (GHFunc) add_key_entry_to_changeset, changeset);
- if (!gconf_client_commit_change_set (conf, changeset, TRUE, &error))
- {
- g_printerr ("Error committing the accelerator changeset: %s\n", error->message);
- g_error_free (error);
- }
-
- gconf_change_set_unref (changeset);
- g_object_unref (conf);
-
- return FALSE;
+ schedule_save ();
}
-/* We have the same KeyEntry* in both columns;
- * we only have two columns because we want to be able
- * to sort by either one of them.
- */
-
static void
accel_set_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
@@ -632,35 +284,46 @@ accel_set_func (GtkTreeViewColumn *tree_column,
GtkTreeIter *iter,
gpointer data)
{
- KeyEntry *ke;
-
- gtk_tree_model_get (model, iter,
- KEYVAL_COLUMN, &ke,
- -1);
+ guint accel_path_quark;
+ GtkAccelKey key;
- if (ke == NULL)
+ gtk_tree_model_get (model, iter, ACCEL_PATH_COLUMN, &accel_path_quark, -1);
+ if (accel_path_quark == 0) {
/* This is a title row */
g_object_set (cell,
"visible", FALSE,
NULL);
+ return;
+ }
+
+ if (gtk_accel_map_lookup_entry (g_quark_to_string (accel_path_quark), &key))
+ g_object_set (cell,
+ "visible", TRUE,
+ "sensitive", (key.accel_flags & GTK_ACCEL_LOCKED) == 0,
+ "editable", (key.accel_flags & GTK_ACCEL_LOCKED) == 0,
+ "accel-key", key.accel_key,
+ "accel-mods", (guint) key.accel_mods,
+ NULL);
else
g_object_set (cell,
"visible", TRUE,
- "sensitive", ke->accel_path_unlocked,
- "editable", ke->accel_path_unlocked,
- "accel-key", ke->gconf_keyval,
- "accel-mods", ke->gconf_mask,
- NULL);
+ "sensitive", TRUE,
+ "editable", TRUE,
+ "accel-key", (guint) 0,
+ "accel-mods", (guint) 0,
+ NULL);
}
static void
-treeview_accel_changed_cb (GtkAccelGroup *accel_group,
- guint keyval,
- GdkModifierType modifier,
- GClosure *accel_closure,
- GtkTreeModel *model)
+treeview_accel_map_changed_cb (GtkAccelMap *accel_map,
+ const char *accel_path,
+ guint keyval,
+ GdkModifierType modifier,
+ GtkTreeModel *model)
{
- gtk_tree_model_foreach (model, update_model_foreach, accel_closure->data);
+ gtk_tree_model_foreach (model,
+ update_model_foreach,
+ GUINT_TO_POINTER (g_quark_from_string (accel_path)));
}
static void
@@ -674,11 +337,7 @@ accel_edited_callback (GtkCellRendererAccel *cell,
GtkTreeModel *model;
GtkTreePath *path;
GtkTreeIter iter;
- KeyEntry *ke;
- GtkAccelGroupEntry *entries;
- guint n_entries;
- char *str;
- GConfClient *conf;
+ guint accel_path_quark;
model = gtk_tree_view_get_model (view);
@@ -692,74 +351,12 @@ accel_edited_callback (GtkCellRendererAccel *cell,
}
gtk_tree_path_free (path);
- gtk_tree_model_get (model, &iter, KEYVAL_COLUMN, &ke, -1);
-
+ gtk_tree_model_get (model, &iter, ACCEL_PATH_COLUMN, &accel_path_quark, -1);
/* sanity check */
- if (ke == NULL)
+ if (accel_path_quark == 0)
return;
- /* Check if we already have an entry using this accel */
- entries = gtk_accel_group_query (notification_group, keyval, mask, &n_entries);
- if (n_entries > 0)
- {
- if (entries[0].accel_path_quark != g_quark_from_string (ke->accel_path))
- {
- GtkWidget *dialog;
- char *name;
- KeyEntry *other_key;
-
- name = gtk_accelerator_get_label (keyval, mask);
- other_key = entries[0].closure->data;
- g_assert (other_key);
-
- dialog =
- gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))),
- GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- _("The shortcut key â%sâ is already bound to the â%sâ action"),
- name,
- other_key->user_visible_name ? _(other_key->user_visible_name) : other_key->gconf_key);
- g_free (name);
-
- g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
- gtk_window_present (GTK_WINDOW (dialog));
- }
-
- return;
- }
-
- str = binding_name (keyval, mask);
-
- _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
- "Edited path %s keyval %s, setting gconf to %s\n",
- ke->accel_path,
- gdk_keyval_name (keyval) ? gdk_keyval_name (keyval) : "null",
- str);
-#ifdef GNOME_ENABLE_DEBUG
- _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS)
- {
- GtkAccelKey old_key;
-
- if (gtk_accel_map_lookup_entry (ke->accel_path, &old_key)) {
- _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
- " Old entry of path %s is keyval %s mask %x\n",
- ke->accel_path, gdk_keyval_name (old_key.accel_key), old_key.accel_mods);
- } else {
- _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
- " Failed to look up the old entry of path %s\n",
- ke->accel_path);
- }
- }
-#endif
-
- conf = gconf_client_get_default ();
- gconf_client_set_string (conf,
- ke->gconf_key,
- str,
- NULL);
- g_object_unref (conf);
- g_free (str);
+ gtk_accel_map_change_entry (g_quark_to_string (accel_path_quark), keyval, mask, TRUE);
}
static void
@@ -770,9 +367,7 @@ accel_cleared_callback (GtkCellRendererAccel *cell,
GtkTreeModel *model;
GtkTreePath *path;
GtkTreeIter iter;
- KeyEntry *ke;
- char *str;
- GConfClient *conf;
+ guint accel_path_quark;
model = gtk_tree_view_get_model (view);
@@ -786,36 +381,21 @@ accel_cleared_callback (GtkCellRendererAccel *cell,
}
gtk_tree_path_free (path);
- gtk_tree_model_get (model, &iter, KEYVAL_COLUMN, &ke, -1);
-
+ gtk_tree_model_get (model, &iter, ACCEL_PATH_COLUMN, &accel_path_quark, -1);
/* sanity check */
- if (ke == NULL)
+ if (accel_path_quark == 0)
return;
- ke->gconf_keyval = 0;
- ke->gconf_mask = 0;
- ke->needs_gconf_sync = TRUE;
-
- str = binding_name (0, 0);
-
- _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
- "Cleared keybinding for gconf %s",
- ke->gconf_key);
-
- conf = gconf_client_get_default ();
- gconf_client_set_string (conf,
- ke->gconf_key,
- str,
- NULL);
- g_object_unref (conf);
- g_free (str);
+ gtk_accel_map_change_entry (g_quark_to_string (accel_path_quark), 0, 0, TRUE);
}
static void
edit_keys_dialog_destroy_cb (GtkWidget *widget,
gpointer user_data)
{
- g_signal_handlers_disconnect_by_func (notification_group, G_CALLBACK (treeview_accel_changed_cb), user_data);
+ g_signal_handlers_disconnect_by_func (gtk_accel_map_get (),
+ G_CALLBACK (treeview_accel_map_changed_cb),
+ user_data);
edit_keys_dialog = NULL;
edit_keys_store = NULL;
}
@@ -824,36 +404,24 @@ static void
edit_keys_dialog_response_cb (GtkWidget *editor,
int response,
gpointer use_data)
-{
+{
if (response == GTK_RESPONSE_HELP)
{
terminal_util_show_help ("gnome-terminal-shortcuts", GTK_WINDOW (editor));
return;
}
-
- gtk_widget_destroy (editor);
-}
-#ifdef GNOME_ENABLE_DEBUG
-static void
-row_changed (GtkTreeModel *tree_model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gpointer user_data)
-{
- _terminal_debug_print (TERMINAL_DEBUG_ACCELS,
- "ROW-CHANGED [%s]\n", gtk_tree_path_to_string (path) /* leak */);
+ gtk_widget_destroy (editor);
}
-#endif
void
terminal_edit_keys_dialog_show (GtkWindow *transient_parent)
{
- TerminalApp *app;
GtkWidget *dialog, *tree_view, *disable_mnemonics_button, *disable_menu_accel_button;
GtkTreeViewColumn *column;
GtkCellRenderer *cell_renderer;
GtkTreeStore *tree;
+ GSettings *settings;
guint i;
if (edit_keys_dialog != NULL)
@@ -867,11 +435,19 @@ terminal_edit_keys_dialog_show (GtkWindow *transient_parent)
NULL))
return;
- app = terminal_app_get ();
- terminal_util_bind_object_property_to_widget (G_OBJECT (app), TERMINAL_APP_ENABLE_MNEMONICS,
- disable_mnemonics_button, 0);
- terminal_util_bind_object_property_to_widget (G_OBJECT (app), TERMINAL_APP_ENABLE_MENU_BAR_ACCEL,
- disable_menu_accel_button, 0);
+ terminal_util_bind_mnemonic_label_sensitivity (dialog);
+
+ settings = terminal_app_get_global_settings (terminal_app_get ());
+ g_settings_bind (settings,
+ TERMINAL_SETTING_ENABLE_MNEMONICS_KEY,
+ disable_mnemonics_button,
+ "active",
+ G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ g_settings_bind (settings,
+ TERMINAL_SETTING_ENABLE_MENU_BAR_ACCEL_KEY,
+ disable_menu_accel_button,
+ "active",
+ G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
/* Column 1 */
cell_renderer = gtk_cell_renderer_text_new ();
@@ -891,7 +467,7 @@ terminal_edit_keys_dialog_show (GtkWindow *transient_parent)
G_CALLBACK (accel_edited_callback), tree_view);
g_signal_connect (cell_renderer, "accel-cleared",
G_CALLBACK (accel_cleared_callback), tree_view);
-
+
column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, _("Shortcut _Key"));
gtk_tree_view_column_pack_start (column, cell_renderer, TRUE);
@@ -900,42 +476,43 @@ terminal_edit_keys_dialog_show (GtkWindow *transient_parent)
/* Add the data */
- tree = edit_keys_store = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER);
-
-#ifdef GNOME_ENABLE_DEBUG
- _TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS)
- g_signal_connect (tree, "row-changed", G_CALLBACK (row_changed), NULL);
-#endif
+ tree = edit_keys_store = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_UINT);
for (i = 0; i < G_N_ELEMENTS (all_entries); ++i)
{
GtkTreeIter parent_iter;
guint j;
- gtk_tree_store_append (tree, &parent_iter, NULL);
- gtk_tree_store_set (tree, &parent_iter,
- ACTION_COLUMN, _(all_entries[i].user_visible_name),
- -1);
+ gtk_tree_store_insert_with_values (tree, &parent_iter, NULL, -1,
+ ACTION_COLUMN, _(all_entries[i].user_visible_name),
+ ACCEL_PATH_COLUMN, 0,
+ -1);
for (j = 0; j < all_entries[i].n_elements; ++j)
{
KeyEntry *key_entry = &(all_entries[i].key_entry[j]);
GtkTreeIter iter;
+ char *accel_path;
+ accel_path = g_strconcat (ACCEL_PATH_ROOT, key_entry->accel_path_suffix, NULL);
gtk_tree_store_insert_with_values (tree, &iter, &parent_iter, -1,
ACTION_COLUMN, _(key_entry->user_visible_name),
- KEYVAL_COLUMN, key_entry,
+ ACCEL_PATH_COLUMN, g_quark_from_string (accel_path),
-1);
+ g_free (accel_path);
}
}
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (tree), ACTION_COLUMN,
+ GTK_SORT_ASCENDING);
+
gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL (tree));
g_object_unref (tree);
gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view));
- g_signal_connect (notification_group, "accel-changed",
- G_CALLBACK (treeview_accel_changed_cb), tree);
+ g_signal_connect (gtk_accel_map_get (), "changed",
+ G_CALLBACK (treeview_accel_map_changed_cb), tree);
edit_keys_dialog = dialog;
g_signal_connect (dialog, "destroy",
diff --git a/src/terminal-accels.h b/src/terminal-accels.h
index ee2cc6a..6e28377 100644
--- a/src/terminal-accels.h
+++ b/src/terminal-accels.h
@@ -1,18 +1,18 @@
/*
* Copyright  2001 Havoc Pennington
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * This programme is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * This programme is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
+ * You should have received a copy of the GNU General Public
+ * License along with this programme; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
diff --git a/src/terminal-app.c b/src/terminal-app.c
index 0f198e7..a89afec 100644
--- a/src/terminal-app.c
+++ b/src/terminal-app.c
@@ -3,7 +3,7 @@
* Copyright  2002 Red Hat, Inc.
* Copyright  2002 Sun Microsystems
* Copyright  2003 Mariano Suarez-Alvarez
- * Copyright  2008 Christian Persch
+ * Copyright  2008, 2010, 2011 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
@@ -36,7 +36,7 @@
#include "terminal-util.h"
#include "profile-editor.h"
#include "terminal-encoding.h"
-#include <gconf/gconf-client.h>
+#include "terminal-schemas.h"
#include <string.h>
#include <stdlib.h>
#include <time.h>
@@ -48,32 +48,18 @@
#endif
#endif
-#define FALLBACK_PROFILE_ID "Default"
#define DESKTOP_INTERFACE_SETTINGS_SCHEMA "org.gnome.desktop.interface"
#define MONOSPACE_FONT_KEY_NAME "monospace-font-name"
#define SYSTEM_PROXY_SETTINGS_SCHEMA "org.gnome.system.proxy"
-/* Settings storage works as follows:
- * /apps/gnome-terminal/global/
- * /apps/gnome-terminal/profiles/Foo/
- *
- * It's somewhat tricky to manage the profiles/ dir since we need to track
- * the list of profiles, but gconf doesn't have a concept of notifying that
- * a directory has appeared or disappeared.
- *
+/*
* Session state is stored entirely in the RestartCommand command line.
*
* The number one rule: all stored information is EITHER per-session,
* per-profile, or set from a command line option. THERE CAN BE NO
* OVERLAP. The UI and implementation totally break if you overlap
* these categories. See gnome-terminal 1.x for why.
- *
- * Don't use this code as an example of how to use GConf - it's hugely
- * overcomplicated due to the profiles stuff. Most apps should not
- * have to do scary things of this nature, and should not have
- * a profiles feature.
- *
*/
struct _TerminalAppClass {
@@ -97,36 +83,15 @@ struct _TerminalApp
GtkWidget *manage_profiles_delete_button;
GtkWidget *manage_profiles_default_menu;
- GConfClient *conf;
- guint profile_list_notify_id;
- guint default_profile_notify_id;
- guint encoding_list_notify_id;
- guint enable_mnemonics_notify_id;
- guint enable_menu_accels_notify_id;
-
- GSettings *desktop_interface_settings;
- GSettings *system_proxy_settings;
-
GHashTable *profiles;
- char* default_profile_id;
- TerminalProfile *default_profile;
- gboolean default_profile_locked;
GHashTable *encodings;
gboolean encodings_locked;
- PangoFontDescription *system_font_desc;
- gboolean enable_mnemonics;
- gboolean enable_menu_accels;
-};
-
-enum
-{
- PROP_0,
- PROP_DEFAULT_PROFILE,
- PROP_ENABLE_MENU_BAR_ACCEL,
- PROP_ENABLE_MNEMONICS,
- PROP_SYSTEM_FONT,
+ GSettings *global_settings;
+ GSettings *profiles_settings;
+ GSettings *desktop_interface_settings;
+ GSettings *system_proxy_settings;
};
enum
@@ -153,22 +118,6 @@ enum
static TerminalApp *global_app = NULL;
-/* Evil hack alert: this is exported from libgconf-2 but not in a public header */
-extern gboolean gconf_spawn_daemon(GError** err);
-
-#define DEFAULT_MONOSPACE_FONT ("Monospace 10")
-
-#define ENABLE_MNEMONICS_KEY CONF_GLOBAL_PREFIX "/use_mnemonics"
-#define DEFAULT_ENABLE_MNEMONICS (TRUE)
-
-#define ENABLE_MENU_BAR_ACCEL_KEY CONF_GLOBAL_PREFIX"/use_menu_accelerators"
-#define DEFAULT_ENABLE_MENU_BAR_ACCEL (TRUE)
-
-#define PROFILE_LIST_KEY CONF_GLOBAL_PREFIX "/profile_list"
-#define DEFAULT_PROFILE_KEY CONF_GLOBAL_PREFIX "/default_profile"
-
-#define ENCODING_LIST_KEY CONF_GLOBAL_PREFIX "/active_encodings"
-
/* Helper functions */
static GdkScreen*
@@ -229,8 +178,7 @@ terminal_app_get_screen_by_display_name (const char *display_name,
return screen;
}
-/* Menubar mnemonics settings handling */
-
+#if 0
static int
profiles_alphabetic_cmp (gconstpointer pa,
gconstpointer pb)
@@ -239,11 +187,11 @@ profiles_alphabetic_cmp (gconstpointer pa,
TerminalProfile *b = (TerminalProfile *) pb;
int result;
- result = g_utf8_collate (terminal_profile_get_property_string (a, TERMINAL_PROFILE_VISIBLE_NAME),
- terminal_profile_get_property_string (b, TERMINAL_PROFILE_VISIBLE_NAME));
+ result = g_utf8_collate (terminal_profile_get_property_string (a, TERMINAL_PROFILE_VISIBLE_NAME_KEY),
+ terminal_profile_get_property_string (b, TERMINAL_PROFILE_VISIBLE_NAME_KEY));
if (result == 0)
- result = strcmp (terminal_profile_get_property_string (a, TERMINAL_PROFILE_NAME),
- terminal_profile_get_property_string (b, TERMINAL_PROFILE_NAME));
+ result = strcmp (terminal_profile_get_property_string (a, TERMINAL_PROFILE_NAME_KEY),
+ terminal_profile_get_property_string (b, TERMINAL_PROFILE_NAME_KEY));
return result;
}
@@ -262,10 +210,11 @@ profiles_lookup_by_visible_name_foreach (gpointer key,
LookupInfo *info = data;
const char *name;
- name = terminal_profile_get_property_string (value, TERMINAL_PROFILE_VISIBLE_NAME);
+ name = terminal_profile_get_property_string (value, TERMINAL_PROFILE_VISIBLE_NAME_KEY);
if (name && strcmp (info->target, name) == 0)
info->result = value;
}
+#endif
static void
terminal_window_destroyed (TerminalWindow *window,
@@ -277,6 +226,8 @@ terminal_window_destroyed (TerminalWindow *window,
g_signal_emit (app, signals[QUIT], 0);
}
+#if 0
+
static TerminalProfile *
terminal_app_create_profile (TerminalApp *app,
const char *name)
@@ -288,13 +239,13 @@ terminal_app_create_profile (TerminalApp *app,
profile = _terminal_profile_new (name);
g_hash_table_insert (app->profiles,
- g_strdup (terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME)),
+ g_strdup (terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME_KEY)),
profile /* adopts the refcount */);
if (app->default_profile == NULL &&
app->default_profile_id != NULL &&
strcmp (app->default_profile_id,
- terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME)) == 0)
+ terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME_KEY)) == 0)
{
/* We are the default profile */
app->default_profile = profile;
@@ -315,7 +266,7 @@ terminal_app_delete_profile (TerminalApp *app,
GError *error = NULL;
const char **nameptr = &name;
- profile_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME);
+ profile_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME_KEY);
gconf_dir = gconf_concat_dir_and_key (CONF_PREFIX "/profiles", profile_name);
name_list = NULL;
@@ -515,7 +466,7 @@ profile_combo_box_changed_cb (GtkWidget *widget,
gconf_client_set_string (app->conf,
CONF_GLOBAL_PREFIX "/default_profile",
- terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME),
+ terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME_KEY),
NULL);
/* Even though the gconf change notification does this, it happens too late.
@@ -634,7 +585,7 @@ profile_list_delete_button_clicked_cb (GtkWidget *button,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
_("Delete profile â%sâ?"),
- terminal_profile_get_property_string (selected_profile, TERMINAL_PROFILE_VISIBLE_NAME));
+ terminal_profile_get_property_string (selected_profile, TERMINAL_PROFILE_VISIBLE_NAME_KEY));
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL,
@@ -735,7 +686,7 @@ find_profile_link (GList *profiles,
{
const char *profile_name;
- profile_name = terminal_profile_get_property_string (TERMINAL_PROFILE (l->data), TERMINAL_PROFILE_NAME);
+ profile_name = terminal_profile_get_property_string (TERMINAL_PROFILE (l->data), TERMINAL_PROFILE_NAME_KEY);
if (profile_name && strcmp (profile_name, name) == 0)
break;
}
@@ -744,154 +695,54 @@ find_profile_link (GList *profiles,
}
static void
-terminal_app_profile_list_notify_cb (GConfClient *conf,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
+terminal_app_profiles_children_changed_cb (GSettings *settings,
+ TerminalApp *app)
{
- TerminalApp *app = TERMINAL_APP (user_data);
GObject *object = G_OBJECT (app);
- GConfValue *val;
- GSList *value_list, *sl;
- GList *profiles_to_delete, *l;
- gboolean need_new_default;
- TerminalProfile *fallback;
- guint count;
+ char **profile_names;
+ gpointer *new_profiles;
+ guint i, n_profile_names;
g_object_freeze_notify (object);
- profiles_to_delete = terminal_app_get_profile_list (app);
+ profile_names = g_settings_list_children (settings);
+ n_profile_names = g_strv_length (profile_names);
+ /* There's always going to at least the the 'default' child */
+ g_assert (g_strv_length (profile_names) >= 1);
- val = gconf_entry_get_value (entry);
- if (val == NULL ||
- val->type != GCONF_VALUE_LIST ||
- gconf_value_get_list_type (val) != GCONF_VALUE_STRING)
- goto ensure_one_profile;
-
- value_list = gconf_value_get_list (val);
-
- /* Add any new ones */
- for (sl = value_list; sl != NULL; sl = sl->next)
+ new_profiles = g_newa (gpointer, n_profile_names);
+ for (i = 0; i < n_profile_names; ++i)
{
- GConfValue *listvalue = (GConfValue *) (sl->data);
- const char *profile_name;
- GList *link;
+ const char *profile_name = profile_names[i];
+ GSettings *profile;
- profile_name = gconf_value_get_string (listvalue);
- if (!profile_name)
- continue;
-
- link = find_profile_link (profiles_to_delete, profile_name);
- if (link)
- /* make profiles_to_delete point to profiles we didn't find in the list */
- profiles_to_delete = g_list_delete_link (profiles_to_delete, link);
+ profile = g_hash_table_lookup (app->profiles, profile_name);
+ if (profile != NULL)
+ new_profiles[i] = g_object_ref (profile);
else
- terminal_app_create_profile (app, profile_name);
+ new_profiles[i] = g_settings_get_child (settings, profile_name);
}
-ensure_one_profile:
-
- fallback = NULL;
- count = g_hash_table_size (app->profiles);
- if (count == 0 || count <= g_list_length (profiles_to_delete))
- {
- /* We are going to run out, so create the fallback
- * to be sure we always have one. Must be done
- * here before we emit "forgotten" signals so that
- * screens have a profile to fall back to.
- *
- * If the profile with the FALLBACK_ID already exists,
- * we aren't allowed to delete it, unless at least one
- * other profile will still exist. And if you delete
- * all profiles, the FALLBACK_ID profile returns as
- * the living dead.
- */
- fallback = terminal_app_get_profile_by_name (app, FALLBACK_PROFILE_ID);
- if (fallback == NULL)
- fallback = terminal_app_create_profile (app, FALLBACK_PROFILE_ID);
- g_assert (fallback != NULL);
- }
-
- /* Forget no-longer-existing profiles */
- need_new_default = FALSE;
- for (l = profiles_to_delete; l != NULL; l = l->next)
- {
- TerminalProfile *profile = TERMINAL_PROFILE (l->data);
- const char *name;
-
- name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME);
- if (strcmp (name, FALLBACK_PROFILE_ID) == 0)
- continue;
-
- if (profile == app->default_profile)
- {
- app->default_profile = NULL;
- need_new_default = TRUE;
- }
-
- _terminal_profile_forget (profile);
- g_hash_table_remove (app->profiles, name);
+ g_hash_table_remove_all (app->profiles);
+ for (i = 0; i < n_profile_names; ++i)
+ if (new_profiles[i] != NULL)
+ g_hash_table_insert (app->profiles,
+ g_strdup (profile_names[i]),
+ new_profiles[i] /* adopted */);
- /* |profile| possibly isn't dead yet since the profiles dialogue's tree model holds a ref too... */
- }
- g_list_free (profiles_to_delete);
+ g_strfreev (profile_names);
- if (need_new_default)
- {
- TerminalProfile *new_default;
- TerminalProfile **new_default_ptr = &new_default;
+ g_assert (g_hash_table_size (app->profiles) >= 1);
- new_default = terminal_app_get_profile_by_name (app, FALLBACK_PROFILE_ID);
- if (new_default == NULL)
- {
- GHashTableIter iter;
-
- g_hash_table_iter_init (&iter, app->profiles);
- if (!g_hash_table_iter_next (&iter, NULL, (gpointer *) new_default_ptr))
- /* shouldn't really happen ever, but just to be safe */
- new_default = terminal_app_create_profile (app, FALLBACK_PROFILE_ID);
- }
- g_assert (new_default != NULL);
-
- app->default_profile = new_default;
-
- g_object_notify (object, TERMINAL_APP_DEFAULT_PROFILE);
- }
-
- g_assert (g_hash_table_size (app->profiles) > 0);
+ // FIXME: re-set profile on any tabs having a profile NOT in the new list?
+ // or just continue to use the now-defunct ones?
g_signal_emit (app, signals[PROFILE_LIST_CHANGED], 0);
g_object_thaw_notify (object);
}
-static void
-terminal_app_default_profile_notify_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
-{
- TerminalApp *app = TERMINAL_APP (user_data);
- GConfValue *val;
- const char *name = NULL;
-
- app->default_profile_locked = !gconf_entry_get_is_writable (entry);
-
- val = gconf_entry_get_value (entry);
- if (val != NULL &&
- val->type == GCONF_VALUE_STRING)
- name = gconf_value_get_string (val);
- if (!name || !name[0])
- name = FALLBACK_PROFILE_ID;
- g_assert (name != NULL);
-
- g_free (app->default_profile_id);
- app->default_profile_id = g_strdup (name);
-
- app->default_profile = terminal_app_get_profile_by_name (app, name);
-
- g_object_notify (G_OBJECT (app), TERMINAL_APP_DEFAULT_PROFILE);
-}
+#endif /* 0 */
static int
compare_encodings (TerminalEncoding *a,
@@ -912,18 +763,15 @@ encoding_mark_active (gpointer key,
}
static void
-terminal_app_encoding_list_notify_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
-{
- TerminalApp *app = TERMINAL_APP (user_data);
- GConfValue *val;
- GSList *strings, *tmp;
+terminal_app_encoding_list_notify_cb (GSettings *settings,
+ const char *key,
+ TerminalApp *app)
+{
+ char **encodings;
+ int i;
TerminalEncoding *encoding;
- const char *charset;
- app->encodings_locked = !gconf_entry_get_is_writable (entry);
+ app->encodings_locked = !g_settings_is_writable (settings, key);
/* Mark all as non-active, then re-enable the active ones */
g_hash_table_foreach (app->encodings, (GHFunc) encoding_mark_active, GUINT_TO_POINTER (FALSE));
@@ -940,112 +788,20 @@ terminal_app_encoding_list_notify_cb (GConfClient *client,
if (terminal_encoding_is_valid (encoding))
encoding->is_active = TRUE;
- val = gconf_entry_get_value (entry);
- if (val != NULL &&
- val->type == GCONF_VALUE_LIST &&
- gconf_value_get_list_type (val) == GCONF_VALUE_STRING)
- strings = gconf_value_get_list (val);
- else
- strings = NULL;
-
- for (tmp = strings; tmp != NULL; tmp = tmp->next)
- {
- GConfValue *v = (GConfValue *) tmp->data;
-
- charset = gconf_value_get_string (v);
- if (!charset)
- continue;
-
- encoding = terminal_app_ensure_encoding (app, charset);
+ g_settings_get (settings, key, "^a&s", &encodings);
+ for (i = 0; encodings[i] != NULL; ++i) {
+ encoding = terminal_app_ensure_encoding (app, encodings[i]);
if (!terminal_encoding_is_valid (encoding))
continue;
encoding->is_active = TRUE;
}
+ g_free (encodings);
g_signal_emit (app, signals[ENCODING_LIST_CHANGED], 0);
}
-static void
-terminal_app_system_font_notify_cb (GSettings *settings,
- const char *key,
- TerminalApp *app)
-{
- const char *font = NULL;
- PangoFontDescription *font_desc;
-
- g_settings_get (settings, MONOSPACE_FONT_KEY_NAME, "&s", &font);
-
- font_desc = pango_font_description_from_string (font);
- if (app->system_font_desc &&
- pango_font_description_equal (app->system_font_desc, font_desc))
- {
- pango_font_description_free (font_desc);
- return;
- }
-
- if (app->system_font_desc)
- pango_font_description_free (app->system_font_desc);
-
- app->system_font_desc = font_desc;
-
- g_object_notify (G_OBJECT (app), TERMINAL_APP_SYSTEM_FONT);
-}
-
-static void
-terminal_app_enable_mnemonics_notify_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
-{
- TerminalApp *app = TERMINAL_APP (user_data);
- GConfValue *gconf_value;
- gboolean enable;
-
- if (strcmp (gconf_entry_get_key (entry), ENABLE_MNEMONICS_KEY) != 0)
- return;
-
- gconf_value = gconf_entry_get_value (entry);
- if (gconf_value &&
- gconf_value->type == GCONF_VALUE_BOOL)
- enable = gconf_value_get_bool (gconf_value);
- else
- enable = TRUE;
-
- if (enable == app->enable_mnemonics)
- return;
-
- app->enable_mnemonics = enable;
- g_object_notify (G_OBJECT (app), TERMINAL_APP_ENABLE_MNEMONICS);
-}
-
-static void
-terminal_app_enable_menu_accels_notify_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
-{
- TerminalApp *app = TERMINAL_APP (user_data);
- GConfValue *gconf_value;
- gboolean enable;
-
- if (strcmp (gconf_entry_get_key (entry), ENABLE_MENU_BAR_ACCEL_KEY) != 0)
- return;
-
- gconf_value = gconf_entry_get_value (entry);
- if (gconf_value &&
- gconf_value->type == GCONF_VALUE_BOOL)
- enable = gconf_value_get_bool (gconf_value);
- else
- enable = TRUE;
-
- if (enable == app->enable_menu_accels)
- return;
-
- app->enable_menu_accels = enable;
- g_object_notify (G_OBJECT (app), TERMINAL_APP_ENABLE_MENU_BAR_ACCEL);
-}
-
+#if 0
static void
new_profile_response_cb (GtkWidget *new_profile_dialog,
int response_id,
@@ -1083,7 +839,7 @@ new_profile_response_cb (GtkWidget *new_profile_dialog,
TerminalProfile *profile = tmp->data;
const char *visible_name;
- visible_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_VISIBLE_NAME);
+ visible_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_VISIBLE_NAME_KEY);
if (visible_name && strcmp (name, visible_name) == 0)
break;
@@ -1106,7 +862,7 @@ new_profile_response_cb (GtkWidget *new_profile_dialog,
transient_parent = gtk_window_get_transient_for (GTK_WINDOW (new_profile_dialog));
new_profile = _terminal_profile_clone (base_profile, name);
- new_profile_name = terminal_profile_get_property_string (new_profile, TERMINAL_PROFILE_NAME);
+ new_profile_name = terminal_profile_get_property_string (new_profile, TERMINAL_PROFILE_NAME_KEY);
g_hash_table_insert (app->profiles,
g_strdup (new_profile_name),
new_profile /* adopts the refcount */);
@@ -1159,11 +915,14 @@ new_profile_name_entry_changed_cb (GtkEntry *entry,
gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_ACCEPT, name[0] != '\0');
}
+#endif
+
void
-terminal_app_new_profile (TerminalApp *app,
- TerminalProfile *default_base_profile,
- GtkWindow *transient_parent)
+terminal_app_new_profile (TerminalApp *app,
+ GSettings *default_base_profile,
+ GtkWindow *transient_parent)
{
+#if 0
if (app->new_profile_dialog == NULL)
{
GtkWidget *create_button, *table, *name_label, *name_entry, *base_label, *combo;
@@ -1212,8 +971,10 @@ terminal_app_new_profile (TerminalApp *app,
transient_parent);
gtk_window_present (GTK_WINDOW (app->new_profile_dialog));
+#endif
}
+#if 0
static void
profile_list_selection_changed_cb (GtkTreeSelection *selection,
TerminalApp *app)
@@ -1258,11 +1019,13 @@ profile_list_destroyed_cb (GtkWidget *manage_profiles_dialog,
app->manage_profiles_delete_button = NULL;
app->manage_profiles_default_menu = NULL;
}
+#endif
void
terminal_app_manage_profiles (TerminalApp *app,
GtkWindow *transient_parent)
{
+#if 0
GObject *dialog;
GObject *tree_view_container, *new_button, *edit_button, *remove_button;
GObject *default_hbox, *default_label;
@@ -1334,6 +1097,7 @@ terminal_app_manage_profiles (TerminalApp *app,
transient_parent);
gtk_window_present (GTK_WINDOW (app->manage_profiles_dialog));
+#endif
}
#ifdef WITH_SMCLIENT
@@ -1362,95 +1126,42 @@ G_DEFINE_TYPE (TerminalApp, terminal_app, G_TYPE_OBJECT)
static void
terminal_app_init (TerminalApp *app)
{
- GError *error = NULL;
-
global_app = app;
- /* If the gconf daemon isn't available (e.g. because there's no dbus
- * session bus running), we'd crash later on. Tell the user about it
- * now, and exit. See bug #561663.
- * Don't use gconf_ping_daemon() here since the server may just not
- * be running yet, but able to be started. See comments on bug #564649.
- */
- if (!gconf_spawn_daemon (&error))
- {
- g_printerr ("Failed to summon the GConf demon; exiting. %s\n", error->message);
- g_error_free (error);
-
- exit (EXIT_FAILURE);
- }
-
gtk_window_set_default_icon_name (GNOME_TERMINAL_ICON_NAME);
/* Desktop proxy settings */
app->system_proxy_settings = g_settings_new (SYSTEM_PROXY_SETTINGS_SCHEMA);
- /* Terminal global settings */
+ /* Desktop Interface settings */
app->desktop_interface_settings = g_settings_new (DESKTOP_INTERFACE_SETTINGS_SCHEMA);
- terminal_app_system_font_notify_cb (app->desktop_interface_settings,
- MONOSPACE_FONT_KEY_NAME,
- app);
- g_signal_connect (app->desktop_interface_settings,
- "changed::" MONOSPACE_FONT_KEY_NAME,
- G_CALLBACK (terminal_app_system_font_notify_cb),
- app);
-
- /* Initialise defaults */
- app->enable_mnemonics = DEFAULT_ENABLE_MNEMONICS;
- app->enable_menu_accels = DEFAULT_ENABLE_MENU_BAR_ACCEL;
- app->profiles = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+ /* Terminal global settings */
+ app->global_settings = g_settings_new (TERMINAL_SETTING_SCHEMA);
app->encodings = terminal_encodings_get_builtins ();
+ terminal_app_encoding_list_notify_cb (app->global_settings, "encodings", app);
+ g_signal_connect (app->global_settings,
+ "changed::encodings",
+ G_CALLBACK (terminal_app_encoding_list_notify_cb),
+ app);
- app->conf = gconf_client_get_default ();
-
- gconf_client_add_dir (app->conf, CONF_GLOBAL_PREFIX,
- GCONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
-
- app->profile_list_notify_id =
- gconf_client_notify_add (app->conf, PROFILE_LIST_KEY,
- terminal_app_profile_list_notify_cb,
- app, NULL, NULL);
-
- app->default_profile_notify_id =
- gconf_client_notify_add (app->conf,
- DEFAULT_PROFILE_KEY,
- terminal_app_default_profile_notify_cb,
- app, NULL, NULL);
-
- app->encoding_list_notify_id =
- gconf_client_notify_add (app->conf,
- ENCODING_LIST_KEY,
- terminal_app_encoding_list_notify_cb,
- app, NULL, NULL);
-
- app->enable_mnemonics_notify_id =
- gconf_client_notify_add (app->conf,
- ENABLE_MNEMONICS_KEY,
- terminal_app_enable_mnemonics_notify_cb,
- app, NULL, NULL);
-
- app->enable_menu_accels_notify_id =
- gconf_client_notify_add (app->conf,
- ENABLE_MENU_BAR_ACCEL_KEY,
- terminal_app_enable_menu_accels_notify_cb,
- app, NULL, NULL);
-
- /* Load the settings */
- gconf_client_notify (app->conf, PROFILE_LIST_KEY);
- gconf_client_notify (app->conf, DEFAULT_PROFILE_KEY);
- gconf_client_notify (app->conf, ENCODING_LIST_KEY);
- gconf_client_notify (app->conf, ENABLE_MENU_BAR_ACCEL_KEY);
- gconf_client_notify (app->conf, ENABLE_MNEMONICS_KEY);
-
- /* Ensure we have valid settings */
- g_assert (app->default_profile_id != NULL);
- g_assert (app->system_font_desc != NULL);
+ app->profiles = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+ g_hash_table_insert (app->profiles,
+ g_strdup ("profile0"),
+ g_settings_new_with_path (TERMINAL_PROFILE_SCHEMA,
+ "/org/gnome/terminal/settings/profiles:/profile0/"));
+#if 0
+ app->profiles_settings = g_settings_new (PROFILES_SETTINGS_SCHEMA_ID);
+ terminal_app_profiles_children_changed_cb (app->profiles_settings, app);
+ g_signal_connect (app->profiles_settings,
+ "children-changed",
+ G_CALLBACK (terminal_app_profiles_children_changed_cb),
+ app);
+#endif
terminal_accels_init ();
-
+
#ifdef WITH_SMCLIENT
{
EggSMClient *sm_client;
@@ -1487,29 +1198,20 @@ terminal_app_finalize (GObject *object)
0, 0, NULL, NULL, app);
#endif
- if (app->profile_list_notify_id != 0)
- gconf_client_notify_remove (app->conf, app->profile_list_notify_id);
- if (app->default_profile_notify_id != 0)
- gconf_client_notify_remove (app->conf, app->default_profile_notify_id);
- if (app->encoding_list_notify_id != 0)
- gconf_client_notify_remove (app->conf, app->encoding_list_notify_id);
- if (app->enable_menu_accels_notify_id != 0)
- gconf_client_notify_remove (app->conf, app->enable_menu_accels_notify_id);
- if (app->enable_mnemonics_notify_id != 0)
- gconf_client_notify_remove (app->conf, app->enable_mnemonics_notify_id);
-
- gconf_client_remove_dir (app->conf, CONF_GLOBAL_PREFIX, NULL);
-
- g_object_unref (app->conf);
-
- g_free (app->default_profile_id);
-
- g_hash_table_destroy (app->profiles);
-
g_hash_table_destroy (app->encodings);
+ g_signal_handlers_disconnect_by_func (app->global_settings,
+ G_CALLBACK (terminal_app_encoding_list_notify_cb),
+ app);
- pango_font_description_free (app->system_font_desc);
+ g_hash_table_destroy (app->profiles);
+#if 0
+ g_signal_handlers_disconnect_by_func (app->profiles_settings,
+ G_CALLBACK (terminal_app_profiles_children_changed_cb),
+ app);
+ g_object_unref (app->profiles_settings);
+#endif
+ g_object_unref (app->global_settings);
g_object_unref (app->desktop_interface_settings);
g_object_unref (app->system_proxy_settings);
@@ -1521,64 +1223,6 @@ terminal_app_finalize (GObject *object)
}
static void
-terminal_app_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- TerminalApp *app = TERMINAL_APP (object);
-
- switch (prop_id)
- {
- case PROP_SYSTEM_FONT:
- if (app->system_font_desc)
- g_value_set_boxed (value, app->system_font_desc);
- else
- g_value_take_boxed (value, pango_font_description_from_string (DEFAULT_MONOSPACE_FONT));
- break;
- case PROP_ENABLE_MENU_BAR_ACCEL:
- g_value_set_boolean (value, app->enable_menu_accels);
- break;
- case PROP_ENABLE_MNEMONICS:
- g_value_set_boolean (value, app->enable_mnemonics);
- break;
- case PROP_DEFAULT_PROFILE:
- g_value_set_object (value, app->default_profile);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-terminal_app_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- TerminalApp *app = TERMINAL_APP (object);
-
- switch (prop_id)
- {
- case PROP_ENABLE_MENU_BAR_ACCEL:
- app->enable_menu_accels = g_value_get_boolean (value);
- gconf_client_set_bool (app->conf, ENABLE_MENU_BAR_ACCEL_KEY, app->enable_menu_accels, NULL);
- break;
- case PROP_ENABLE_MNEMONICS:
- app->enable_mnemonics = g_value_get_boolean (value);
- gconf_client_set_bool (app->conf, ENABLE_MNEMONICS_KEY, app->enable_mnemonics, NULL);
- break;
- case PROP_DEFAULT_PROFILE:
- case PROP_SYSTEM_FONT:
- /* not writable */
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
terminal_app_real_quit (TerminalApp *app)
{
gtk_main_quit();
@@ -1590,8 +1234,6 @@ terminal_app_class_init (TerminalAppClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = terminal_app_finalize;
- object_class->get_property = terminal_app_get_property;
- object_class->set_property = terminal_app_set_property;
klass->quit = terminal_app_real_quit;
@@ -1621,34 +1263,6 @@ terminal_app_class_init (TerminalAppClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
- g_object_class_install_property
- (object_class,
- PROP_ENABLE_MENU_BAR_ACCEL,
- g_param_spec_boolean (TERMINAL_APP_ENABLE_MENU_BAR_ACCEL, NULL, NULL,
- DEFAULT_ENABLE_MENU_BAR_ACCEL,
- G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
- g_object_class_install_property
- (object_class,
- PROP_ENABLE_MNEMONICS,
- g_param_spec_boolean (TERMINAL_APP_ENABLE_MNEMONICS, NULL, NULL,
- DEFAULT_ENABLE_MNEMONICS,
- G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
- g_object_class_install_property
- (object_class,
- PROP_SYSTEM_FONT,
- g_param_spec_boxed (TERMINAL_APP_SYSTEM_FONT, NULL, NULL,
- PANGO_TYPE_FONT_DESCRIPTION,
- G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-
- g_object_class_install_property
- (object_class,
- PROP_DEFAULT_PROFILE,
- g_param_spec_object (TERMINAL_APP_DEFAULT_PROFILE, NULL, NULL,
- TERMINAL_TYPE_PROFILE,
- G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
}
/* Public API */
@@ -1672,6 +1286,8 @@ terminal_app_shutdown (void)
g_object_unref (global_app);
g_assert (global_app == NULL);
+
+ g_settings_sync ();
}
/**
@@ -1786,34 +1402,21 @@ terminal_app_handle_options (TerminalApp *app,
for (lt = iw->tabs; lt != NULL; lt = lt->next)
{
InitialTab *it = lt->data;
- TerminalProfile *profile = NULL;
+ GSettings *profile = NULL;
TerminalScreen *screen;
- const char *profile_name;
- gboolean profile_is_id;
if (it->profile)
{
- profile_name = it->profile;
- profile_is_id = it->profile_is_id;
- }
- else
- {
- profile_name = options->default_profile;
- profile_is_id = options->default_profile_is_id;
- }
-
- if (profile_name)
- {
- if (profile_is_id)
- profile = terminal_app_get_profile_by_name (app, profile_name);
+ if (it->profile_is_id)
+ profile = terminal_app_get_profile_by_name (app, it->profile);
else
- profile = terminal_app_get_profile_by_visible_name (app, profile_name);
+ profile = terminal_app_get_profile_by_visible_name (app, it->profile);
if (profile == NULL)
g_printerr (_("No such profile \"%s\", using default profile\n"), it->profile);
}
if (profile == NULL)
- profile = terminal_app_get_profile_for_new_term (app);
+ profile = g_object_ref (g_hash_table_lookup (app->profiles, "profile0"));
g_assert (profile);
screen = terminal_app_new_terminal (app, window, profile,
@@ -1822,6 +1425,7 @@ terminal_app_handle_options (TerminalApp *app,
it->working_dir ? it->working_dir : options->default_working_dir,
options->env,
it->zoom_set ? it->zoom : options->zoom);
+ g_object_unref (profile);
if (it->active)
terminal_window_switch_screen (window, screen);
@@ -1864,7 +1468,7 @@ terminal_app_new_window (TerminalApp *app,
TerminalScreen *
terminal_app_new_terminal (TerminalApp *app,
TerminalWindow *window,
- TerminalProfile *profile,
+ GSettings *profile,
char **override_command,
const char *title,
const char *working_dir,
@@ -1888,7 +1492,7 @@ terminal_app_new_terminal (TerminalApp *app,
void
terminal_app_edit_profile (TerminalApp *app,
- TerminalProfile *profile,
+ GSettings *profile,
GtkWindow *transient_parent,
const char *widget_name)
{
@@ -1929,63 +1533,49 @@ terminal_app_get_current_window (TerminalApp *app)
GList*
terminal_app_get_profile_list (TerminalApp *app)
{
+#if 0
g_return_val_if_fail (TERMINAL_IS_APP (app), NULL);
return g_list_sort (g_hash_table_get_values (app->profiles), profiles_alphabetic_cmp);
+#endif
+return NULL;
}
-TerminalProfile*
+/**
+ * terminal_app_get_profile_by_name:
+ * @app:
+ * @name:
+ *
+ * Returns: (transfer full): a new #GSettings for the profile schema, or %NULL
+ */
+GSettings *
terminal_app_get_profile_by_name (TerminalApp *app,
const char *name)
{
- g_return_val_if_fail (TERMINAL_IS_APP (app), NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- return g_hash_table_lookup (app->profiles, name);
-}
-
-TerminalProfile*
-terminal_app_get_profile_by_visible_name (TerminalApp *app,
- const char *name)
-{
- LookupInfo info;
+ GSettings *profile;
g_return_val_if_fail (TERMINAL_IS_APP (app), NULL);
g_return_val_if_fail (name != NULL, NULL);
- info.result = NULL;
- info.target = name;
-
- g_hash_table_foreach (app->profiles,
- profiles_lookup_by_visible_name_foreach,
- &info);
- return info.result;
-}
+ profile = g_hash_table_lookup (app->profiles, name);
+ if (profile != NULL)
+ return g_object_ref (profile);
-TerminalProfile*
-terminal_app_get_default_profile (TerminalApp *app)
-{
- g_return_val_if_fail (TERMINAL_IS_APP (app), NULL);
+ profile = g_settings_get_child (app->profiles_settings, name);
+ if (profile != NULL)
+ g_hash_table_insert (app->profiles, g_strdup (name), g_object_ref (profile));
- return app->default_profile;
+ return profile;
}
-TerminalProfile*
-terminal_app_get_profile_for_new_term (TerminalApp *app)
+GSettings*
+terminal_app_get_profile_by_visible_name (TerminalApp *app,
+ const char *name)
{
- GHashTableIter iter;
- TerminalProfile *profile = NULL;
- TerminalProfile **profileptr = &profile;
-
g_return_val_if_fail (TERMINAL_IS_APP (app), NULL);
+ g_return_val_if_fail (name != NULL, NULL);
- if (app->default_profile)
- return app->default_profile;
-
- g_hash_table_iter_init (&iter, app->profiles);
- if (g_hash_table_iter_next (&iter, NULL, (gpointer *) profileptr))
- return profile;
-
+ // FIXMEchpe re-implement, or drop?
return NULL;
}
@@ -2104,6 +1694,31 @@ terminal_app_save_config_file (TerminalApp *app,
return result;
}
+
+/**
+ * terminal_app_get_global_settings:
+ * @app: a #TerminalApp
+ *
+ * Returns: (tranfer none): the cached #GSettings object for the org.gnome.Terminal.Preferences schema
+ */
+GSettings *
+terminal_app_get_global_settings (TerminalApp *app)
+{
+ return app->global_settings;
+}
+
+/**
+ * terminal_app_get_desktop_interface_settings:
+ * @app: a #TerminalApp
+ *
+ * Returns: (tranfer none): the cached #GSettings object for the org.gnome.interface schema
+ */
+GSettings *
+terminal_app_get_desktop_interface_settings (TerminalApp *app)
+{
+ return app->desktop_interface_settings;
+}
+
/**
* terminal_app_get_proxy_settings:
* @app: a #TerminalApp
@@ -2115,3 +1730,23 @@ terminal_app_get_proxy_settings (TerminalApp *app)
{
return app->system_proxy_settings;
}
+
+/**
+ * terminal_app_get_system_font:
+ * @app:
+ *
+ * Creates a #PangoFontDescription for the system monospace font.
+ *
+ * Returns: (transfer full): a new #PangoFontDescription
+ */
+PangoFontDescription *
+terminal_app_get_system_font (TerminalApp *app)
+{
+ const char *font;
+
+ g_return_val_if_fail (TERMINAL_IS_APP (app), NULL);
+
+ g_settings_get (app->desktop_interface_settings, MONOSPACE_FONT_KEY_NAME, "&s", &font);
+
+ return pango_font_description_from_string (font);
+}
diff --git a/src/terminal-app.h b/src/terminal-app.h
index 0590a4e..2ab4c13 100644
--- a/src/terminal-app.h
+++ b/src/terminal-app.h
@@ -2,18 +2,18 @@
* Copyright  2001 Havoc Pennington
* Copyright  2008 Christian Persch
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * This programme is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * This programme is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
+ * You should have received a copy of the GNU General Public
+ * License along with this programme; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
@@ -55,20 +55,8 @@ G_BEGIN_DECLS
#define TERMINAL_CONFIG_TERMINAL_PROP_WORKING_DIRECTORY "WorkingDirectory"
#define TERMINAL_CONFIG_TERMINAL_PROP_ZOOM "Zoom"
-/* Configuration */
-
-#define CONF_PREFIX "/apps/gnome-terminal"
-#define CONF_GLOBAL_PREFIX CONF_PREFIX "/global"
-#define CONF_PROFILES_PREFIX CONF_PREFIX "/profiles"
-#define CONF_KEYS_PREFIX CONF_PREFIX "/keybindings"
-
#define GNOME_TERMINAL_ICON_NAME "utilities-terminal"
-#define TERMINAL_APP_DEFAULT_PROFILE "default-profile"
-#define TERMINAL_APP_ENABLE_MENU_BAR_ACCEL "enable-menu-accels"
-#define TERMINAL_APP_ENABLE_MNEMONICS "enable-mnemonics"
-#define TERMINAL_APP_SYSTEM_FONT "system-font"
-
/* TerminalApp */
#define TERMINAL_TYPE_APP (terminal_app_get_type ())
@@ -92,21 +80,21 @@ gboolean terminal_app_handle_options (TerminalApp *app,
gboolean allow_resume,
GError **error);
-void terminal_app_edit_profile (TerminalApp *app,
- TerminalProfile *profile,
- GtkWindow *transient_parent,
- const char *widget_name);
+void terminal_app_edit_profile (TerminalApp *app,
+ GSettings *profile,
+ GtkWindow *transient_parent,
+ const char *widget_name);
-void terminal_app_new_profile (TerminalApp *app,
- TerminalProfile *default_base_profile,
- GtkWindow *transient_parent);
+void terminal_app_new_profile (TerminalApp *app,
+ GSettings *default_base_profile,
+ GtkWindow *transient_parent);
TerminalWindow * terminal_app_new_window (TerminalApp *app,
GdkScreen *screen);
TerminalScreen *terminal_app_new_terminal (TerminalApp *app,
TerminalWindow *window,
- TerminalProfile *profile,
+ GSettings *profile,
char **override_command,
const char *title,
const char *working_dir,
@@ -123,22 +111,13 @@ void terminal_app_edit_keybindings (TerminalApp *app,
void terminal_app_edit_encodings (TerminalApp *app,
GtkWindow *transient_parent);
-
GList* terminal_app_get_profile_list (TerminalApp *app);
-TerminalProfile* terminal_app_ensure_profile_fallback (TerminalApp *app);
-
-TerminalProfile* terminal_app_get_profile_by_name (TerminalApp *app,
- const char *name);
-
-TerminalProfile* terminal_app_get_profile_by_visible_name (TerminalApp *app,
- const char *name);
+GSettings* terminal_app_get_profile_by_name (TerminalApp *app,
+ const char *name);
-/* may return NULL */
-TerminalProfile* terminal_app_get_default_profile (TerminalApp *app);
-
-/* never returns NULL if any profiles exist, one is always supposed to */
-TerminalProfile* terminal_app_get_profile_for_new_term (TerminalApp *app);
+GSettings* terminal_app_get_profile_by_visible_name (TerminalApp *app,
+ const char *name);
TerminalEncoding *terminal_app_ensure_encoding (TerminalApp *app,
const char *charset);
@@ -154,8 +133,16 @@ gboolean terminal_app_save_config_file (TerminalApp *app,
const char *file_name,
GError **error);
+/* GSettings */
+
+GSettings *terminal_app_get_global_settings (TerminalApp *app);
+
+GSettings *terminal_app_get_desktop_interface_settings (TerminalApp *app);
+
GSettings *terminal_app_get_proxy_settings (TerminalApp *app);
+PangoFontDescription *terminal_app_get_system_font (TerminalApp *app);
+
G_END_DECLS
#endif /* !TERMINAL_APP_H */
diff --git a/src/terminal-close-button.c b/src/terminal-close-button.c
index b178748..eb71485 100644
--- a/src/terminal-close-button.c
+++ b/src/terminal-close-button.c
@@ -22,35 +22,16 @@
#include "terminal-close-button.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
struct _TerminalCloseButtonClassPrivate {
GtkCssProvider *css;
};
G_DEFINE_TYPE_WITH_CODE (TerminalCloseButton, terminal_close_button, GTK_TYPE_BUTTON,
g_type_add_class_private (g_define_type_id, sizeof (TerminalCloseButtonClassPrivate)))
-#else
-G_DEFINE_TYPE (TerminalCloseButton, terminal_close_button, GTK_TYPE_BUTTON)
-
-static void
-terminal_close_button_style_set (GtkWidget *button,
- GtkStyle *previous_style)
-{
- gint h, w;
-
- gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (button),
- GTK_ICON_SIZE_MENU, &w, &h);
-
- gtk_widget_set_size_request (button, w + 2, h + 2);
-
- GTK_WIDGET_CLASS (terminal_close_button_parent_class)->style_set (button, previous_style);
-}
-#endif
static void
terminal_close_button_class_init (TerminalCloseButtonClass *klass)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
static const gchar button_style[] =
"* {\n"
"-GtkButton-default-border : 0;\n"
@@ -65,26 +46,15 @@ terminal_close_button_class_init (TerminalCloseButtonClass *klass)
klass->priv->css = gtk_css_provider_new ();
gtk_css_provider_load_from_data (klass->priv->css, button_style, -1, NULL);
-#else
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- widget_class->style_set = terminal_close_button_style_set;
-
- gtk_rc_parse_string ("style \"gnome-terminal-tab-close-button-style\"\n"
- "{\n"
- "GtkWidget::focus-padding = 0\n"
- "GtkWidget::focus-line-width = 0\n"
- "xthickness = 0\n"
- "ythickness = 0\n"
- "}\n"
- "widget \"*.gnome-terminal-tab-close-button\" style \"gnome-terminal-tab-close-button-style\"");
-#endif
}
static void
terminal_close_button_init (TerminalCloseButton *button)
{
GtkWidget *image;
+ GtkStyleContext *context;
+
+ gtk_widget_set_name (GTK_WIDGET (button), "gnome-terminal-tab-close-button");
image = gtk_image_new_from_stock (GTK_STOCK_CLOSE,
GTK_ICON_SIZE_MENU);
@@ -92,16 +62,10 @@ terminal_close_button_init (TerminalCloseButton *button)
gtk_container_add (GTK_CONTAINER (button), image);
-#if GTK_CHECK_VERSION (3, 0, 0)
- GtkStyleContext *context;
-
context = gtk_widget_get_style_context (GTK_WIDGET (button));
gtk_style_context_add_provider (context,
GTK_STYLE_PROVIDER (TERMINAL_CLOSE_BUTTON_GET_CLASS (button)->priv->css),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-#else
- gtk_widget_set_name (GTK_WIDGET (button), "gnome-terminal-tab-close-button");
-#endif
}
GtkWidget *
diff --git a/src/terminal-debug.c b/src/terminal-debug.c
index 2466d6f..a788c10 100644
--- a/src/terminal-debug.c
+++ b/src/terminal-debug.c
@@ -2,7 +2,7 @@
* Copyright (C) 2002,2003 Red Hat, Inc.
*
* This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
+ * the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
@@ -11,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
diff --git a/src/terminal-debug.h b/src/terminal-debug.h
index a1a8385..be7add3 100644
--- a/src/terminal-debug.h
+++ b/src/terminal-debug.h
@@ -2,7 +2,7 @@
* Copyright (C) 2002 Red Hat, Inc.
*
* This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
+ * the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
@@ -11,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
diff --git a/src/terminal-encoding.c b/src/terminal-encoding.c
index e7f246c..1494a0b 100644
--- a/src/terminal-encoding.c
+++ b/src/terminal-encoding.c
@@ -26,12 +26,14 @@
#include "terminal-debug.h"
#include "terminal-encoding.h"
#include "terminal-intl.h"
-#include "terminal-profile.h"
+#include "terminal-schemas.h"
#include "terminal-util.h"
+#define CONF_GLOBAL_PREFIX "/" // FIXMEchpe
+
/* Overview
*
- * There's a list of character sets stored in gconf, indicating
+ * There's a list of character sets stored in gsettings, indicating
* which encodings to display in the encoding menu.
*
* We have a pre-canned list of available encodings
@@ -39,7 +41,7 @@
* the encoding menu, and to give a human-readable name
* to certain encodings.
*
- * If the gconf list contains an encoding not in the
+ * If the setting list contains an encoding not in the
* predetermined table, then that encoding is
* labeled "user defined" but still appears in the menu.
*/
@@ -281,31 +283,29 @@ terminal_encoding_get_type (void)
}
static void
-update_active_encodings_gconf (void)
+update_active_encodings_setting (void)
{
+ TerminalApp *app;
GSList *list, *l;
- GSList *strings = NULL;
- GConfClient *conf;
+ GVariantBuilder builder;
+ GSettings *settings;
+
+ app = terminal_app_get ();
- list = terminal_app_get_active_encodings (terminal_app_get ());
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("as"));
+
+ list = terminal_app_get_active_encodings (app);
for (l = list; l != NULL; l = l->next)
{
TerminalEncoding *encoding = (TerminalEncoding *) l->data;
- strings = g_slist_prepend (strings, (gpointer) terminal_encoding_get_id (encoding));
+ g_variant_builder_add (&builder, "s", terminal_encoding_get_id (encoding));
}
-
- conf = gconf_client_get_default ();
- gconf_client_set_list (conf,
- CONF_GLOBAL_PREFIX"/active_encodings",
- GCONF_VALUE_STRING,
- strings,
- NULL);
- g_object_unref (conf);
-
- g_slist_free (strings);
g_slist_foreach (list, (GFunc) terminal_encoding_unref, NULL);
g_slist_free (list);
+
+ settings = terminal_app_get_global_settings (app);
+ g_settings_set (settings, TERMINAL_SETTING_ENCODINGS_KEY, "as", &builder);
}
static void
@@ -381,10 +381,10 @@ button_clicked_cb (GtkWidget *button,
terminal_encoding_unref (encoding);
- /* We don't need to emit row-changed here, since updating the gconf pref
+ /* We don't need to emit row-changed here, since updating the pref
* will update the models.
*/
- update_active_encodings_gconf ();
+ update_active_encodings_setting ();
}
static void
diff --git a/src/terminal-encoding.h b/src/terminal-encoding.h
index ddfe9ed..a45da4e 100644
--- a/src/terminal-encoding.h
+++ b/src/terminal-encoding.h
@@ -3,18 +3,18 @@
/*
* Copyright  2002 Red Hat, Inc.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * This programme is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * This programme is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
+ * You should have received a copy of the GNU General Public
+ * License along with this programme; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
diff --git a/src/terminal-enums.h b/src/terminal-enums.h
new file mode 100644
index 0000000..a8daa17
--- /dev/null
+++ b/src/terminal-enums.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright  2001 Havoc Pennington
+ * Copyright  2002 Mathias Hasselmann
+ * Copyright  2008, 2010 Christian Persch
+ *
+ * This programme is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This programme is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this programme; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef TERMINAL_ENUMS_H
+#define TERMINAL_ENUMS_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef enum
+{
+ TERMINAL_TITLE_REPLACE,
+ TERMINAL_TITLE_BEFORE,
+ TERMINAL_TITLE_AFTER,
+ TERMINAL_TITLE_IGNORE
+} TerminalTitleMode;
+
+typedef enum
+{
+ TERMINAL_EXIT_CLOSE,
+ TERMINAL_EXIT_RESTART,
+ TERMINAL_EXIT_HOLD
+} TerminalExitAction;
+
+G_END_DECLS
+
+#endif /* TERMINAL_ENUMS_H */
diff --git a/src/terminal-intl.h b/src/terminal-intl.h
index cc9f9a2..31e4efa 100644
--- a/src/terminal-intl.h
+++ b/src/terminal-intl.h
@@ -1,18 +1,18 @@
/*
* Copyright  2002 Havoc Pennington
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * This programme is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * This programme is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
+ * You should have received a copy of the GNU General Public
+ * License along with this programme; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
diff --git a/src/terminal-options.c b/src/terminal-options.c
index 67fa014..55e5fdf 100644
--- a/src/terminal-options.c
+++ b/src/terminal-options.c
@@ -32,6 +32,7 @@
#include "terminal-app.h"
#include "terminal-intl.h"
#include "terminal-util.h"
+#include "terminal-version.h"
static GOptionContext *get_goption_context (TerminalOptions *options);
@@ -165,6 +166,7 @@ add_new_window (TerminalOptions *options,
return iw;
}
+#if !TERMINAL_CHECK_VERSION (3, 0, 0)
/* handle deprecated command line options */
static gboolean
unsupported_option_callback (const gchar *option_name,
@@ -177,7 +179,7 @@ unsupported_option_callback (const gchar *option_name,
" the new '--profile' option\n"), option_name);
return TRUE; /* we do not want to bail out here but continue */
}
-
+#endif
static gboolean G_GNUC_NORETURN
option_version_cb (const gchar *option_name,
@@ -1173,6 +1175,7 @@ get_goption_context (TerminalOptions *options)
NULL,
NULL
},
+#if !TERMINAL_CHECK_VERSION (3, 0, 0)
/*
* Crappy old compat args
*/
@@ -1344,6 +1347,7 @@ get_goption_context (TerminalOptions *options)
unsupported_option_callback,
NULL, NULL
},
+#endif /* Terminal < 3.0.0 */
{ NULL, 0, 0, 0, NULL, NULL, NULL }
};
diff --git a/src/terminal-schemas.h b/src/terminal-schemas.h
new file mode 100644
index 0000000..3e8f8e3
--- /dev/null
+++ b/src/terminal-schemas.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright  2008, 2010 Christian Persch
+ *
+ * This programme is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This programme is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this programme; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef TERMINAL_SCHEMAS_H
+#define TERMINAL_SCHEMAS_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#define TERMINAL_PROFILE_SCHEMA "org.gnome.Terminal.Profile"
+#define TERMINAL_SETTING_SCHEMA "org.gnome.Terminal.Settings"
+
+#define TERMINAL_PROFILE_ALLOW_BOLD_KEY "allow-bold"
+#define TERMINAL_PROFILE_AUDIBLE_BELL_KEY "audible-bell"
+#define TERMINAL_PROFILE_BACKGROUND_COLOR_KEY "background-color"
+#define TERMINAL_PROFILE_BACKSPACE_BINDING_KEY "backspace-binding"
+#define TERMINAL_PROFILE_BOLD_COLOR_KEY "bold-color"
+#define TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG_KEY "bold-color-same-as-fg"
+#define TERMINAL_PROFILE_CURSOR_BLINK_MODE_KEY "cursor-blink-mode"
+#define TERMINAL_PROFILE_CURSOR_SHAPE_KEY "cursor-shape"
+#define TERMINAL_PROFILE_CUSTOM_COMMAND_KEY "custom-command"
+#define TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS_KEY "default-size-columns"
+#define TERMINAL_PROFILE_DEFAULT_SIZE_ROWS_KEY "default-size-rows"
+#define TERMINAL_PROFILE_DELETE_BINDING_KEY "delete-binding"
+#define TERMINAL_PROFILE_EXIT_ACTION_KEY "exit-action"
+#define TERMINAL_PROFILE_FONT_KEY "font"
+#define TERMINAL_PROFILE_FOREGROUND_COLOR_KEY "foreground-color"
+#define TERMINAL_PROFILE_LOGIN_SHELL_KEY "login-shell"
+#define TERMINAL_PROFILE_NAME_KEY "name"
+#define TERMINAL_PROFILE_PALETTE_KEY "palette"
+#define TERMINAL_PROFILE_SCROLLBACK_LINES_KEY "scrollback-lines"
+#define TERMINAL_PROFILE_SCROLLBACK_UNLIMITED_KEY "scrollback-unlimited"
+#define TERMINAL_PROFILE_SCROLLBAR_POLICY_KEY "scrollbar-policy"
+#define TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE_KEY "scroll-on-keystroke"
+#define TERMINAL_PROFILE_SCROLL_ON_OUTPUT_KEY "scroll-on-output"
+#define TERMINAL_PROFILE_TITLE_MODE_KEY "title-mode"
+#define TERMINAL_PROFILE_TITLE_KEY "title"
+#define TERMINAL_PROFILE_UPDATE_RECORDS_KEY "update-records"
+#define TERMINAL_PROFILE_USE_CUSTOM_COMMAND_KEY "use-custom-command"
+#define TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE_KEY "use-custom-default-size"
+#define TERMINAL_PROFILE_USE_SKEY_KEY "use-skey"
+#define TERMINAL_PROFILE_USE_SYSTEM_FONT_KEY "use-system-font"
+#define TERMINAL_PROFILE_USE_THEME_COLORS_KEY "use-theme-colors"
+#define TERMINAL_PROFILE_VISIBLE_NAME_KEY "visible-name"
+#define TERMINAL_PROFILE_WORD_CHARS_KEY "word-chars"
+
+#define TERMINAL_SETTING_CONFIRM_CLOSE_KEY "confirm-close"
+#define TERMINAL_SETTING_DEFAULT_PROFILE_KEY "default-profile"
+#define TERMINAL_SETTING_DEFAULT_SHOW_MENUBAR_KEY "default-show-menubar"
+#define TERMINAL_SETTING_ENABLE_MENU_BAR_ACCEL_KEY "menu-accelerator-enabled"
+#define TERMINAL_SETTING_ENABLE_MNEMONICS_KEY "mnemonics-enabled"
+#define TERMINAL_SETTING_ENCODINGS_KEY "encodings"
+
+#define PROFILES_PATH_PREFIX "/org/gnome/terminal/profiles/"
+
+G_END_DECLS
+
+#endif /* TERMINAL_SCHEMAS_H */
diff --git a/src/terminal-screen-container.c b/src/terminal-screen-container.c
index 2781b59..c9b8e70 100644
--- a/src/terminal-screen-container.c
+++ b/src/terminal-screen-container.c
@@ -1,18 +1,18 @@
/*
- * Copyright  2008, 2010 Christian Persch
+ * Copyright  2008, 2010, 2011 Christian Persch
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * This programme is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * This programme is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
+ * You should have received a copy of the GNU General Public
+ * License along with this programme; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
@@ -38,8 +38,6 @@ struct _TerminalScreenContainerPrivate
#endif
GtkPolicyType hscrollbar_policy;
GtkPolicyType vscrollbar_policy;
- GtkCornerType window_placement;
- guint window_placement_set : 1;
};
enum
@@ -47,56 +45,13 @@ enum
PROP_0,
PROP_SCREEN,
PROP_HSCROLLBAR_POLICY,
- PROP_VSCROLLBAR_POLICY,
- PROP_WINDOW_PLACEMENT,
- PROP_WINDOW_PLACEMENT_SET
+ PROP_VSCROLLBAR_POLICY
};
G_DEFINE_TYPE (TerminalScreenContainer, terminal_screen_container, GTK_TYPE_VBOX)
/* helper functions */
-static void
-terminal_screen_container_set_placement_internal (TerminalScreenContainer *container,
- GtkCornerType corner)
-{
- TerminalScreenContainerPrivate *priv = container->priv;
-
-#ifdef USE_SCROLLED_WINDOW
- gtk_scrolled_window_set_placement (GTK_SCROLLED_WINDOW (priv->scrolled_window), corner);
-#else
- switch (corner) {
- case GTK_CORNER_TOP_LEFT:
- case GTK_CORNER_BOTTOM_LEFT:
- gtk_box_reorder_child (GTK_BOX (priv->hbox), priv->vscrollbar, 1);
- break;
- case GTK_CORNER_TOP_RIGHT:
- case GTK_CORNER_BOTTOM_RIGHT:
- gtk_box_reorder_child (GTK_BOX (priv->hbox), priv->vscrollbar, 0);
- break;
- default:
- g_assert_not_reached ();
- }
-#endif
-
- priv->window_placement = corner;
- g_object_notify (G_OBJECT (container), "window-placement");
-}
-
-static void
-terminal_screen_container_set_placement_set (TerminalScreenContainer *container,
- gboolean set)
-{
- TerminalScreenContainerPrivate *priv = container->priv;
-
-#ifdef USE_SCROLLED_WINDOW
- g_object_set (priv->scrolled_window, "window-placement-set", set, NULL);
-#endif
-
- priv->window_placement_set = set != FALSE;
- g_object_notify (G_OBJECT (container), "window-placement-set");
-}
-
#if defined(USE_SCROLLED_WINDOW) && defined(GNOME_ENABLE_DEBUG)
static void
size_request_cb (GtkWidget *widget,
@@ -120,8 +75,6 @@ terminal_screen_container_init (TerminalScreenContainer *container)
priv->hscrollbar_policy = GTK_POLICY_AUTOMATIC;
priv->vscrollbar_policy = GTK_POLICY_AUTOMATIC;
- priv->window_placement = GTK_CORNER_BOTTOM_RIGHT;
- priv->window_placement_set = FALSE;
}
static GObject *
@@ -142,12 +95,8 @@ terminal_screen_container_constructor (GType type,
g_assert (priv->screen != NULL);
#ifdef USE_SCROLLED_WINDOW
-#if GTK_CHECK_VERSION (2, 91, 2)
priv->scrolled_window = gtk_scrolled_window_new (gtk_scrollable_get_hadjustment(GTK_SCROLLABLE(priv->screen)),
gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(priv->screen)));
-#else
- priv->scrolled_window = gtk_scrolled_window_new (NULL, vte_terminal_get_adjustment (VTE_TERMINAL (priv->screen)));
-#endif
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
priv->hscrollbar_policy,
@@ -167,11 +116,7 @@ terminal_screen_container_constructor (GType type,
priv->hbox = gtk_hbox_new (FALSE, 0);
-#if GTK_CHECK_VERSION (2, 91, 2)
priv->vscrollbar = gtk_vscrollbar_new (gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(priv->screen)));
-#else
- priv->vscrollbar = gtk_vscrollbar_new (vte_terminal_get_adjustment (VTE_TERMINAL (priv->screen)));
-#endif
gtk_box_pack_start (GTK_BOX (priv->hbox), GTK_WIDGET (priv->screen), TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (priv->hbox), priv->vscrollbar, FALSE, FALSE, 0);
@@ -203,12 +148,6 @@ terminal_screen_container_get_property (GObject *object,
case PROP_VSCROLLBAR_POLICY:
g_value_set_enum (value, priv->vscrollbar_policy);
break;
- case PROP_WINDOW_PLACEMENT:
- g_value_set_enum (value, priv->window_placement);
- break;
- case PROP_WINDOW_PLACEMENT_SET:
- g_value_set_boolean (value, priv->window_placement_set);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -238,12 +177,6 @@ terminal_screen_container_set_property (GObject *object,
priv->hscrollbar_policy,
g_value_get_enum (value));
break;
- case PROP_WINDOW_PLACEMENT:
- terminal_screen_container_set_placement_internal (container, g_value_get_enum (value));
- break;
- case PROP_WINDOW_PLACEMENT_SET:
- terminal_screen_container_set_placement_set (container, g_value_get_boolean (value));
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -286,23 +219,6 @@ terminal_screen_container_class_init (TerminalScreenContainerClass *klass)
GTK_POLICY_AUTOMATIC,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property
- (gobject_class,
- PROP_WINDOW_PLACEMENT,
- g_param_spec_enum ("window-placement", NULL, NULL,
- GTK_TYPE_CORNER_TYPE,
- GTK_CORNER_TOP_LEFT,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property
- (gobject_class,
- PROP_WINDOW_PLACEMENT_SET,
- g_param_spec_boolean ("window-placement-set", NULL, NULL,
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
}
/* public API */
@@ -399,20 +315,3 @@ terminal_screen_container_set_policy (TerminalScreenContainer *container,
g_object_thaw_notify (object);
}
-
-/**
- * terminal_screen_container_set_placement:
- * @container: a #TerminalScreenContainer
- * @corner: a #GtkCornerType
- *
- * Sets @container's window placement.
- */
-void
-terminal_screen_container_set_placement (TerminalScreenContainer *container,
- GtkCornerType corner)
-{
- g_return_if_fail (TERMINAL_IS_SCREEN_CONTAINER (container));
-
- terminal_screen_container_set_placement_internal (container, corner);
- terminal_screen_container_set_placement_set (container, TRUE);
-}
diff --git a/src/terminal-screen-container.h b/src/terminal-screen-container.h
index 31e4859..a9f7f37 100644
--- a/src/terminal-screen-container.h
+++ b/src/terminal-screen-container.h
@@ -1,18 +1,18 @@
/*
* Copyright  2008, 2010 Christian Persch
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * This programme is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * This programme is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
+ * You should have received a copy of the GNU General Public
+ * License along with this programme; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index 02d0d3f..1184cd5 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -1,6 +1,6 @@
/*
* Copyright  2001 Havoc Pennington
- * Copyright  2007, 2008, 2010 Christian Persch
+ * Copyright  2007, 2008, 2010, 2011 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
@@ -25,13 +25,6 @@
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION (2, 90, 7)
-#define GDK_KEY(symbol) GDK_KEY_##symbol
-#else
-#include <gdk/gdkkeysyms.h>
-#define GDK_KEY(symbol) GDK_##symbol
-#endif
-
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
@@ -39,9 +32,10 @@
#include "terminal-accels.h"
#include "terminal-app.h"
#include "terminal-debug.h"
+#include "terminal-enums.h"
#include "terminal-intl.h"
#include "terminal-marshal.h"
-#include "terminal-profile.h"
+#include "terminal-schemas.h"
#include "terminal-screen-container.h"
#include "terminal-util.h"
#include "terminal-window.h"
@@ -59,7 +53,7 @@ typedef struct
struct _TerminalScreenPrivate
{
- TerminalProfile *profile; /* may be NULL at times */
+ GSettings *profile; /* never NULL */
guint profile_changed_id;
guint profile_forgotten_id;
char *raw_title, *raw_icon_title;
@@ -115,9 +109,9 @@ static void terminal_screen_drag_data_received (GtkWidget *widget,
GtkSelectionData *selection_data,
guint info,
guint time);
-static void terminal_screen_system_font_notify_cb (TerminalApp *app,
- GParamSpec *pspec,
- TerminalScreen *screen);
+static void terminal_screen_system_font_changed_cb (GSettings *,
+ const char*,
+ TerminalScreen *screen);
static void terminal_screen_change_font (TerminalScreen *screen);
static gboolean terminal_screen_popup_menu (GtkWidget *widget);
static gboolean terminal_screen_button_press (GtkWidget *widget,
@@ -236,15 +230,15 @@ free_tag_data (TagData *tagdata)
}
static void
-terminal_screen_class_enable_menu_bar_accel_notify_cb (TerminalApp *app,
- GParamSpec *pspec,
+terminal_screen_class_enable_menu_bar_accel_notify_cb (GSettings *settings,
+ const char *key,
TerminalScreenClass *klass)
{
static gboolean is_enabled = TRUE; /* the binding is enabled by default since GtkWidgetClass installs it */
gboolean enable;
GtkBindingSet *binding_set;
- g_object_get (app, TERMINAL_APP_ENABLE_MENU_BAR_ACCEL, &enable, NULL);
+ enable = g_settings_get_boolean (settings, key);
/* Only remove the 'skip' entry when we have added it previously! */
if (enable == is_enabled)
@@ -254,9 +248,9 @@ terminal_screen_class_enable_menu_bar_accel_notify_cb (TerminalApp *app,
binding_set = gtk_binding_set_by_class (klass);
if (enable)
- gtk_binding_entry_remove (binding_set, GDK_KEY (F10), GDK_SHIFT_MASK);
+ gtk_binding_entry_remove (binding_set, GDK_KEY_F10, GDK_SHIFT_MASK);
else
- gtk_binding_entry_skip (binding_set, GDK_KEY (F10), GDK_SHIFT_MASK);
+ gtk_binding_entry_skip (binding_set, GDK_KEY_F10, GDK_SHIFT_MASK);
}
static TerminalWindow *
@@ -272,6 +266,7 @@ terminal_screen_get_window (TerminalScreen *screen)
return TERMINAL_WINDOW (toplevel);
}
+#if 0
static gboolean
window_uses_argb_visual (TerminalScreen *screen)
{
@@ -283,40 +278,26 @@ window_uses_argb_visual (TerminalScreen *screen)
return terminal_window_uses_argb_visual (window);
}
+#endif
static void
terminal_screen_realize (GtkWidget *widget)
{
+ GTK_WIDGET_CLASS (terminal_screen_parent_class)->realize (widget);
+
+#if 0
TerminalScreen *screen = TERMINAL_SCREEN (widget);
TerminalScreenPrivate *priv = screen->priv;
TerminalBackgroundType bg_type;
- GTK_WIDGET_CLASS (terminal_screen_parent_class)->realize (widget);
-
/* FIXME: Don't enable this if we have a compmgr. */
- bg_type = terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_BACKGROUND_TYPE);
+ bg_type = g_settings_get_enum (priv->profile, TERMINAL_PROFILE_BACKGROUND_TYPE_KEY);
vte_terminal_set_background_transparent (VTE_TERMINAL (screen),
bg_type == TERMINAL_BACKGROUND_TRANSPARENT &&
!window_uses_argb_visual (screen));
+#endif
}
-#if GTK_CHECK_VERSION (2, 99, 0)
-
-static void
-terminal_screen_style_updated (GtkWidget *widget)
-{
- TerminalScreen *screen = TERMINAL_SCREEN (widget);
-
- GTK_WIDGET_CLASS (terminal_screen_parent_class)->style_updated (widget);
-
- update_color_scheme (screen);
-
- if (gtk_widget_get_realized (widget))
- terminal_screen_change_font (screen);
-}
-
-#else /* GTK 2.0 */
-
static void
terminal_screen_style_set (GtkWidget *widget,
GtkStyle *previous_style)
@@ -333,8 +314,6 @@ terminal_screen_style_set (GtkWidget *widget,
terminal_screen_change_font (screen);
}
-#endif /* GTK 3.0 */
-
#ifdef GNOME_ENABLE_DEBUG
static void
size_request (GtkWidget *widget,
@@ -361,13 +340,13 @@ terminal_screen_init (TerminalScreen *screen)
const GtkTargetEntry target_table[] = {
{ "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, TARGET_TAB },
{ "application/x-color", 0, TARGET_COLOR },
- { "property/bgimage", 0, TARGET_BGIMAGE },
{ "x-special/gnome-reset-background", 0, TARGET_RESET_BG },
{ "text/x-moz-url", 0, TARGET_MOZ_URL },
{ "_NETSCAPE_URL", 0, TARGET_NETSCAPE_URL }
};
VteTerminal *terminal = VTE_TERMINAL (screen);
TerminalScreenPrivate *priv;
+ TerminalApp *app;
GtkTargetList *target_list;
GtkTargetEntry *targets;
int n_targets;
@@ -375,7 +354,10 @@ terminal_screen_init (TerminalScreen *screen)
priv = screen->priv = G_TYPE_INSTANCE_GET_PRIVATE (screen, TERMINAL_TYPE_SCREEN, TerminalScreenPrivate);
- vte_terminal_set_mouse_autohide (VTE_TERMINAL (screen), TRUE);
+ vte_terminal_set_mouse_autohide (terminal, TRUE);
+ vte_terminal_set_background_image (terminal, NULL);
+ vte_terminal_set_scroll_background (terminal, FALSE);
+ vte_terminal_set_background_transparent (terminal, FALSE);
priv->child_pid = -1;
priv->pty_fd = -1;
@@ -422,8 +404,9 @@ terminal_screen_init (TerminalScreen *screen)
G_CALLBACK (terminal_screen_icon_title_changed),
screen);
- g_signal_connect (terminal_app_get (), "notify::system-font",
- G_CALLBACK (terminal_screen_system_font_notify_cb), screen);
+ app = terminal_app_get ();
+ g_signal_connect (terminal_app_get_desktop_interface_settings (app), "changed",
+ G_CALLBACK (terminal_screen_system_font_changed_cb), screen);
#ifdef GNOME_ENABLE_DEBUG
_TERMINAL_DEBUG_IF (TERMINAL_DEBUG_GEOMETRY)
@@ -478,14 +461,9 @@ terminal_screen_set_property (GObject *object,
switch (prop_id)
{
- case PROP_PROFILE: {
- TerminalProfile *profile;
-
- profile = g_value_get_object (value);
- g_assert (profile != NULL);
- terminal_screen_set_profile (screen, profile);
+ case PROP_PROFILE:
+ terminal_screen_set_profile (screen, g_value_get_object (value));
break;
- }
case PROP_OVERRIDE_COMMAND:
terminal_screen_set_override_command (screen, g_value_get_boxed (value));
break;
@@ -508,7 +486,7 @@ terminal_screen_class_init (TerminalScreenClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
VteTerminalClass *terminal_class = VTE_TERMINAL_CLASS (klass);
- TerminalApp *app;
+ GSettings *settings;
guint i;
object_class->dispose = terminal_screen_dispose;
@@ -517,11 +495,7 @@ terminal_screen_class_init (TerminalScreenClass *klass)
object_class->set_property = terminal_screen_set_property;
widget_class->realize = terminal_screen_realize;
-#if GTK_CHECK_VERSION (2, 99, 0)
- widget_class->style_updated = terminal_screen_style_updated;
-#else
widget_class->style_set = terminal_screen_style_set;
-#endif
widget_class->drag_data_received = terminal_screen_drag_data_received;
widget_class->button_press_event = terminal_screen_button_press;
widget_class->popup_menu = terminal_screen_popup_menu;
@@ -536,7 +510,7 @@ terminal_screen_class_init (TerminalScreenClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
- 1, TERMINAL_TYPE_PROFILE);
+ 1, G_TYPE_SETTINGS);
signals[SHOW_POPUP_MENU] =
g_signal_new (I_("show-popup-menu"),
@@ -572,8 +546,8 @@ terminal_screen_class_init (TerminalScreenClass *klass)
g_object_class_install_property
(object_class,
PROP_PROFILE,
- g_param_spec_string ("profile", NULL, NULL,
- NULL,
+ g_param_spec_object ("profile", NULL, NULL,
+ G_TYPE_SETTINGS,
G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
g_object_class_install_property
@@ -635,9 +609,9 @@ terminal_screen_class_init (TerminalScreenClass *klass)
}
/* This fixes bug #329827 */
- app = terminal_app_get ();
- terminal_screen_class_enable_menu_bar_accel_notify_cb (app, NULL, klass);
- g_signal_connect (app, "notify::" TERMINAL_APP_ENABLE_MENU_BAR_ACCEL,
+ settings = terminal_app_get_global_settings (terminal_app_get ());
+ terminal_screen_class_enable_menu_bar_accel_notify_cb (settings, TERMINAL_SETTING_ENABLE_MENU_BAR_ACCEL_KEY, klass);
+ g_signal_connect (settings, "changed::" TERMINAL_SETTING_ENABLE_MENU_BAR_ACCEL_KEY,
G_CALLBACK (terminal_screen_class_enable_menu_bar_accel_notify_cb), klass);
}
@@ -668,8 +642,8 @@ terminal_screen_finalize (GObject *object)
TerminalScreen *screen = TERMINAL_SCREEN (object);
TerminalScreenPrivate *priv = screen->priv;
- g_signal_handlers_disconnect_by_func (terminal_app_get (),
- G_CALLBACK (terminal_screen_system_font_notify_cb),
+ g_signal_handlers_disconnect_by_func (terminal_app_get_desktop_interface_settings (terminal_app_get ()),
+ G_CALLBACK (terminal_screen_system_font_changed_cb),
screen);
terminal_screen_set_profile (screen, NULL);
@@ -690,7 +664,7 @@ terminal_screen_finalize (GObject *object)
}
TerminalScreen *
-terminal_screen_new (TerminalProfile *profile,
+terminal_screen_new (GSettings *profile,
char **override_command,
const char *title,
const char *working_dir,
@@ -700,17 +674,17 @@ terminal_screen_new (TerminalProfile *profile,
TerminalScreen *screen;
TerminalScreenPrivate *priv;
- g_return_val_if_fail (TERMINAL_IS_PROFILE (profile), NULL);
+ g_return_val_if_fail (G_IS_SETTINGS (profile), NULL);
screen = g_object_new (TERMINAL_TYPE_SCREEN, NULL);
priv = screen->priv;
terminal_screen_set_profile (screen, profile);
- if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE)) {
+ if (g_settings_get_boolean (profile, TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE_KEY)) {
vte_terminal_set_size (VTE_TERMINAL (screen),
- terminal_profile_get_property_int (profile, TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS),
- terminal_profile_get_property_int (profile, TERMINAL_PROFILE_DEFAULT_SIZE_ROWS));
+ g_settings_get_int (profile, TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS_KEY),
+ g_settings_get_int (profile, TERMINAL_PROFILE_DEFAULT_SIZE_ROWS_KEY));
}
if (title)
@@ -797,7 +771,7 @@ terminal_screen_get_title_format (TerminalScreen *screen)
"%S" /* TERMINAL_TITLE_IGNORE */
};
- return formats[terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_TITLE_MODE)];
+ return formats[g_settings_get_enum (priv->profile, TERMINAL_PROFILE_TITLE_MODE_KEY)];
}
/**
@@ -828,9 +802,8 @@ terminal_screen_format_title (TerminalScreen *screen,
if (priv->override_title)
static_title = priv->override_title;
else
- static_title = terminal_profile_get_property_string (priv->profile, TERMINAL_PROFILE_TITLE);
+ g_settings_get (priv->profile, TERMINAL_PROFILE_TITLE_KEY, "&s", &static_title);
- //title = g_string_sized_new (strlen (static_title) + strlen (raw_title) + 3 + 1);
title = g_string_sized_new (128);
format = terminal_screen_get_title_format (screen);
@@ -899,21 +872,15 @@ terminal_screen_cook_icon_title (TerminalScreen *screen)
}
static void
-terminal_screen_profile_notify_cb (TerminalProfile *profile,
- GParamSpec *pspec,
+terminal_screen_profile_changed_cb (GSettings *profile,
+ const char *prop_name,
TerminalScreen *screen)
{
TerminalScreenPrivate *priv = screen->priv;
GObject *object = G_OBJECT (screen);
VteTerminal *vte_terminal = VTE_TERMINAL (screen);
- const char *prop_name;
- TerminalBackgroundType bg_type;
TerminalWindow *window;
-
- if (pspec)
- prop_name = pspec->name;
- else
- prop_name = NULL;
+ const char *string;
g_object_freeze_notify (object);
@@ -924,13 +891,13 @@ terminal_screen_profile_notify_cb (TerminalProfile *profile,
*/
terminal_window_update_geometry (window);
}
-
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLLBAR_POSITION))
+
+ if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLLBAR_POLICY_KEY))
_terminal_screen_update_scrollbar (screen);
if (!prop_name ||
- prop_name == I_(TERMINAL_PROFILE_TITLE_MODE) ||
- prop_name == I_(TERMINAL_PROFILE_TITLE))
+ prop_name == I_(TERMINAL_PROFILE_TITLE_MODE_KEY) ||
+ prop_name == I_(TERMINAL_PROFILE_TITLE_KEY))
{
terminal_screen_cook_title (screen);
terminal_screen_cook_icon_title (screen);
@@ -938,138 +905,74 @@ terminal_screen_profile_notify_cb (TerminalProfile *profile,
if (gtk_widget_get_realized (GTK_WIDGET (screen)) &&
(!prop_name ||
- prop_name == I_(TERMINAL_PROFILE_USE_SYSTEM_FONT) ||
- prop_name == I_(TERMINAL_PROFILE_FONT)))
+ prop_name == I_(TERMINAL_PROFILE_USE_SYSTEM_FONT_KEY) ||
+ prop_name == I_(TERMINAL_PROFILE_FONT_KEY)))
terminal_screen_change_font (screen);
if (!prop_name ||
- prop_name == I_(TERMINAL_PROFILE_USE_THEME_COLORS) ||
- prop_name == I_(TERMINAL_PROFILE_FOREGROUND_COLOR) ||
- prop_name == I_(TERMINAL_PROFILE_BACKGROUND_COLOR) ||
- prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG) ||
- prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR) ||
- prop_name == I_(TERMINAL_PROFILE_PALETTE))
+ prop_name == I_(TERMINAL_PROFILE_USE_THEME_COLORS_KEY) ||
+ prop_name == I_(TERMINAL_PROFILE_FOREGROUND_COLOR_KEY) ||
+ prop_name == I_(TERMINAL_PROFILE_BACKGROUND_COLOR_KEY) ||
+ prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG_KEY) ||
+ prop_name == I_(TERMINAL_PROFILE_BOLD_COLOR_KEY) ||
+ prop_name == I_(TERMINAL_PROFILE_PALETTE_KEY))
update_color_scheme (screen);
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SILENT_BELL))
- vte_terminal_set_audible_bell (vte_terminal, !terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SILENT_BELL));
+ if (!prop_name || prop_name == I_(TERMINAL_PROFILE_AUDIBLE_BELL_KEY))
+ vte_terminal_set_audible_bell (vte_terminal, g_settings_get_boolean (profile, TERMINAL_PROFILE_AUDIBLE_BELL_KEY));
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_WORD_CHARS))
- vte_terminal_set_word_chars (vte_terminal,
- terminal_profile_get_property_string (profile, TERMINAL_PROFILE_WORD_CHARS));
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE))
+ if (!prop_name || prop_name == I_(TERMINAL_PROFILE_WORD_CHARS_KEY))
+ {
+ g_settings_get (profile, TERMINAL_PROFILE_WORD_CHARS_KEY, "&s", &string);
+ vte_terminal_set_word_chars (vte_terminal, string);
+ }
+ if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE_KEY))
vte_terminal_set_scroll_on_keystroke (vte_terminal,
- terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE));
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLL_ON_OUTPUT))
+ g_settings_get_boolean (profile, TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE_KEY));
+ if (!prop_name || prop_name == I_(TERMINAL_PROFILE_SCROLL_ON_OUTPUT_KEY))
vte_terminal_set_scroll_on_output (vte_terminal,
- terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SCROLL_ON_OUTPUT));
+ g_settings_get_boolean (profile, TERMINAL_PROFILE_SCROLL_ON_OUTPUT_KEY));
if (!prop_name ||
- prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_LINES) ||
- prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_UNLIMITED))
+ prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_LINES_KEY) ||
+ prop_name == I_(TERMINAL_PROFILE_SCROLLBACK_UNLIMITED_KEY))
{
- glong lines = terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SCROLLBACK_UNLIMITED) ?
- -1 : terminal_profile_get_property_int (profile, TERMINAL_PROFILE_SCROLLBACK_LINES);
+ glong lines = g_settings_get_boolean (profile, TERMINAL_PROFILE_SCROLLBACK_UNLIMITED_KEY) ?
+ -1 : g_settings_get_int (profile, TERMINAL_PROFILE_SCROLLBACK_LINES_KEY);
vte_terminal_set_scrollback_lines (vte_terminal, lines);
}
- if (!prop_name ||
- prop_name == I_(TERMINAL_PROFILE_BACKGROUND_TYPE) ||
- prop_name == I_(TERMINAL_PROFILE_BACKGROUND_IMAGE) ||
- prop_name == I_(TERMINAL_PROFILE_BACKGROUND_DARKNESS) ||
- prop_name == I_(TERMINAL_PROFILE_SCROLL_BACKGROUND))
- {
- bg_type = terminal_profile_get_property_enum (profile, TERMINAL_PROFILE_BACKGROUND_TYPE);
-
- if (bg_type == TERMINAL_BACKGROUND_IMAGE)
- {
- vte_terminal_set_background_image (vte_terminal,
- terminal_profile_get_property_object (profile, TERMINAL_PROFILE_BACKGROUND_IMAGE));
- vte_terminal_set_scroll_background (vte_terminal,
- terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_SCROLL_BACKGROUND));
- }
- else
- {
- vte_terminal_set_background_image (vte_terminal, NULL);
- vte_terminal_set_scroll_background (vte_terminal, FALSE);
- }
-
- if (bg_type == TERMINAL_BACKGROUND_IMAGE ||
- bg_type == TERMINAL_BACKGROUND_TRANSPARENT)
- {
- vte_terminal_set_background_saturation (vte_terminal,
- 1.0 - terminal_profile_get_property_double (profile, TERMINAL_PROFILE_BACKGROUND_DARKNESS));
- vte_terminal_set_opacity (vte_terminal,
- 0xffff * terminal_profile_get_property_double (profile, TERMINAL_PROFILE_BACKGROUND_DARKNESS));
- }
- else
- {
- vte_terminal_set_background_saturation (vte_terminal, 1.0); /* normal color */
- vte_terminal_set_opacity (vte_terminal, 0xffff);
- }
-
- /* FIXME: Don't enable this if we have a compmgr. */
- vte_terminal_set_background_transparent (vte_terminal,
- bg_type == TERMINAL_BACKGROUND_TRANSPARENT &&
- !window_uses_argb_visual (screen));
- }
-
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_BACKSPACE_BINDING))
+ if (!prop_name || prop_name == I_(TERMINAL_PROFILE_BACKSPACE_BINDING_KEY))
vte_terminal_set_backspace_binding (vte_terminal,
- terminal_profile_get_property_enum (profile, TERMINAL_PROFILE_BACKSPACE_BINDING));
+ g_settings_get_enum (profile, TERMINAL_PROFILE_BACKSPACE_BINDING_KEY));
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_DELETE_BINDING))
+ if (!prop_name || prop_name == I_(TERMINAL_PROFILE_DELETE_BINDING_KEY))
vte_terminal_set_delete_binding (vte_terminal,
- terminal_profile_get_property_enum (profile, TERMINAL_PROFILE_DELETE_BINDING));
+ g_settings_get_enum (profile, TERMINAL_PROFILE_DELETE_BINDING_KEY));
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_ALLOW_BOLD))
+ if (!prop_name || prop_name == I_(TERMINAL_PROFILE_ALLOW_BOLD_KEY))
vte_terminal_set_allow_bold (vte_terminal,
- terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_ALLOW_BOLD));
+ g_settings_get_boolean (profile, TERMINAL_PROFILE_ALLOW_BOLD_KEY));
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_CURSOR_BLINK_MODE))
+ if (!prop_name || prop_name == I_(TERMINAL_PROFILE_CURSOR_BLINK_MODE_KEY))
vte_terminal_set_cursor_blink_mode (vte_terminal,
- terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_CURSOR_BLINK_MODE));
+ g_settings_get_enum (priv->profile, TERMINAL_PROFILE_CURSOR_BLINK_MODE_KEY));
- if (!prop_name || prop_name == I_(TERMINAL_PROFILE_CURSOR_SHAPE))
+ if (!prop_name || prop_name == I_(TERMINAL_PROFILE_CURSOR_SHAPE_KEY))
vte_terminal_set_cursor_shape (vte_terminal,
- terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_CURSOR_SHAPE));
+ g_settings_get_enum (priv->profile, TERMINAL_PROFILE_CURSOR_SHAPE_KEY));
g_object_thaw_notify (object);
}
-#if GTK_CHECK_VERSION (2, 99, 0)
-static void
-rgba_to_color (GdkColor *color,
- const GdkRGBA *rgba)
-{
- color->red = rgba->red * 65535.;
- color->green = rgba->green * 65535.;
- color->blue = rgba->blue * 65535.;
- color->pixel = 0;
-}
-#endif
-
static void
update_color_scheme (TerminalScreen *screen)
{
TerminalScreenPrivate *priv = screen->priv;
- TerminalProfile *profile = priv->profile;
- GdkColor colors[TERMINAL_PALETTE_SIZE];
- const GdkColor *fg_color, *bg_color, *bold_color;
- GdkColor fg, bg;
- guint n_colors;
-#if GTK_CHECK_VERSION (2, 99, 0)
- GtkStyleContext *context;
- GdkRGBA rgba;
-
- context = gtk_widget_get_style_context (GTK_WIDGET (screen));
- gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &rgba);
- rgba_to_color (&fg, &rgba);
-
- gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &rgba);
- rgba_to_color (&bg, &rgba);
-
-#else /* GTK 2.0 */
+ GSettings *profile = priv->profile;
GtkStyle *style;
+ GdkColor *colors;
+ gsize n_colors;
+ GdkColor fg, bg, bold;
style = gtk_widget_get_style (GTK_WIDGET (screen));
if (!style)
@@ -1077,56 +980,52 @@ update_color_scheme (TerminalScreen *screen)
fg = style->text[GTK_STATE_NORMAL];
bg = style->base[GTK_STATE_NORMAL];
-#endif /* GTK 3.0 */
-
- bold_color = NULL;
- if (!terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_THEME_COLORS))
+ if (!g_settings_get_boolean (profile, TERMINAL_PROFILE_USE_THEME_COLORS_KEY))
{
- fg_color = terminal_profile_get_property_boxed (profile, TERMINAL_PROFILE_FOREGROUND_COLOR);
- bg_color = terminal_profile_get_property_boxed (profile, TERMINAL_PROFILE_BACKGROUND_COLOR);
+ terminal_g_settings_get_gdk_color (profile, TERMINAL_PROFILE_FOREGROUND_COLOR_KEY, &fg);
+ terminal_g_settings_get_gdk_color (profile, TERMINAL_PROFILE_BACKGROUND_COLOR_KEY, &bg);
- if (!terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG))
- bold_color = terminal_profile_get_property_boxed (profile, TERMINAL_PROFILE_BOLD_COLOR);
-
- if (fg_color)
- fg = *fg_color;
- if (bg_color)
- bg = *bg_color;
+ if (!g_settings_get_boolean (profile, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG_KEY))
+ terminal_g_settings_get_gdk_color (profile, TERMINAL_PROFILE_BOLD_COLOR_KEY, &bold);
}
- n_colors = G_N_ELEMENTS (colors);
- terminal_profile_get_palette (priv->profile, colors, &n_colors);
+ colors = terminal_g_settings_get_gdk_palette (priv->profile, TERMINAL_PROFILE_PALETTE_KEY, &n_colors);
vte_terminal_set_colors (VTE_TERMINAL (screen), &fg, &bg,
colors, n_colors);
- if (bold_color)
- vte_terminal_set_color_bold (VTE_TERMINAL (screen), bold_color);
- vte_terminal_set_background_tint_color (VTE_TERMINAL (screen), &bg);
+ g_free (colors);
+
+ if (!g_settings_get_boolean (profile, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG_KEY))
+ vte_terminal_set_color_bold (VTE_TERMINAL (screen), &bold);
}
void
terminal_screen_set_font (TerminalScreen *screen)
{
TerminalScreenPrivate *priv = screen->priv;
- TerminalProfile *profile;
+ GSettings *profile = priv->profile;
+ const char *font;
PangoFontDescription *desc;
+ int size;
- profile = priv->profile;
-
- if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_SYSTEM_FONT))
- g_object_get (terminal_app_get (), "system-font", &desc, NULL);
+ if (g_settings_get_boolean (profile, TERMINAL_PROFILE_USE_SYSTEM_FONT_KEY))
+ {
+ desc = terminal_app_get_system_font (terminal_app_get ());
+ }
else
- g_object_get (profile, TERMINAL_PROFILE_FONT, &desc, NULL);
- g_assert (desc);
+ {
+ g_settings_get (profile, TERMINAL_PROFILE_FONT_KEY, "&s", &font);
+ desc = pango_font_description_from_string (font);
+ }
+
+ size = pango_font_description_get_size (desc);
+ if (size == 0)
+ size = 10;
if (pango_font_description_get_size_is_absolute (desc))
- pango_font_description_set_absolute_size (desc,
- priv->font_scale *
- pango_font_description_get_size (desc));
+ pango_font_description_set_absolute_size (desc, priv->font_scale * size);
else
- pango_font_description_set_size (desc,
- priv->font_scale *
- pango_font_description_get_size (desc));
+ pango_font_description_set_size (desc, priv->font_scale * size);
vte_terminal_set_font (VTE_TERMINAL (screen), desc);
@@ -1134,16 +1033,14 @@ terminal_screen_set_font (TerminalScreen *screen)
}
static void
-terminal_screen_system_font_notify_cb (TerminalApp *app,
- GParamSpec *pspec,
- TerminalScreen *screen)
+terminal_screen_system_font_changed_cb (GSettings *settings,
+ const char *key,
+ TerminalScreen *screen)
{
- TerminalScreenPrivate *priv = screen->priv;
-
if (!gtk_widget_get_realized (GTK_WIDGET (screen)))
return;
- if (!terminal_profile_get_property_boolean (priv->profile, TERMINAL_PROFILE_USE_SYSTEM_FONT))
+ if (!g_settings_get_boolean (settings, TERMINAL_PROFILE_USE_SYSTEM_FONT_KEY))
return;
terminal_screen_change_font (screen);
@@ -1160,8 +1057,9 @@ terminal_screen_change_font (TerminalScreen *screen)
terminal_window_set_size (window, screen);
}
+#if 0
static void
-profile_forgotten_callback (TerminalProfile *profile,
+profile_forgotten_callback (GSettings *profile,
TerminalScreen *screen)
{
TerminalProfile *new_profile;
@@ -1170,13 +1068,14 @@ profile_forgotten_callback (TerminalProfile *profile,
g_assert (new_profile != NULL);
terminal_screen_set_profile (screen, new_profile);
}
+#endif
void
terminal_screen_set_profile (TerminalScreen *screen,
- TerminalProfile *profile)
+ GSettings *profile)
{
TerminalScreenPrivate *priv = screen->priv;
- TerminalProfile *old_profile;
+ GSettings*old_profile;
old_profile = priv->profile;
if (profile == old_profile)
@@ -1189,28 +1088,28 @@ terminal_screen_set_profile (TerminalScreen *screen,
priv->profile_changed_id = 0;
}
- if (priv->profile_forgotten_id)
+/* if (priv->profile_forgotten_id)
{
g_signal_handler_disconnect (G_OBJECT (priv->profile),
priv->profile_forgotten_id);
priv->profile_forgotten_id = 0;
- }
-
+ }*/
+
priv->profile = profile;
if (profile)
{
g_object_ref (profile);
priv->profile_changed_id =
- g_signal_connect (profile, "notify",
- G_CALLBACK (terminal_screen_profile_notify_cb),
- screen);
- priv->profile_forgotten_id =
- g_signal_connect (G_OBJECT (profile),
- "forgotten",
- G_CALLBACK (profile_forgotten_callback),
+ g_signal_connect (profile, "changed",
+ G_CALLBACK (terminal_screen_profile_changed_cb),
screen);
+// priv->profile_forgotten_id =
+// g_signal_connect (G_OBJECT (profile),
+// "forgotten",
+// G_CALLBACK (profile_forgotten_callback),
+// screen);
- terminal_screen_profile_notify_cb (profile, NULL, screen);
+ terminal_screen_profile_changed_cb (profile, NULL, screen);
g_signal_emit (G_OBJECT (screen), signals[PROFILE_SET], 0, old_profile);
}
@@ -1221,7 +1120,7 @@ terminal_screen_set_profile (TerminalScreen *screen,
g_object_notify (G_OBJECT (screen), "profile");
}
-TerminalProfile*
+GSettings*
terminal_screen_get_profile (TerminalScreen *screen)
{
TerminalScreenPrivate *priv = screen->priv;
@@ -1280,13 +1179,11 @@ get_child_command (TerminalScreen *screen,
GError **err)
{
TerminalScreenPrivate *priv = screen->priv;
- TerminalProfile *profile;
+ GSettings *profile = priv->profile;
char **argv;
g_assert (spawn_flags_p != NULL && argv_p != NULL);
- profile = priv->profile;
-
*argv_p = argv = NULL;
if (priv->override_command)
@@ -1295,11 +1192,12 @@ get_child_command (TerminalScreen *screen,
*spawn_flags_p |= G_SPAWN_SEARCH_PATH;
}
- else if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_CUSTOM_COMMAND))
+ else if (g_settings_get_boolean (profile, TERMINAL_PROFILE_USE_CUSTOM_COMMAND_KEY))
{
- if (!g_shell_parse_argv (terminal_profile_get_property_string (profile, TERMINAL_PROFILE_CUSTOM_COMMAND),
- NULL, &argv,
- err))
+ const char *argv_str;
+
+ g_settings_get (profile, TERMINAL_PROFILE_CUSTOM_COMMAND_KEY, "&s", &argv_str);
+ if (!g_shell_parse_argv (argv_str, NULL, &argv, err))
return FALSE;
*spawn_flags_p |= G_SPAWN_SEARCH_PATH;
@@ -1322,7 +1220,7 @@ get_child_command (TerminalScreen *screen,
argv[argc++] = shell;
- if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_LOGIN_SHELL))
+ if (g_settings_get_boolean (profile, TERMINAL_PROFILE_LOGIN_SHELL_KEY))
argv[argc++] = g_strconcat ("-", only_name, NULL);
else
argv[argc++] = g_strdup (only_name);
@@ -1387,11 +1285,7 @@ get_child_environment (TerminalScreen *screen,
/* FIXME: moving the tab between windows, or the window between displays will make the next two invalid... */
g_hash_table_replace (env_table, g_strdup ("WINDOWID"),
g_strdup_printf ("%ld",
-#if GTK_CHECK_VERSION (2, 91, 6)
GDK_WINDOW_XID (gtk_widget_get_window (window))));
-#else
- GDK_WINDOW_XWINDOW (gtk_widget_get_window (window))));
-#endif
g_hash_table_replace (env_table, g_strdup ("DISPLAY"), g_strdup (gdk_display_get_name (gtk_widget_get_display (window))));
#endif
@@ -1447,7 +1341,7 @@ terminal_screen_launch_child_cb (TerminalScreen *screen)
{
TerminalScreenPrivate *priv = screen->priv;
VteTerminal *terminal = VTE_TERMINAL (screen);
- TerminalProfile *profile;
+ GSettings *profile;
char **env, **argv;
char *shell = NULL;
GError *err = NULL;
@@ -1471,9 +1365,9 @@ terminal_screen_launch_child_cb (TerminalScreen *screen)
else
working_dir = g_get_home_dir ();
- if (!terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_LOGIN_SHELL))
+ if (!g_settings_get_boolean (profile, TERMINAL_PROFILE_LOGIN_SHELL_KEY))
pty_flags |= VTE_PTY_NO_LASTLOG;
- if (!terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_UPDATE_RECORDS))
+ if (!g_settings_get_boolean (profile, TERMINAL_PROFILE_UPDATE_RECORDS_KEY))
pty_flags |= VTE_PTY_NO_UTMP | VTE_PTY_NO_WTMP;
if (!get_child_command (screen, shell, &spawn_flags, &argv, &err) ||
@@ -1856,7 +1750,7 @@ terminal_screen_child_exited (VteTerminal *terminal)
priv->child_pid = -1;
priv->pty_fd = -1;
- action = terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_EXIT_ACTION);
+ action = g_settings_get_enum (priv->profile, TERMINAL_PROFILE_EXIT_ACTION_KEY);
switch (action)
{
@@ -1880,10 +1774,10 @@ terminal_screen_child_exited (VteTerminal *terminal)
_("The child process exited normally with status %d."), WEXITSTATUS (status));
} else if (WIFSIGNALED (status)) {
terminal_info_bar_format_text (TERMINAL_INFO_BAR (info_bar),
- _("The child process was terminated by signal %d."), WTERMSIG (status));
+ _("The child process was aborted by signal %d."), WTERMSIG (status));
} else {
terminal_info_bar_format_text (TERMINAL_INFO_BAR (info_bar),
- _("The child process was terminated."));
+ _("The child process was aborted."));
}
g_signal_connect (info_bar, "response",
G_CALLBACK (info_bar_response_cb), screen);
@@ -2003,11 +1897,10 @@ terminal_screen_drag_data_received (GtkWidget *widget,
color.blue = data[2];
/* FIXME: use opacity from data[3] */
- g_object_set (priv->profile,
- TERMINAL_PROFILE_BACKGROUND_TYPE, TERMINAL_BACKGROUND_SOLID,
- TERMINAL_PROFILE_USE_THEME_COLORS, FALSE,
- TERMINAL_PROFILE_BACKGROUND_COLOR, &color,
- NULL);
+ terminal_g_settings_set_gdk_color (priv->profile,
+ TERMINAL_PROFILE_BACKGROUND_COLOR_KEY,
+ &color);
+ g_settings_set_boolean (priv->profile, TERMINAL_PROFILE_USE_THEME_COLORS_KEY, FALSE);
}
break;
@@ -2075,45 +1968,9 @@ terminal_screen_drag_data_received (GtkWidget *widget,
g_free (uris[0]);
}
break;
-
- case TARGET_BGIMAGE:
- {
- char *utf8_data;
- char **uris;
-
- if (selection_data_length < 0 || selection_data_format != 8)
- return;
-
- utf8_data = g_strndup ((char *) selection_data_data, selection_data_length);
- uris = g_uri_list_extract_uris (utf8_data);
- g_free (utf8_data);
-
- /* FIXME: use terminal_util_transform_uris_to_quoted_fuse_paths? */
-
- if (uris && uris[0])
- {
- char *filename;
-
- filename = g_filename_from_uri (uris[0], NULL, NULL);
- if (filename)
- {
- g_object_set (priv->profile,
- TERMINAL_PROFILE_BACKGROUND_TYPE, TERMINAL_BACKGROUND_IMAGE,
- TERMINAL_PROFILE_BACKGROUND_IMAGE_FILE, filename,
- NULL);
- }
-
- g_free (filename);
- }
-
- g_strfreev (uris);
- }
- break;
case TARGET_RESET_BG:
- g_object_set (priv->profile,
- TERMINAL_PROFILE_BACKGROUND_TYPE, TERMINAL_BACKGROUND_SOLID,
- NULL);
+ g_settings_reset (priv->profile, TERMINAL_PROFILE_BACKGROUND_COLOR_KEY);
break;
case TARGET_TAB:
@@ -2155,33 +2012,15 @@ _terminal_screen_update_scrollbar (TerminalScreen *screen)
{
TerminalScreenPrivate *priv = screen->priv;
TerminalScreenContainer *container;
- GtkPolicyType policy = GTK_POLICY_ALWAYS;
- GtkCornerType corner = GTK_CORNER_TOP_LEFT;
+ GtkPolicyType vpolicy;
container = terminal_screen_container_get_from_screen (screen);
if (container == NULL)
return;
- switch (terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_SCROLLBAR_POSITION))
- {
- case TERMINAL_SCROLLBAR_HIDDEN:
- policy = GTK_POLICY_NEVER;
- break;
- case TERMINAL_SCROLLBAR_RIGHT:
- policy = GTK_POLICY_ALWAYS;
- corner = GTK_CORNER_TOP_LEFT;
- break;
- case TERMINAL_SCROLLBAR_LEFT:
- policy = GTK_POLICY_ALWAYS;
- corner = GTK_CORNER_TOP_RIGHT;
- break;
- default:
- g_assert_not_reached ();
- break;
- }
+ vpolicy = g_settings_get_enum (priv->profile, TERMINAL_PROFILE_SCROLLBAR_POLICY_KEY);
- terminal_screen_container_set_placement (container, corner);
- terminal_screen_container_set_policy (container, GTK_POLICY_NEVER, policy);
+ terminal_screen_container_set_policy (container, GTK_POLICY_NEVER, vpolicy);
}
void
@@ -2240,11 +2079,10 @@ terminal_screen_save_config (TerminalScreen *screen,
{
TerminalScreenPrivate *priv = screen->priv;
VteTerminal *terminal = VTE_TERMINAL (screen);
- TerminalProfile *profile = priv->profile;
const char *profile_id;
char *working_directory;
- profile_id = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME);
+ g_settings_get (priv->profile, TERMINAL_PROFILE_NAME_KEY, "&s", &profile_id);
g_key_file_set_string (key_file, group, TERMINAL_CONFIG_TERMINAL_PROP_PROFILE_ID, profile_id);
if (priv->override_command)
diff --git a/src/terminal-screen.h b/src/terminal-screen.h
index 25cc902..038326a 100644
--- a/src/terminal-screen.h
+++ b/src/terminal-screen.h
@@ -1,19 +1,19 @@
/*
* Copyright  2001 Havoc Pennington
- * Copyright  2008 Christian Persch
+ * Copyright  2008, 2010 Christian Persch
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * This programme is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * This programme is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
+ * You should have received a copy of the GNU General Public
+ * License along with this programme; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
@@ -21,9 +21,10 @@
#ifndef TERMINAL_SCREEN_H
#define TERMINAL_SCREEN_H
-#include <vte/vte.h>
+#include <glib-object.h>
+#include <gio/gio.h>
-#include "terminal-profile.h"
+#include <vte/vte.h>
G_BEGIN_DECLS
@@ -61,7 +62,7 @@ struct _TerminalScreenClass
VteTerminalClass parent_class;
void (* profile_set) (TerminalScreen *screen,
- TerminalProfile *old_profile);
+ GSettings *old_profile);
void (* show_popup_menu) (TerminalScreen *screen,
TerminalScreenPopupInfo *info);
gboolean (* match_clicked) (TerminalScreen *screen,
@@ -73,7 +74,7 @@ struct _TerminalScreenClass
GType terminal_screen_get_type (void) G_GNUC_CONST;
-TerminalScreen *terminal_screen_new (TerminalProfile *profile,
+TerminalScreen *terminal_screen_new (GSettings *profile,
char **override_command,
const char *title,
const char *working_dir,
@@ -81,8 +82,8 @@ TerminalScreen *terminal_screen_new (TerminalProfile *profile,
double zoom);
void terminal_screen_set_profile (TerminalScreen *screen,
- TerminalProfile *profile);
-TerminalProfile* terminal_screen_get_profile (TerminalScreen *screen);
+ GSettings *profile);
+GSettings* terminal_screen_get_profile (TerminalScreen *screen);
void terminal_screen_set_override_command (TerminalScreen *screen,
char **argv);
diff --git a/src/terminal-search-dialog.c b/src/terminal-search-dialog.c
index 4a3bf9c..9259212 100644
--- a/src/terminal-search-dialog.c
+++ b/src/terminal-search-dialog.c
@@ -108,11 +108,7 @@ terminal_search_dialog_new (GtkWindow *parent)
priv->store = store = gtk_list_store_new (1, G_TYPE_STRING);
g_object_set (G_OBJECT (priv->search_entry),
"model", store,
-#if GTK_CHECK_VERSION (2, 91, 0)
"entry-text-column", 0,
-#else
- "text-column", 0,
-#endif
NULL);
priv->completion = completion = gtk_entry_completion_new ();
diff --git a/src/terminal-tabs-menu.c b/src/terminal-tabs-menu.c
index 2638a28..4215dc8 100644
--- a/src/terminal-tabs-menu.c
+++ b/src/terminal-tabs-menu.c
@@ -265,11 +265,7 @@ notebook_page_reordered_cb (GtkNotebook *notebook,
static void
notebook_page_switch_cb (GtkNotebook *notebook,
-#if GTK_CHECK_VERSION (2, 90, 6)
GtkWidget *page,
-#else
- gpointer page,
-#endif
guint position,
TerminalTabsMenu *menu)
{
@@ -277,11 +273,7 @@ notebook_page_switch_cb (GtkNotebook *notebook,
TerminalScreen *screen;
GtkAction *action;
-#if GTK_CHECK_VERSION (2, 90, 6)
container = TERMINAL_SCREEN_CONTAINER (page);
-#else
- container = TERMINAL_SCREEN_CONTAINER (gtk_notebook_get_nth_page (notebook, position));
-#endif
screen = terminal_screen_container_get_screen (container);
action = g_object_get_data (G_OBJECT (screen), DATA_KEY);
diff --git a/src/terminal-util.c b/src/terminal-util.c
index e36cba9..f9ddfcb 100644
--- a/src/terminal-util.c
+++ b/src/terminal-util.c
@@ -689,274 +689,6 @@ terminal_util_add_proxy_env (GHashTable *env_table)
}
}
-/* Bidirectional object/widget binding */
-
-typedef struct {
- GObject *object;
- const char *object_prop;
- GtkWidget *widget;
- gulong object_notify_id;
- gulong widget_notify_id;
- PropertyChangeFlags flags;
-} PropertyChange;
-
-static void
-property_change_free (PropertyChange *change)
-{
- g_signal_handler_disconnect (change->object, change->object_notify_id);
-
- g_slice_free (PropertyChange, change);
-}
-
-static gboolean
-transform_boolean (gboolean input,
- PropertyChangeFlags flags)
-{
- if (flags & FLAG_INVERT_BOOL)
- input = !input;
-
- return input;
-}
-
-static void
-object_change_notify_cb (PropertyChange *change)
-{
- GObject *object = change->object;
- const char *object_prop = change->object_prop;
- GtkWidget *widget = change->widget;
-
- g_signal_handler_block (widget, change->widget_notify_id);
-
- if (GTK_IS_RADIO_BUTTON (widget))
- {
- int ovalue, rvalue;
-
- g_object_get (object, object_prop, &ovalue, NULL);
- rvalue = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "enum-value"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), ovalue == rvalue);
- }
- else if (GTK_IS_TOGGLE_BUTTON (widget))
- {
- gboolean enabled;
-
- g_object_get (object, object_prop, &enabled, NULL);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
- transform_boolean (enabled, change->flags));
- }
- else if (GTK_IS_SPIN_BUTTON (widget))
- {
- int value;
-
- g_object_get (object, object_prop, &value, NULL);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
- }
- else if (GTK_IS_ENTRY (widget))
- {
- char *text;
-
- g_object_get (object, object_prop, &text, NULL);
- gtk_entry_set_text (GTK_ENTRY (widget), text ? text : "");
- g_free (text);
- }
- else if (GTK_IS_COMBO_BOX (widget))
- {
- int value;
-
- g_object_get (object, object_prop, &value, NULL);
- gtk_combo_box_set_active (GTK_COMBO_BOX (widget), value);
- }
- else if (GTK_IS_RANGE (widget))
- {
- double value;
-
- g_object_get (object, object_prop, &value, NULL);
- gtk_range_set_value (GTK_RANGE (widget), value);
- }
- else if (GTK_IS_COLOR_BUTTON (widget))
- {
- GdkColor *color;
- GdkColor old_color;
-
- g_object_get (object, object_prop, &color, NULL);
- gtk_color_button_get_color (GTK_COLOR_BUTTON (widget), &old_color);
-
- if (color && !gdk_color_equal (color, &old_color))
- gtk_color_button_set_color (GTK_COLOR_BUTTON (widget), color);
- if (color)
- gdk_color_free (color);
- }
- else if (GTK_IS_FONT_BUTTON (widget))
- {
- PangoFontDescription *font_desc;
- char *font;
-
- g_object_get (object, object_prop, &font_desc, NULL);
- if (!font_desc)
- goto out;
-
- font = pango_font_description_to_string (font_desc);
- gtk_font_button_set_font_name (GTK_FONT_BUTTON (widget), font);
- g_free (font);
- pango_font_description_free (font_desc);
- }
- else if (GTK_IS_FILE_CHOOSER (widget))
- {
- char *name = NULL, *filename = NULL;
-
- g_object_get (object, object_prop, &name, NULL);
- if (name)
- filename = g_filename_from_utf8 (name, -1, NULL, NULL, NULL);
-
- if (filename)
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), filename);
- else
- gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (widget));
- g_free (filename);
- g_free (name);
- }
-
-out:
- g_signal_handler_unblock (widget, change->widget_notify_id);
-}
-
-static void
-widget_change_notify_cb (PropertyChange *change)
-{
- GObject *object = change->object;
- const char *object_prop = change->object_prop;
- GtkWidget *widget = change->widget;
-
- g_signal_handler_block (change->object, change->object_notify_id);
-
- if (GTK_IS_RADIO_BUTTON (widget))
- {
- gboolean active;
- int value;
-
- active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
- if (!active)
- goto out;
-
- value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "enum-value"));
- g_object_set (object, object_prop, value, NULL);
- }
- else if (GTK_IS_TOGGLE_BUTTON (widget))
- {
- gboolean enabled;
-
- enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
- g_object_set (object, object_prop, transform_boolean (enabled, change->flags), NULL);
- }
- else if (GTK_IS_SPIN_BUTTON (widget))
- {
- int value;
-
- value = (int) gtk_spin_button_get_value (GTK_SPIN_BUTTON (widget));
- g_object_set (object, object_prop, value, NULL);
- }
- else if (GTK_IS_ENTRY (widget))
- {
- const char *text;
-
- text = gtk_entry_get_text (GTK_ENTRY (widget));
- g_object_set (object, object_prop, text, NULL);
- }
- else if (GTK_IS_COMBO_BOX (widget))
- {
- int value;
-
- value = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
- g_object_set (object, object_prop, value, NULL);
- }
- else if (GTK_IS_COLOR_BUTTON (widget))
- {
- GdkColor color;
-
- gtk_color_button_get_color (GTK_COLOR_BUTTON (widget), &color);
- g_object_set (object, object_prop, &color, NULL);
- }
- else if (GTK_IS_FONT_BUTTON (widget))
- {
- PangoFontDescription *font_desc;
- const char *font;
-
- font = gtk_font_button_get_font_name (GTK_FONT_BUTTON (widget));
- font_desc = pango_font_description_from_string (font);
- g_object_set (object, object_prop, font_desc, NULL);
- pango_font_description_free (font_desc);
- }
- else if (GTK_IS_RANGE (widget))
- {
- double value;
-
- value = gtk_range_get_value (GTK_RANGE (widget));
- g_object_set (object, object_prop, value, NULL);
- }
- else if (GTK_IS_FILE_CHOOSER (widget))
- {
- char *filename, *name = NULL;
-
- filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
- if (filename)
- name = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
-
- g_object_set (object, object_prop, name, NULL);
- g_free (filename);
- g_free (name);
- }
-
-out:
- g_signal_handler_unblock (change->object, change->object_notify_id);
-}
-
-void
-terminal_util_bind_object_property_to_widget (GObject *object,
- const char *object_prop,
- GtkWidget *widget,
- PropertyChangeFlags flags)
-{
- PropertyChange *change;
- const char *signal_name;
- char notify_signal_name[64];
-
- change = g_slice_new0 (PropertyChange);
-
- change->widget = widget;
- g_assert (g_object_get_data (G_OBJECT (widget), "GT:PCD") == NULL);
- g_object_set_data_full (G_OBJECT (widget), "GT:PCD", change, (GDestroyNotify) property_change_free);
-
- if (GTK_IS_TOGGLE_BUTTON (widget))
- signal_name = "notify::active";
- else if (GTK_IS_SPIN_BUTTON (widget))
- signal_name = "notify::value";
- else if (GTK_IS_ENTRY (widget))
- signal_name = "notify::text";
- else if (GTK_IS_COMBO_BOX (widget))
- signal_name = "notify::active";
- else if (GTK_IS_COLOR_BUTTON (widget))
- signal_name = "notify::color";
- else if (GTK_IS_FONT_BUTTON (widget))
- signal_name = "notify::font-name";
- else if (GTK_IS_RANGE (widget))
- signal_name = "value-changed";
- else if (GTK_IS_FILE_CHOOSER_BUTTON (widget))
- signal_name = "file-set";
- else if (GTK_IS_FILE_CHOOSER (widget))
- signal_name = "selection-changed";
- else
- g_assert_not_reached ();
-
- change->widget_notify_id = g_signal_connect_swapped (widget, signal_name, G_CALLBACK (widget_change_notify_cb), change);
-
- change->object = object;
- change->flags = flags;
- change->object_prop = object_prop;
-
- g_snprintf (notify_signal_name, sizeof (notify_signal_name), "notify::%s", object_prop);
- object_change_notify_cb (change);
- change->object_notify_id = g_signal_connect_swapped (object, notify_signal_name, G_CALLBACK (object_change_notify_cb), change);
-}
-
#ifdef GDK_WINDOWING_X11
/* We don't want to hop desktops when we unrealize/realize.
@@ -974,18 +706,10 @@ terminal_util_x11_get_net_wm_desktop (GdkWindow *window,
gulong n_items, bytes_after;
gboolean result = FALSE;
-#if GTK_CHECK_VERSION (2, 90, 8)
display = gdk_window_get_display (window);
-#else
- display = gdk_drawable_get_display (window);
-#endif
if (XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
-#if GTK_CHECK_VERSION (2, 91, 6)
GDK_WINDOW_XID (window),
-#else
- GDK_DRAWABLE_XID (window),
-#endif
gdk_x11_get_xatom_by_name_for_display (display,
"_NET_WM_DESKTOP"),
0, G_MAXLONG, False, AnyPropertyType,
@@ -1027,11 +751,7 @@ terminal_util_x11_set_net_wm_desktop (GdkWindow *window,
Atom wm_selection;
gboolean have_wm;
-#if GTK_CHECK_VERSION (2, 90, 8)
screen = gdk_window_get_screen (window);
-#else
- screen = gdk_drawable_get_screen (window);
-#endif
display = gdk_screen_get_display (screen);
xdisplay = GDK_DISPLAY_XDISPLAY (display);
@@ -1053,11 +773,7 @@ terminal_util_x11_set_net_wm_desktop (GdkWindow *window,
xclient.type = ClientMessage;
xclient.serial = 0;
xclient.send_event = True;
-#if GTK_CHECK_VERSION (2, 91, 6)
xclient.window = GDK_WINDOW_XID (window);
-#else
- xclient.window = GDK_WINDOW_XWINDOW (window);
-#endif
xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_DESKTOP");
xclient.format = 32;
@@ -1068,11 +784,7 @@ terminal_util_x11_set_net_wm_desktop (GdkWindow *window,
xclient.data.l[4] = 0;
XSendEvent (xdisplay,
-#if GTK_CHECK_VERSION (2, 91, 6)
GDK_WINDOW_XID (gdk_screen_get_root_window (screen)),
-#else
- GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (screen)),
-#endif
False,
SubstructureRedirectMask | SubstructureNotifyMask,
(XEvent *)&xclient);
@@ -1082,11 +794,7 @@ terminal_util_x11_set_net_wm_desktop (GdkWindow *window,
gulong long_desktop = desktop;
XChangeProperty (xdisplay,
-#if GTK_CHECK_VERSION (2, 91, 6)
GDK_WINDOW_XID (window),
-#else
- GDK_DRAWABLE_XID (window),
-#endif
gdk_x11_get_xatom_by_name_for_display (display,
"_NET_WM_DESKTOP"),
XA_CARDINAL, 32, PropModeReplace,
@@ -1110,22 +818,14 @@ terminal_util_x11_clear_demands_attention (GdkWindow *window)
GdkDisplay *display;
XClientMessageEvent xclient;
-#if GTK_CHECK_VERSION (2, 90, 8)
screen = gdk_window_get_screen (window);
-#else
- screen = gdk_drawable_get_screen (window);
-#endif
display = gdk_screen_get_display (screen);
memset (&xclient, 0, sizeof (xclient));
xclient.type = ClientMessage;
xclient.serial = 0;
xclient.send_event = True;
-#if GTK_CHECK_VERSION (2, 91, 6)
xclient.window = GDK_WINDOW_XID (window);
-#else
- xclient.window = GDK_WINDOW_XWINDOW (window);
-#endif
xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE");
xclient.format = 32;
@@ -1136,11 +836,7 @@ terminal_util_x11_clear_demands_attention (GdkWindow *window)
xclient.data.l[4] = 0;
XSendEvent (GDK_DISPLAY_XDISPLAY (display),
-#if GTK_CHECK_VERSION (2, 91, 6)
GDK_WINDOW_XID (gdk_screen_get_root_window (screen)),
-#else
- GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (screen)),
-#endif
False,
SubstructureRedirectMask | SubstructureNotifyMask,
(XEvent *)&xclient);
@@ -1160,11 +856,7 @@ terminal_util_x11_window_is_minimized (GdkWindow *window)
{
GdkDisplay *display;
-#if GTK_CHECK_VERSION (2, 90, 8)
display = gdk_window_get_display (window);
-#else
- display = gdk_drawable_get_display (window);
-#endif
Atom type;
gint format;
@@ -1182,11 +874,7 @@ terminal_util_x11_window_is_minimized (GdkWindow *window)
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"),
0, G_MAXLONG, False, XA_ATOM, &type, &format, &nitems,
&bytes_after, &data);
-#if GTK_CHECK_VERSION (2, 90, 8)
gdk_error_trap_pop_ignored ();
-#else
- gdk_error_trap_pop ();
-#endif
if (type != None)
{
@@ -1209,3 +897,171 @@ terminal_util_x11_window_is_minimized (GdkWindow *window)
}
#endif /* GDK_WINDOWING_X11 */
+
+static gboolean
+s_to_gdk_color (GVariant *variant,
+ gpointer *result,
+ gpointer user_data)
+{
+ GdkColor *color = user_data;
+ const char *str;
+
+ g_assert (variant != NULL);
+
+ g_variant_get (variant, "&s", &str);
+ return gdk_color_parse (str, color);
+}
+
+/**
+ * terminal_g_settings_get_gdk_color:
+ * @settings: a #GSettings
+ * @key: a valid key in @settings of type "s"
+ * @color: location to store the parsed color
+ *
+ * Gets a color from @key in @settings.
+ *
+ * Returns: whether parsing the value as color succeeded
+ */
+void
+terminal_g_settings_get_gdk_color (GSettings *settings,
+ const char *key,
+ GdkColor *color)
+{
+ g_return_if_fail (color != NULL);
+
+ g_settings_get_mapped (settings, key,
+ (GSettingsGetMapping) s_to_gdk_color,
+ color);
+}
+
+/**
+ * terminal_g_settings_get_sdk_color:
+ * @settings: a #GSettings
+ * @key: a valid key in @settings of type "s"
+ * @color: a #GdkColor
+ *
+ * Sets a color in @key in @settings.
+ */
+void
+terminal_g_settings_set_gdk_color (GSettings *settings,
+ const char *key,
+ const GdkColor *color)
+{
+ char *str;
+
+ str = gdk_color_to_string (color);
+ g_settings_set_string (settings, key, str);
+ g_free (str);
+}
+
+static gboolean
+as_to_gdk_colors (GVariant *variant,
+ gpointer *result,
+ gpointer user_data)
+{
+ gsize *n_colors = user_data;
+ gsize n, i;
+ GdkColor *colors;
+ GVariantIter iter;
+ const char *str;
+
+ /* We should never get to the fallback case */
+ g_assert (variant != NULL);
+
+ g_variant_iter_init (&iter, variant);
+ n = g_variant_iter_n_children (&iter);
+ colors = g_new (GdkColor, n);
+
+ i = 0;
+ while (g_variant_iter_next (&iter, "&s", &str)) {
+ if (!gdk_color_parse (str, &colors[i++])) {
+ g_free (colors);
+ return FALSE;
+ }
+ }
+
+ *result = colors;
+ if (n_colors)
+ *n_colors = n;
+
+ return TRUE;
+}
+
+/**
+ * terminal_g_settings_get_gdk_color:
+ * @settings: a #GSettings
+ * @key: a valid key in @settings or type "s"
+ * @color: location to store the parsed color
+ *
+ * Returns: (transfer full):
+ */
+GdkColor *
+terminal_g_settings_get_gdk_palette (GSettings *settings,
+ const char *key,
+ gsize *n_colors)
+{
+ return g_settings_get_mapped (settings, key,
+ (GSettingsGetMapping) as_to_gdk_colors,
+ n_colors);
+}
+
+void
+terminal_g_settings_set_gdk_palette (GSettings *settings,
+ const char *key,
+ const GdkColor *colors,
+ gsize n_colors)
+{
+ char **strv;
+ gsize i;
+
+ strv = g_new (char *, n_colors + 1);
+ for (i = 0; i < n_colors; ++i)
+ strv[i] = gdk_color_to_string (&colors[i]);
+ strv[n_colors] = NULL;
+
+ g_settings_set (settings, key, "^as", strv);
+ g_strfreev (strv);
+}
+
+static void
+mnemonic_label_set_sensitive_cb (GtkWidget *widget,
+ GParamSpec *pspec,
+ GtkWidget *label)
+{
+ gtk_widget_set_sensitive (label, gtk_widget_get_sensitive (widget));
+}
+
+/**
+ * terminal_util_bind_mnemonic_label_sensitivity:
+ * @container: a #GtkContainer
+ */
+void
+terminal_util_bind_mnemonic_label_sensitivity (GtkWidget *widget)
+{
+ GList *list, *l;
+
+ list = gtk_widget_list_mnemonic_labels (widget);
+ for (l = list; l != NULL; l = l->next) {
+ GtkWidget *label = l->data;
+
+ if (gtk_widget_is_ancestor (label, widget))
+ continue;
+
+#if 0
+ g_print ("Widget %s has mnemonic label %s\n",
+ gtk_buildable_get_name (GTK_BUILDABLE (widget)),
+ gtk_buildable_get_name (GTK_BUILDABLE (label)));
+#endif
+
+ mnemonic_label_set_sensitive_cb (widget, NULL, label);
+ g_signal_connect (widget, "notify::sensitive",
+ G_CALLBACK (mnemonic_label_set_sensitive_cb),
+ label);
+ }
+ g_list_free (list);
+
+ if (GTK_IS_CONTAINER (widget))
+ gtk_container_foreach (GTK_CONTAINER (widget),
+ (GtkCallback) terminal_util_bind_mnemonic_label_sensitivity,
+ NULL);
+}
diff --git a/src/terminal-util.h b/src/terminal-util.h
index a8648af..cc2c157 100644
--- a/src/terminal-util.h
+++ b/src/terminal-util.h
@@ -1,19 +1,19 @@
/*
* Copyright  2001 Havoc Pennington
- * Copyright  2008 Christian Persch
+ * Copyright  2008, 2010 Christian Persch
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * This programme is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * This programme is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
+ * You should have received a copy of the GNU General Public
+ * License along with this programme; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
@@ -21,16 +21,13 @@
#ifndef TERMINAL_UTIL_H
#define TERMINAL_UTIL_H
+#include <gio/gio.h>
#include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
#include "terminal-screen.h"
G_BEGIN_DECLS
-#define CONF_PROXY_PREFIX "/system/proxy"
-#define CONF_HTTP_PROXY_PREFIX "/system/http_proxy"
-
void terminal_util_set_unique_role (GtkWindow *window, const char *prefix);
void terminal_util_show_error_dialog (GtkWindow *transient_parent,
@@ -89,14 +86,6 @@ char **terminal_util_key_file_get_argv (GKeyFile *key_file,
void terminal_util_add_proxy_env (GHashTable *env_table);
-typedef enum {
- FLAG_INVERT_BOOL = 1 << 0,
-} PropertyChangeFlags;
-
-void terminal_util_bind_object_property_to_widget (GObject *object,
- const char *object_prop,
- GtkWidget *widget,
- PropertyChangeFlags flags);
gboolean terminal_util_x11_get_net_wm_desktop (GdkWindow *window,
guint32 *desktop);
@@ -107,6 +96,23 @@ void terminal_util_x11_clear_demands_attention (GdkWindow *window);
gboolean terminal_util_x11_window_is_minimized (GdkWindow *window);
+void terminal_g_settings_get_gdk_color (GSettings *settings,
+ const char *key,
+ GdkColor *color);
+void terminal_g_settings_set_gdk_color (GSettings *settings,
+ const char *key,
+ const GdkColor *color);
+
+GdkColor *terminal_g_settings_get_gdk_palette (GSettings *settings,
+ const char *key,
+ gsize *n_colors);
+void terminal_g_settings_set_gdk_palette (GSettings *settings,
+ const char *key,
+ const GdkColor *colors,
+ gsize n_colors);
+
+void terminal_util_bind_mnemonic_label_sensitivity (GtkWidget *widget);
+
G_END_DECLS
#endif /* TERMINAL_UTIL_H */
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 27b76a6..faac3c4 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1,7 +1,7 @@
/*
* Copyright  2001 Havoc Pennington
* Copyright  2002 Red Hat, Inc.
- * Copyright  2007, 2008, 2009 Christian Persch
+ * Copyright  2007, 2008, 2009, 2011 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
@@ -26,18 +26,13 @@
#include <gdk/gdkx.h>
#endif
-#if GTK_CHECK_VERSION (2, 90, 7)
-#define GDK_KEY(symbol) GDK_KEY_##symbol
-#else
-#include <gdk/gdkkeysyms.h>
-#define GDK_KEY(symbol) GDK_##symbol
-#endif
-
#include "terminal-accels.h"
#include "terminal-app.h"
#include "terminal-debug.h"
+#include "terminal-enums.h"
#include "terminal-encoding.h"
#include "terminal-intl.h"
+#include "terminal-schemas.h"
#include "terminal-screen-container.h"
#include "terminal-search-dialog.h"
#include "terminal-tab-label.h"
@@ -140,11 +135,7 @@ static gboolean notebook_button_press_cb (GtkWidget *notebook,
static gboolean notebook_popup_menu_cb (GtkWidget *notebook,
TerminalWindow *window);
static void notebook_page_selected_callback (GtkWidget *notebook,
-#if GTK_CHECK_VERSION (2, 90, 6)
GtkWidget *page,
-#else
- gpointer page,
-#endif
guint page_num,
TerminalWindow *window);
static void notebook_page_added_callback (GtkWidget *notebook,
@@ -155,11 +146,9 @@ static void notebook_page_removed_callback (GtkWidget *notebook,
GtkWidget *container,
guint page_num,
TerminalWindow *window);
-#if GTK_CHECK_VERSION (2, 90, 8)
static gboolean notebook_scroll_event_cb (GtkWidget *notebook,
GdkEventScroll *event,
TerminalWindow *window);
-#endif
/* Menu action callbacks */
static void file_new_window_callback (GtkAction *action,
@@ -182,8 +171,10 @@ static void edit_select_all_callback (GtkAction *action,
TerminalWindow *window);
static void edit_keybindings_callback (GtkAction *action,
TerminalWindow *window);
+#if 0
static void edit_profiles_callback (GtkAction *action,
TerminalWindow *window);
+#endif
static void edit_current_profile_callback (GtkAction *action,
TerminalWindow *window);
static void view_menubar_toggled_callback (GtkToggleAction *action,
@@ -237,7 +228,7 @@ static gboolean confirm_close_window_or_tab (TerminalWindow *window,
static void
profile_set_callback (TerminalScreen *screen,
- TerminalProfile *old_profile,
+ GSettings *old_profile,
TerminalWindow *window);
static void
sync_screen_icon_title (TerminalScreen *screen,
@@ -249,57 +240,34 @@ G_DEFINE_TYPE (TerminalWindow, terminal_window, GTK_TYPE_WINDOW)
/* Menubar mnemonics & accel settings handling */
static void
-app_setting_notify_cb (TerminalApp *app,
- GParamSpec *pspec,
- GdkScreen *screen)
+enable_menubar_accel_changed_cb (GSettings *settings,
+ const char *key,
+ GtkSettings *gtk_settings)
{
- GtkSettings *settings;
- const char *prop_name;
-
- if (pspec)
- prop_name = pspec->name;
- else
- prop_name = NULL;
-
- settings = gtk_settings_get_for_screen (screen);
+ /* const */ char *saved_menubar_accel;
- if (!prop_name || prop_name == I_(TERMINAL_APP_ENABLE_MNEMONICS))
+ /* FIXME: Once gtk+ bug 507398 is fixed, use that to reset the property instead */
+ /* Now this is a bad hack on so many levels. */
+ saved_menubar_accel = g_object_get_data (G_OBJECT (settings), "GT::gtk-menu-bar-accel");
+ if (!saved_menubar_accel)
{
- gboolean enable_mnemonics;
-
- g_object_get (app, TERMINAL_APP_ENABLE_MNEMONICS, &enable_mnemonics, NULL);
- g_object_set (settings, "gtk-enable-mnemonics", enable_mnemonics, NULL);
+ g_object_get (gtk_settings, "gtk-menu-bar-accel", &saved_menubar_accel, NULL);
+ g_object_set_data_full (G_OBJECT (gtk_settings), "GT::gtk-menu-bar-accel",
+ saved_menubar_accel, (GDestroyNotify) g_free);
}
- if (!prop_name || prop_name == I_(TERMINAL_APP_ENABLE_MENU_BAR_ACCEL))
- {
- /* const */ char *saved_menubar_accel;
- gboolean enable_menubar_accel;
-
- /* FIXME: Once gtk+ bug 507398 is fixed, use that to reset the property instead */
- /* Now this is a bad hack on so many levels. */
- saved_menubar_accel = g_object_get_data (G_OBJECT (settings), "GT::gtk-menu-bar-accel");
- if (!saved_menubar_accel)
- {
- g_object_get (settings, "gtk-menu-bar-accel", &saved_menubar_accel, NULL);
- g_object_set_data_full (G_OBJECT (settings), "GT::gtk-menu-bar-accel",
- saved_menubar_accel, (GDestroyNotify) g_free);
- }
-
- g_object_get (app, TERMINAL_APP_ENABLE_MENU_BAR_ACCEL, &enable_menubar_accel, NULL);
- if (enable_menubar_accel)
- g_object_set (settings, "gtk-menu-bar-accel", saved_menubar_accel, NULL);
- else
- g_object_set (settings, "gtk-menu-bar-accel", NULL, NULL);
- }
+ if (g_settings_get_boolean (settings, key))
+ g_object_set (gtk_settings, "gtk-menu-bar-accel", saved_menubar_accel, NULL);
+ else
+ g_object_set (gtk_settings, "gtk-menu-bar-accel", NULL, NULL);
}
static void
-app_setting_notify_destroy_cb (GdkScreen *screen)
+app_setting_notify_destroy_cb (GtkSettings *gtk_settings)
{
- g_signal_handlers_disconnect_by_func (terminal_app_get (),
- G_CALLBACK (app_setting_notify_cb),
- screen);
+ g_signal_handlers_disconnect_by_func (terminal_app_get_global_settings (terminal_app_get ()),
+ G_CALLBACK (enable_menubar_accel_changed_cb),
+ gtk_settings);
}
/* utility functions */
@@ -430,35 +398,32 @@ terminal_set_profile_toggled_callback (GtkToggleAction *action,
TerminalWindow *window)
{
TerminalWindowPrivate *priv = window->priv;
- TerminalProfile *profile;
+ GSettings *profile;
if (!gtk_toggle_action_get_active (action))
return;
if (priv->active_screen == NULL)
return;
-
+
profile = g_object_get_data (G_OBJECT (action), PROFILE_DATA_KEY);
g_assert (profile);
- if (_terminal_profile_get_forgotten (profile))
- return;
-
g_signal_handlers_block_by_func (priv->active_screen, G_CALLBACK (profile_set_callback), window);
terminal_screen_set_profile (priv->active_screen, profile);
g_signal_handlers_unblock_by_func (priv->active_screen, G_CALLBACK (profile_set_callback), window);
}
static void
-profile_visible_name_notify_cb (TerminalProfile *profile,
- GParamSpec *pspec,
- GtkAction *action)
+profile_visible_name_notify_cb (GSettings *profile,
+ const char *key,
+ GtkAction *action)
{
const char *visible_name;
char *dot, *display_name;
guint num;
- visible_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_VISIBLE_NAME);
+ g_settings_get (profile, TERMINAL_PROFILE_VISIBLE_NAME_KEY, "&s", &visible_name);
display_name = escape_underscores (visible_name);
dot = strchr (gtk_action_get_name (action), '.');
@@ -500,7 +465,7 @@ disconnect_profiles_from_actions_in_group (GtkActionGroup *action_group)
for (l = actions; l != NULL; l = l->next)
{
GObject *action = G_OBJECT (l->data);
- TerminalProfile *profile;
+ GSettings *profile;
profile = g_object_get_data (action, PROFILE_DATA_KEY);
if (!profile)
@@ -515,7 +480,7 @@ static void
terminal_window_update_set_profile_menu_active_profile (TerminalWindow *window)
{
TerminalWindowPrivate *priv = window->priv;
- TerminalProfile *new_active_profile;
+ GSettings *new_active_profile;
GList *actions, *l;
if (!priv->profiles_action_group)
@@ -530,7 +495,7 @@ terminal_window_update_set_profile_menu_active_profile (TerminalWindow *window)
for (l = actions; l != NULL; l = l->next)
{
GObject *action = G_OBJECT (l->data);
- TerminalProfile *profile;
+ GSettings *profile;
profile = g_object_get_data (action, PROFILE_DATA_KEY);
if (profile != new_active_profile)
@@ -549,7 +514,7 @@ static void
terminal_window_update_set_profile_menu (TerminalWindow *window)
{
TerminalWindowPrivate *priv = window->priv;
- TerminalProfile *active_profile;
+ GSettings *active_profile;
GtkActionGroup *action_group;
GtkAction *action;
GList *profiles, *p;
@@ -595,7 +560,7 @@ terminal_window_update_set_profile_menu (TerminalWindow *window)
n = 0;
for (p = profiles; p != NULL; p = p->next)
{
- TerminalProfile *profile = (TerminalProfile *) p->data;
+ GSettings *profile = (GSettings *) p->data;
GtkRadioAction *profile_action;
char name[32];
@@ -617,8 +582,8 @@ terminal_window_update_set_profile_menu (TerminalWindow *window)
PROFILE_DATA_KEY,
g_object_ref (profile),
(GDestroyNotify) g_object_unref);
- profile_visible_name_notify_cb (profile, NULL, GTK_ACTION (profile_action));
- g_signal_connect (profile, "notify::" TERMINAL_PROFILE_VISIBLE_NAME,
+ profile_visible_name_notify_cb (profile, TERMINAL_PROFILE_VISIBLE_NAME_KEY, GTK_ACTION (profile_action));
+ g_signal_connect (profile, "changed::" TERMINAL_PROFILE_VISIBLE_NAME_KEY,
G_CALLBACK (profile_visible_name_notify_cb), profile_action);
g_signal_connect (profile_action, "toggled",
G_CALLBACK (terminal_set_profile_toggled_callback), window);
@@ -641,7 +606,7 @@ terminal_window_update_set_profile_menu (TerminalWindow *window)
static void
terminal_window_create_new_terminal_action (TerminalWindow *window,
- TerminalProfile *profile,
+ GSettings *profile,
const char *name,
guint num,
GCallback callback)
@@ -655,8 +620,8 @@ terminal_window_create_new_terminal_action (TerminalWindow *window,
PROFILE_DATA_KEY,
g_object_ref (profile),
(GDestroyNotify) g_object_unref);
- profile_visible_name_notify_cb (profile, NULL, action);
- g_signal_connect (profile, "notify::" TERMINAL_PROFILE_VISIBLE_NAME,
+ profile_visible_name_notify_cb (profile, TERMINAL_PROFILE_VISIBLE_NAME_KEY, action);
+ g_signal_connect (profile, "changed::" TERMINAL_PROFILE_VISIBLE_NAME_KEY,
G_CALLBACK (profile_visible_name_notify_cb), action);
g_signal_connect (action, "activate", callback, window);
@@ -714,7 +679,7 @@ terminal_window_update_new_terminal_menus (TerminalWindow *window)
n = 0;
for (p = profiles; p != NULL; p = p->next)
{
- TerminalProfile *profile = (TerminalProfile *) p->data;
+ GSettings *profile = (GSettings *) p->data;
char name[32];
g_snprintf (name, sizeof (name), "FileNewTab.%u", n);
@@ -1513,15 +1478,10 @@ terminal_window_realize (GtkWidget *widget)
#ifdef GDK_WINDOWING_X11
GdkScreen *screen;
GtkAllocation widget_allocation;
-#if GTK_CHECK_VERSION (2, 90, 8)
GdkVisual *visual;
-#else
- GdkColormap *colormap;
-#endif
gtk_widget_get_allocation (widget, &widget_allocation);
screen = gtk_widget_get_screen (GTK_WIDGET (window));
-#if GTK_CHECK_VERSION (2, 90, 8)
if (gdk_screen_is_composited (screen) &&
(visual = gdk_screen_get_rgba_visual (screen)) != NULL)
{
@@ -1534,20 +1494,6 @@ terminal_window_realize (GtkWidget *widget)
gtk_widget_set_visual (GTK_WIDGET (window), gdk_screen_get_system_visual (screen));
priv->have_argb_visual = FALSE;
}
-#else
- if (gdk_screen_is_composited (screen) &&
- (colormap = gdk_screen_get_rgba_colormap (screen)) != NULL)
- {
- /* Set RGBA colormap if possible so VTE can use real transparency */
- gtk_widget_set_colormap (widget, colormap);
- priv->have_argb_visual = TRUE;
- }
- else
- {
- gtk_widget_set_colormap (widget, gdk_screen_get_default_colormap (screen));
- priv->have_argb_visual = FALSE;
- }
-#endif
#endif
_terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
@@ -1721,7 +1667,8 @@ static void
terminal_window_screen_update (TerminalWindow *window,
GdkScreen *screen)
{
- TerminalApp *app;
+ GSettings *settings;
+ GtkSettings *gtk_settings;
terminal_window_window_manager_changed_cb (screen, window);
g_signal_connect (screen, "window-manager-changed",
@@ -1734,16 +1681,22 @@ terminal_window_screen_update (TerminalWindow *window,
if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (screen), "GT::HasSettingsConnection")))
return;
+ settings = terminal_app_get_global_settings (terminal_app_get ());
+ gtk_settings = gtk_settings_get_for_screen (screen);
+
g_object_set_data_full (G_OBJECT (screen), "GT::HasSettingsConnection",
- GINT_TO_POINTER (TRUE),
+ gtk_settings,
(GDestroyNotify) app_setting_notify_destroy_cb);
- app = terminal_app_get ();
- app_setting_notify_cb (app, NULL, screen);
- g_signal_connect (app, "notify::" TERMINAL_APP_ENABLE_MNEMONICS,
- G_CALLBACK (app_setting_notify_cb), screen);
- g_signal_connect (app, "notify::" TERMINAL_APP_ENABLE_MENU_BAR_ACCEL,
- G_CALLBACK (app_setting_notify_cb), screen);
+ g_settings_bind (settings,
+ TERMINAL_SETTING_ENABLE_MNEMONICS_KEY,
+ gtk_settings,
+ "gtk-enable-mnemonics",
+ G_SETTINGS_BIND_GET);
+
+ g_signal_connect (settings, "changed::" TERMINAL_SETTING_ENABLE_MENU_BAR_ACCEL_KEY,
+ G_CALLBACK (enable_menubar_accel_changed_cb),
+ gtk_settings);
}
static void
@@ -1846,13 +1799,15 @@ terminal_window_init (TerminalWindow *window)
{ "EditSelectAll", GTK_STOCK_SELECT_ALL, NULL, NULL,
NULL,
G_CALLBACK (edit_select_all_callback) },
+#if 0
{ "EditProfiles", NULL, N_("P_rofilesâ"), NULL,
NULL,
G_CALLBACK (edit_profiles_callback) },
+#endif
{ "EditKeybindings", NULL, N_("_Keyboard Shortcutsâ"), NULL,
NULL,
G_CALLBACK (edit_keybindings_callback) },
- { "EditCurrentProfile", NULL, N_("Pr_ofile Preferences"), NULL,
+ { "EditCurrentProfile", GTK_STOCK_PREFERENCES, N_("_Preferencesâ"), NULL,
NULL,
G_CALLBACK (edit_current_profile_callback) },
@@ -2028,11 +1983,8 @@ terminal_window_init (TerminalWindow *window)
gtk_notebook_set_scrollable (GTK_NOTEBOOK (priv->notebook), TRUE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
-#if GTK_CHECK_VERSION (2, 90, 8)
gtk_notebook_set_group_name (GTK_NOTEBOOK (priv->notebook), I_("gnome-terminal-window"));
-#else
- gtk_notebook_set_group (GTK_NOTEBOOK (priv->notebook), GUINT_TO_POINTER (1));
-#endif
+
g_signal_connect (priv->notebook, "button-press-event",
G_CALLBACK (notebook_button_press_cb), window);
g_signal_connect (priv->notebook, "popup-menu",
@@ -2046,7 +1998,6 @@ terminal_window_init (TerminalWindow *window)
g_signal_connect_data (priv->notebook, "page-reordered",
G_CALLBACK (terminal_window_update_tabs_menu_sensitivity),
window, NULL, G_CONNECT_SWAPPED | G_CONNECT_AFTER);
-#if GTK_CHECK_VERSION (2, 90, 8)
g_signal_connect (priv->notebook, "create-window",
G_CALLBACK (handle_tab_droped_on_desktop), window);
@@ -2054,7 +2005,6 @@ terminal_window_init (TerminalWindow *window)
gtk_widget_add_events (priv->notebook, GDK_SCROLL_MASK);
g_signal_connect (priv->notebook, "scroll-event",
G_CALLBACK (notebook_scroll_event_cb), window);
-#endif
gtk_box_pack_end (GTK_BOX (main_vbox), priv->notebook, TRUE, TRUE, 0);
gtk_widget_show (priv->notebook);
@@ -2160,10 +2110,6 @@ terminal_window_class_init (TerminalWindowClass *klass)
widget_class->screen_changed = terminal_window_screen_changed;
g_type_class_add_private (object_class, sizeof (TerminalWindowPrivate));
-
-#if !GTK_CHECK_VERSION (2, 90, 8)
- gtk_notebook_set_window_creation_hook (handle_tab_droped_on_desktop, NULL, NULL);
-#endif
}
static void
@@ -2301,7 +2247,7 @@ terminal_window_set_is_restored (TerminalWindow *window)
static void
profile_set_callback (TerminalScreen *screen,
- TerminalProfile *old_profile,
+ GSettings *old_profile,
TerminalWindow *window)
{
TerminalWindowPrivate *priv = window->priv;
@@ -2595,64 +2541,7 @@ terminal_window_set_size_force_grid (TerminalWindow *window,
if (force_grid_height >= 0)
grid_height = force_grid_height;
-#if GTK_CHECK_VERSION (2, 91, 1)
gtk_window_resize_to_geometry (GTK_WINDOW (app), grid_width, grid_height);
-#else
-{
- /* Owen's hack from gnome-terminal */
-
- GtkBorder *inner_border = NULL;
- GtkRequisition toplevel_request;
- GtkRequisition widget_request;
- int char_width;
- int char_height;
- int w, h;
-
- /* This set_size_request hack is because the extra size above base
- * size should only include the width of widgets to the side of the
- * terminal and the height of widgets above and below the terminal.
- * The minimum width of the menu, for example, shouldn't be included.
- * GTK+ computes this extra size as:
- *
- * size_request(toplevel) - size_request(geometry_widget)
-
- * Which only works when the terminal has a size request wider than
- * the menu and taller than scrollbar.
- *
- * See https://bugzilla.gnome.org/show_bug.cgi?id=68668
- *
- * The size request can be huge without hosing anything because we
- * set the MIN_SIZE geometry hint.
- */
- gtk_widget_set_size_request (widget, 2000, 2000);
- gtk_widget_size_request (app, &toplevel_request);
- gtk_widget_size_request (widget, &widget_request);
-
- terminal_screen_get_cell_size (screen, &char_width, &char_height);
-
- _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
- "[window %p] set size: toplevel %dx%d widget %dx%d grid %dx%d char-cell %dx%d\n",
- window,
- toplevel_request.width, toplevel_request.height,
- widget_request.width, widget_request.height,
- grid_width, grid_height, char_width, char_height);
-
- w = toplevel_request.width - widget_request.width;
- h = toplevel_request.height - widget_request.height;
-
- gtk_widget_style_get (widget, "inner-border", &inner_border, NULL);
- w += (inner_border ? (inner_border->left + inner_border->right) : 0) + char_width * grid_width;
- h += (inner_border ? (inner_border->top + inner_border->bottom) : 0) + char_height * grid_height;
- gtk_border_free (inner_border);
-
- _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
- "[window %p] set size: grid %dx%d force %dx%d setting %dx%d pixels\n",
- window,
- grid_width, grid_height, force_grid_width, force_grid_height, w, h);
-
- gtk_window_resize (GTK_WINDOW (app), w, h);
-}
-#endif
}
void
@@ -2745,22 +2634,15 @@ notebook_popup_menu_cb (GtkWidget *widget,
static void
notebook_page_selected_callback (GtkWidget *notebook,
-#if GTK_CHECK_VERSION (2, 90, 6)
GtkWidget *page_widget,
-#else
- gpointer useless_crap,
-#endif
guint page_num,
TerminalWindow *window)
{
TerminalWindowPrivate *priv = window->priv;
GtkWidget *widget;
TerminalScreen *screen;
- TerminalProfile *profile;
+ GSettings *profile;
int old_grid_width, old_grid_height;
-#if !GTK_CHECK_VERSION (2, 90, 6)
- GtkWidget *page_widget;
-#endif
_terminal_debug_print (TERMINAL_DEBUG_MDI,
"[window %p] MDI: page-selected %d\n",
@@ -2769,10 +2651,6 @@ notebook_page_selected_callback (GtkWidget *notebook,
if (priv->disposed)
return;
-#if !GTK_CHECK_VERSION (2, 90, 6)
- page_widget = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), page_num);
-#endif
-
screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (page_widget));
widget = GTK_WIDGET (screen);
g_assert (screen != NULL);
@@ -2809,7 +2687,8 @@ notebook_page_selected_callback (GtkWidget *notebook,
if (priv->use_default_menubar_visibility)
{
gboolean setting =
- terminal_profile_get_property_boolean (terminal_screen_get_profile (screen), TERMINAL_PROFILE_DEFAULT_SHOW_MENUBAR);
+ g_settings_get_boolean (terminal_app_get_global_settings (terminal_app_get ()),
+ TERMINAL_SETTING_DEFAULT_SHOW_MENUBAR_KEY);
terminal_window_set_menubar_visible (window, setting);
}
@@ -2969,8 +2848,6 @@ notebook_page_removed_callback (GtkWidget *notebook,
}
}
-#if GTK_CHECK_VERSION (2, 90, 8)
-
static gboolean
notebook_scroll_event_cb (GtkWidget *widget,
GdkEventScroll *event,
@@ -3015,8 +2892,6 @@ notebook_scroll_event_cb (GtkWidget *widget,
return TRUE;
}
-#endif /* GTK 3.0 */
-
gboolean
terminal_window_parse_geometry (TerminalWindow *window,
const char *geometry)
@@ -3138,7 +3013,7 @@ file_new_window_callback (GtkAction *action,
TerminalWindowPrivate *priv = window->priv;
TerminalApp *app;
TerminalWindow *new_window;
- TerminalProfile *profile;
+ GSettings *profile;
char *new_working_directory;
app = terminal_app_get ();
@@ -3147,11 +3022,6 @@ file_new_window_callback (GtkAction *action,
if (!profile)
profile = terminal_screen_get_profile (priv->active_screen);
if (!profile)
- profile = terminal_app_get_profile_for_new_term (app);
- if (!profile)
- return;
-
- if (_terminal_profile_get_forgotten (profile))
return;
new_window = terminal_app_new_window (app, gtk_widget_get_screen (GTK_WIDGET (window)));
@@ -3173,7 +3043,7 @@ file_new_tab_callback (GtkAction *action,
{
TerminalWindowPrivate *priv = window->priv;
TerminalApp *app;
- TerminalProfile *profile;
+ GSettings *profile;
char *new_working_directory;
app = terminal_app_get ();
@@ -3181,11 +3051,6 @@ file_new_tab_callback (GtkAction *action,
if (!profile)
profile = terminal_screen_get_profile (priv->active_screen);
if (!profile)
- profile = terminal_app_get_profile_for_new_term (app);
- if (!profile)
- return;
-
- if (_terminal_profile_get_forgotten (profile))
return;
new_working_directory = terminal_screen_get_current_dir_with_fallback (priv->active_screen);
@@ -3226,7 +3091,6 @@ confirm_close_window_or_tab (TerminalWindow *window,
{
TerminalWindowPrivate *priv = window->priv;
GtkWidget *dialog;
- GConfClient *client;
gboolean do_confirm;
int n_tabs;
@@ -3237,9 +3101,8 @@ confirm_close_window_or_tab (TerminalWindow *window,
GTK_RESPONSE_DELETE_EVENT);
}
- client = gconf_client_get_default ();
- do_confirm = gconf_client_get_bool (client, CONF_GLOBAL_PREFIX "/confirm_window_close", NULL);
- g_object_unref (client);
+ do_confirm = g_settings_get_boolean (terminal_app_get_global_settings (terminal_app_get ()),
+ TERMINAL_SETTING_CONFIRM_CLOSE_KEY);
if (!do_confirm)
return FALSE;
@@ -3562,6 +3425,7 @@ file_new_profile_callback (GtkAction *action,
GTK_WINDOW (window));
}
+#if 0
static void
edit_profiles_callback (GtkAction *action,
TerminalWindow *window)
@@ -3569,6 +3433,7 @@ edit_profiles_callback (GtkAction *action,
terminal_app_manage_profiles (terminal_app_get (),
GTK_WINDOW (window));
}
+#endif
static void
view_menubar_toggled_callback (GtkToggleAction *action,
@@ -3839,14 +3704,8 @@ terminal_set_title_callback (GtkAction *action,
g_signal_connect (dialog, "delete-event",
G_CALLBACK (terminal_util_dialog_response_on_delete), NULL);
-#if GTK_CHECK_VERSION (2, 90, 6)
message_area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog));
gtk_container_foreach (GTK_CONTAINER (message_area), (GtkCallback) gtk_widget_hide, NULL);
-#else
- label = GTK_MESSAGE_DIALOG (dialog)->label;
- gtk_widget_hide (label);
- message_area = gtk_widget_get_parent (label);
-#endif
hbox = gtk_hbox_new (FALSE, 12);
gtk_box_pack_start (GTK_BOX (message_area), hbox, FALSE, FALSE, 0);
@@ -3914,9 +3773,9 @@ tabs_next_or_previous_tab_cb (GtkAction *action,
name = gtk_action_get_name (action);
if (strcmp (name, "TabsNext") == 0) {
- keyval = GDK_KEY (Page_Down);
+ keyval = GDK_KEY_Page_Down;
} else if (strcmp (name, "TabsPrevious") == 0) {
- keyval = GDK_KEY (Page_Up);
+ keyval = GDK_KEY_Page_Up;
}
klass = GTK_NOTEBOOK_GET_CLASS (GTK_NOTEBOOK (priv->notebook));
@@ -3924,11 +3783,7 @@ tabs_next_or_previous_tab_cb (GtkAction *action,
gtk_binding_set_activate (gtk_binding_set_by_class (klass),
keyval,
GDK_CONTROL_MASK,
-#if GTK_CHECK_VERSION (2, 90, 8)
G_OBJECT (priv->notebook));
-#else
- GTK_OBJECT (priv->notebook));
-#endif
}
static void
@@ -4010,7 +3865,7 @@ help_about_callback (GtkAction *action,
"Copyright  2002â2004 Havoc Pennington\n"
"Copyright  2003â2004, 2007 Mariano SuÃrez-Alvarez\n"
"Copyright  2006 Guilherme de S. Pastore\n"
- "Copyright  2007â2010 Christian Persch";
+ "Copyright  2007â2011 Christian Persch";
char *licence_text;
GKeyFile *key_file;
GError *error = NULL;
diff --git a/src/terminal-window.h b/src/terminal-window.h
index 006982f..083b87a 100644
--- a/src/terminal-window.h
+++ b/src/terminal-window.h
@@ -1,18 +1,18 @@
/*
* Copyright  2001 Havoc Pennington
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * This programme is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * This programme is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
+ * You should have received a copy of the GNU General Public
+ * License along with this programme; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
diff --git a/src/terminal.c b/src/terminal.c
index 202b850..4003d28 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -3,7 +3,7 @@
* Copyright  2002 Red Hat, Inc.
* Copyright  2002 Sun Microsystems
* Copyright  2003 Mariano Suarez-Alvarez
- * Copyright  2008, 2010 Christian Persch
+ * Copyright  2008, 2010, 2011 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
@@ -387,28 +387,6 @@ name_lost_cb (GDBusConnection *connection,
gtk_main_quit ();
}
-/* Settings storage works as follows:
- * /apps/gnome-terminal/global/
- * /apps/gnome-terminal/profiles/Foo/
- *
- * It's somewhat tricky to manage the profiles/ dir since we need to track
- * the list of profiles, but gconf doesn't have a concept of notifying that
- * a directory has appeared or disappeared.
- *
- * Session state is stored entirely in the RestartCommand command line.
- *
- * The number one rule: all stored information is EITHER per-session,
- * per-profile, or set from a command line option. THERE CAN BE NO
- * OVERLAP. The UI and implementation totally break if you overlap
- * these categories. See gnome-terminal 1.x for why.
- *
- * Don't use this code as an example of how to use GConf - it's hugely
- * overcomplicated due to the profiles stuff. Most apps should not
- * have to do scary things of this nature, and should not have
- * a profiles feature.
- *
- */
-
/* Copied from libnautilus/nautilus-program-choosing.c; Needed in case
* we have no DESKTOP_STARTUP_ID (with its accompanying timestamp).
*/
diff --git a/src/terminal.xml b/src/terminal.xml
index 3c9cbed..0888ea7 100644
--- a/src/terminal.xml
+++ b/src/terminal.xml
@@ -19,7 +19,7 @@
<separator />
<menuitem action="EditSelectAll" />
<separator />
- <menuitem action="EditProfiles" />
+ <!-- <menuitem action="EditProfiles" /> -->
<menuitem action="EditKeybindings" />
<menuitem action="EditCurrentProfile" />
</menu>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]