diff --git a/Makefile.am b/Makefile.am
index 16375a9..3fa23e0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,7 +9,7 @@ DISTCHECK_CONFIGURE_FLAGS = \
--disable-silent-rules \
CFLAGS='-Wno-deprecated-declarations'
-@INTLTOOL_XML_RULE@
+#INTLTOOL_XML_RULE@
appdatadir = $(datadir)/metainfo
appdata_in_files = gatuno-terminal.appdata.xml.in
appdata_DATA = $(appdata_in_files:.xml.in=.xml)
@@ -17,20 +17,21 @@ appdata_DATA = $(appdata_in_files:.xml.in=.xml)
desktopdir = $(datadir)/applications
desktop_in_files = @PACKAGE@.desktop.in.in
desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop)
-@INTLTOOL_DESKTOP_RULE@
+#INTLTOOL_DESKTOP_RULE@
man_MANS = gatuno-terminal.1
bin_SCRIPTS = gatuno-terminal.wrapper
-EXTRA_DIST = \
+EXTRA_DIST = \
+ config.rpath \
xmldocs.make \
omf.make \
gatuno-terminal.wrapper \
$(appdata_in_files) \
$(man_MANS) \
$(NULL)
-# autogen.sh \
+# autogen.sh
CLEANFILES = \
gatuno-terminal.appdata.xml \
diff --git a/configure.ac b/configure.ac
index ac9a546..f94b4d9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,7 +29,7 @@ PKG_PROG_PKG_CONFIG
AC_PROG_CC
AC_HEADER_STDC
AM_PROG_LIBTOOL
-IT_PROG_INTLTOOL([0.50.1])
+#IT_PROG_INTLTOOL([0.50.1])
AM_GLIB_GNU_GETTEXT
diff --git a/src/Makefile.am b/src/Makefile.am
index 938120c..646ad56 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -142,15 +142,11 @@ terminal-marshal.c: $(srcdir)/terminal-marshal.list
terminal-resources.h terminal-resources.c: terminal.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/terminal.gresource.xml)
$(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name terminal $<
-gsettingsschema_in_files = org.mate.terminal.gschema.xml.in
-gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml)
-.PRECIOUS: $(gsettings_SCHEMAS)
-@INTLTOOL_XML_NOMERGE_RULE@
+#INTLTOOL_XML_NOMERGE_RULE@
CLEANFILES = \
stamp-terminal-type-builtins.h \
mate-terminal.schemas \
- $(gsettings_SCHEMAS) \
stamp-terminal-type-builtins.h \
$(BUILT_SOURCES)
@@ -171,13 +167,8 @@ EXTRA_DIST = \
extra-strings.c \
$(about_DATA) \
$(schema_in_files) \
- $(gsettingsschema_in_files) \
$(uimanager_DATA) \
$(builder_DATA) \
$(NULL)
-@GSETTINGS_RULES@
-
-@INTLTOOL_SCHEMAS_RULE@
-
-include $(top_srcdir)/git.mk
diff --git a/src/org.mate.terminal.gschema.xml.in b/src/org.mate.terminal.gschema.xml.in
deleted file mode 100644
index 2e0659c..0000000
--- a/src/org.mate.terminal.gschema.xml.in
+++ /dev/null
@@ -1,484 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [ 'default' ]
- List of profiles
- List of profiles known to mate-terminal. The list contains strings naming subdirectories relative to /org/mate/terminal/profiles.
-
-
- 'default'
- Profile to use for new terminals
- Profile to be used when opening a new window or tab. Must be in profile_list.
-
-
- true
- Whether the menubar has access keys
- 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.
-
-
- true
- Whether the standard GTK+ shortcut for menubar access is enabled
- 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.
-
-
- [ 'UTF-8', 'current' ]
- List of available encodings
- 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.
-
-
- true
- Whether to ask for confirmation when closing terminal windows
- Whether to ask for confirmation when closing a terminal window which has more than one open tab or any foreground subprocesses.
-
-
- false
- Close tabs with middle click
- If true, it enables the ability to close tabs using middle click.
-
-
- false
- Switch tabs with [Ctrl]+[Tab]
- If true, it enables the ability to switch tabs using [Ctrl+Tab] and [Ctrl+Shift+Tab].
-
-
-
-
-
-
- 'Default'
- Human-readable name of the profile
- Human-readable name of the profile.
-
-
- true
- Whether to show menubar in new windows/tabs
- True if the menubar should be shown in new windows, for windows/tabs with this profile.
-
-
- '#000000'
- Default color of text in the terminal
- Default color of text in the terminal, as a color specification (can be HTML-style hex digits, or a color name such as "red").
-
-
- '#FFFFDD'
- Default color of terminal background
- Default color of terminal background, as a color specification (can be HTML-style hex digits, or a color name such as "red").
-
-
- '#000000'
- Default color of bold text in the terminal
- 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.
-
-
- true
- Whether bold text should use the same color as normal text
- If true, boldface text will be rendered using the same color as normal text.
-
-
- 'replace'
- What to do with dynamic title
- 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".
-
-
- 'Terminal'
- Title for terminal
- 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.
-
-
- true
- Whether to allow bold text
- If true, allow applications in the terminal to make text boldface.
-
-
- false
- Whether to silence terminal bell
- If true, don't make a noise when applications send the escape sequence for the terminal bell.
-
-
- false
- Copy selection to clipboard
- If true, selection is automatically copied to clipboard buffer.
-
-
- '-A-Za-z0-9,./?%&#:_=+@~'
- Characters that are considered "part of a word"
- 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.
-
-
- false
- Whether to use custom terminal size for new windows
- If true, newly created terminal windows will have custom size specified by default_size_columns and default_size_rows.
-
-
- 80
- Default number of columns
- Number of columns in newly created terminal windows. Has no effect if use_custom_default_size is not enabled.
-
-
- 24
- Default number of rows
- Number of rows in newly created terminal windows. Has no effect if use_custom_default_size is not enabled.
-
-
- 'right'
- Position of the scrollbar
- Where to put the terminal scrollbar. Possibilities are "left", "right", and "hidden".
-
-
- 512
- Number of lines to keep in scrollback
- 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.
-
-
- false
- Whether an unlimited number of lines should be kept in scrollback
- 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.
-
-
- true
- Whether to scroll to the bottom when a key is pressed
- If true, pressing a key jumps the scrollbar to the bottom.
-
-
- false
- Whether to scroll to the bottom when there's new output
- If true, whenever there's new output the terminal will scroll to the bottom.
-
-
- 'close'
- What to do with the terminal when the child command exits
- Possible values are "close" to close the terminal, and "restart" to restart the command.
-
-
- false
- Whether to launch the command in the terminal as a login shell
- If true, the command inside the terminal will be launched as a login shell. (argv[0] will have a hyphen in front of it.)
-
-
- false
- Whether to run a custom command instead of the shell
- If true, the value of the custom_command setting will be used in place of running a shell.
-
-
- 'system'
- Whether to blink the cursor
- The possible values are "system" to use the global cursor blinking settings, or "on" or "off" to set the mode explicitly.
-
-
- 'block'
- The cursor appearance
- The possible values are "block" to use a block cursor, "ibeam" to use a vertical line cursor, or "underline" to use an underline cursor.
-
-
- ''
- Custom command to use instead of the shell
- Run this command in place of the shell, if use_custom_command is true.
-
-
- ''
- Icon for terminal window
- Icon to use for tabs/windows containing this profile.
-
-
- '#2E2E34343636:#CCCC00000000:#4E4E9A9A0606:#C4C4A0A00000:#34346565A4A4:#757550507B7B:#060698209A9A:#D3D3D7D7CFCF:#555557575353:#EFEF29292929:#8A8AE2E23434:#FCFCE9E94F4F:#72729F9FCFCF:#ADAD7F7FA8A8:#3434E2E2E2E2:#EEEEEEEEECEC'
- Palette for terminal applications
- Terminals have a 16-color palette that applications inside the terminal can use. This is that palette, in the form of a colon-separated list of color names. Color names should be in hex format e.g. "#FF00FF"
-
-
- 'Monospace 12'
- Font
- An Pango font name. Examples are "Sans 12" or "Monospace Bold 14".
-
-
- 'solid'
- Background type
- Type of terminal background. May be "solid" for a solid color, "image" for an image, or "transparent" for either real transparency if a compositing window manager is running, or pseudo-transparency otherwise.
-
-
- ''
- Background image
- Filename of a background image.
-
-
- true
- Whether to scroll background image
- If true, scroll the background image with the foreground text; if false, keep the image in a fixed position and scroll the text above it.
-
-
- 0.5
- How much to darken the background image
- A value between 0.0 and 1.0 indicating how much to darken the background image. 0.0 means no darkness, 1.0 means fully dark. In the current implementation, there are only two levels of darkness possible, so the setting behaves as a boolean, where 0.0 disables the darkening effect.
-
-
- 'ascii-del'
- Effect of the Backspace key
- Sets what code the backspace key generates. Possible values are "ascii-del" for the ASCII DEL character, "control-h" for Control-H (AKA the ASCII BS character), "escape-sequence" for the escape sequence typically bound to backspace or delete. "ascii-del" is normally considered the correct setting for the Backspace key.
-
-
- 'escape-sequence'
- Effect of the Delete key
- Sets what code the delete key generates. Possible values are "ascii-del" for the ASCII DEL character, "control-h" for Control-H (AKA the ASCII BS character), "escape-sequence" for the escape sequence typically bound to backspace or delete. "escape-sequence" is normally considered the correct setting for the Delete key.
-
-
- true
- Whether to use the colors from the theme for the terminal widget
- If true, the theme color scheme used for text entry boxes will be used for the terminal, instead of colors provided by the user.
-
-
- true
- Whether to use the system font
- If true, the terminal will use the desktop-global standard font if it's monospace (and the most similar font it can come up with otherwise).
-
-
- true
- Highlight S/Key challenges
- Popup a dialog when an S/Key challenge response query is detected and clicked on. Typing a password into the dialog will send it to the terminal.
-
-
-
-
- '<Ctrl><Shift>t'
- Keyboard shortcut to open a new tab
- Keyboard shortcut key for opening a new tab. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Ctrl><Shift>n'
- Keyboard shortcut to open a new window
- Keyboard shortcut key for opening a new window. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- 'disabled'
- Keyboard shortcut to create a new profile
- Keyboard shortcut key for bringing up the dialog for profile creation. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- 'disabled'
- Keyboard shortcut to save the current tab contents to file
- Keyboard shortcut key to save the current tab contents to a file. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Ctrl><Shift>w'
- Keyboard shortcut to close a tab
- Keyboard shortcut key for closing a tab. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Ctrl><Shift>q'
- Keyboard shortcut to close a window
- Keyboard shortcut key for closing a window. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Ctrl><Shift>c'
- Keyboard shortcut to copy text
- Keyboard shortcut key for copying selected text to the clipboard. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Ctrl><Shift>v'
- Keyboard shortcut to paste text
- Keyboard shortcut key for pasting the contents of the clipboard in the terminal. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Ctrl><Shift>a'
- Keyboard shortcut to select all text
- Keyboard shortcut key for selecting all the text in the terminal. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Ctrl><Shift>f'
- Keyboard shortcut to show the find dialog
- Keyboard shortcut key for showing the find dialog. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Ctrl><Shift>h'
- Keyboard shortcut to find the next occurrence of the search term
- Keyboard shortcut key for finding the next occurrence of the search term in the terminal. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Ctrl><Shift>g'
- Keyboard shortcut to find the previous occurrence of the search term
- Keyboard shortcut key for finding the previous occurrence of the search term in the terminal. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- 'F11'
- Keyboard shortcut to toggle full screen mode
- Keyboard shortcut key for toggling full screen mode. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- 'disabled'
- Keyboard shortcut to toggle the visibility of the menubar
- Keyboard shortcut key to toggle the visibility of the menubar. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- 'disabled'
- Keyboard shortcut to set the terminal title
- Keyboard shortcut key to set the terminal title. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- 'disabled'
- Keyboard shortcut to reset the terminal
- Keyboard shortcut key to reset the terminal. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- 'disabled'
- Keyboard shortcut to reset and clear the terminal
- Keyboard shortcut key to reset and clear the terminal. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Control>Page_Up'
- Keyboard shortcut to switch to the previous tab
- Keyboard shortcut key to switch to the previous tab. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Control>Page_Down'
- Keyboard shortcut to switch to the next tab
- Keyboard shortcut key to switch to the next tab. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Alt>Page_Up'
- Keyboard shortcut to switch to the previous profile
- Keyboard shortcut key to switch to the previous profile. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Alt>Page_Down'
- Keyboard shortcut to switch to the next profile
- Keyboard shortcut key to switch to the next profile. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Ctrl><Shift>Page_Up'
- Accelerator to move the current tab to the left.
- Accelerator key to move the current tab to the left. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keybinding for this action.
-
-
- '<Ctrl><Shift>Page_Down'
- Accelerator to move the current tab to the right.
- Accelerator key to move the current tab to the right. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keybinding for this action.
-
-
- 'disabled'
- Accelerator to detach current tab.
- Accelerator key to detach current tab. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keybinding for this action.
-
-
- '<Alt>1'
- Keyboard shortcut to switch to tab 1
- Keyboard shortcut key for switch to tab 1. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Alt>2'
- Keyboard shortcut to switch to tab 2
- Keyboard shortcut key for switch to tab 2. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Alt>3'
- Keyboard shortcut to switch to tab 3
- Keyboard shortcut key for switch to tab 3. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Alt>4'
- Keyboard shortcut to switch to tab 4
- Keyboard shortcut key for switch to tab 4. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Alt>5'
- Keyboard shortcut to switch to tab 5
- Keyboard shortcut key for switch to tab 5. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Alt>6'
- Keyboard shortcut to switch to tab 6
- Keyboard shortcut key for switch to tab 6. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Alt>7'
- Keyboard shortcut to switch to tab 7
- Keyboard shortcut key for switch to tab 7. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Alt>8'
- Keyboard shortcut to switch to tab 8
- Keyboard shortcut key for switch to tab 8. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Alt>9'
- Keyboard shortcut to switch to tab 9
- Keyboard shortcut key for switch to tab 9. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Alt>0'
- Keyboard shortcut to switch to tab 10
- Keyboard shortcut key for switch to tab 10. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- 'disabled'
- Keyboard shortcut to switch to tab 11
- Keyboard shortcut key for switch to tab 11. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- 'disabled'
- Keyboard shortcut to switch to tab 12
- Keyboard shortcut key for switch to tab 12. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- 'F1'
- Keyboard shortcut to launch help
- Keyboard shortcut key for launching help. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Ctrl>plus'
- Keyboard shortcut to make font larger
- Keyboard shortcut key for making font larger. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Ctrl>minus'
- Keyboard shortcut to make font smaller
- Keyboard shortcut key for making font smaller. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
- '<Ctrl>0'
- Keyboard shortcut to make font normal-size
- Keyboard shortcut key for making font the normal size. Expressed as a string in the same format used for GTK+ resource files. If you set the option to the special string "disabled", then there will be no keyboard shortcut for this action.
-
-
-
diff --git a/src/terminal-accels.c b/src/terminal-accels.c
index 1445230..40fc9e4 100644
--- a/src/terminal-accels.c
+++ b/src/terminal-accels.c
@@ -359,7 +359,7 @@ enum
N_COLUMNS
};
-static void keys_change_notify (GSettings *settings,
+static void keys_change_notify (GKeyFile *settings,
const gchar *key,
gpointer user_data);
@@ -373,10 +373,6 @@ static gboolean binding_from_string (const char *str,
guint *accelerator_key,
GdkModifierType *accelerator_mods);
-static gboolean binding_from_value (GVariant *value,
- guint *accelerator_key,
- GdkModifierType *accelerator_mods);
-
static gboolean sync_idle_cb (gpointer data);
static guint sync_idle_id = 0;
@@ -386,7 +382,7 @@ static int inside_gsettings_notify = 0;
static GtkWidget *edit_keys_dialog = NULL;
static GtkTreeStore *edit_keys_store = NULL;
static GHashTable *gsettings_key_to_entry;
-static GSettings *settings_keybindings;
+static GKeyFile *settings_keybindings;
static char*
binding_name (guint keyval,
@@ -412,14 +408,13 @@ void
terminal_accels_init (void)
{
guint i, j;
-
- settings_keybindings = g_settings_new (CONF_KEYS_SCHEMA);
-
- g_signal_connect (settings_keybindings,
- "changed",
- G_CALLBACK(keys_change_notify),
- NULL);
-
+ gchar *concat;
+
+ settings_keybindings = g_key_file_new ();
+ concat = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/keybindings", NULL);
+ g_key_file_load_from_file (settings_keybindings, concat, G_KEY_FILE_KEEP_COMMENTS, NULL);
+ g_free (concat);
+
gsettings_key_to_entry = g_hash_table_new (g_str_hash, g_str_equal);
notification_group = gtk_accel_group_new ();
@@ -455,11 +450,13 @@ terminal_accels_init (void)
void
terminal_accels_shutdown (void)
{
-
- g_signal_handlers_disconnect_by_func (settings_keybindings,
- G_CALLBACK(keys_change_notify),
- NULL);
- g_object_unref (settings_keybindings);
+ gchar *concat;
+
+ concat = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/keybindings", NULL);
+ g_key_file_save_to_file (settings_keybindings, concat, NULL);
+ g_free (concat);
+
+ g_key_file_free (settings_keybindings);
if (sync_idle_id != 0)
{
@@ -497,11 +494,11 @@ update_model_foreach (GtkTreeModel *model,
}
static void
-keys_change_notify (GSettings *settings,
+keys_change_notify (GKeyFile *settings,
const gchar *key,
gpointer user_data)
{
- GVariant *val;
+ gchar *val;
KeyEntry *key_entry;
GdkModifierType mask;
guint keyval;
@@ -510,19 +507,17 @@ keys_change_notify (GSettings *settings,
"key %s changed\n",
key);
- val = g_settings_get_value (settings, key);
+ val = g_key_file_get_string (settings, CONF_KEYS_SCHEMA, key, NULL);
#ifdef MATE_ENABLE_DEBUG
_TERMINAL_DEBUG_IF (TERMINAL_DEBUG_ACCELS)
{
if (val == NULL)
_terminal_debug_print (TERMINAL_DEBUG_ACCELS, " changed to be unset\n");
- else if (!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))
- _terminal_debug_print (TERMINAL_DEBUG_ACCELS, " changed to non-string value\n");
else
_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
" changed to \"%s\"\n",
- g_variant_get_string (val, NULL));
+ val);
}
#endif
@@ -532,15 +527,16 @@ keys_change_notify (GSettings *settings,
/* 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");
+ g_free (val);
return;
}
- if (!binding_from_value (val, &keyval, &mask))
+ if (!binding_from_string (val, &keyval, &mask))
{
- const char *str = g_variant_is_of_type (val, G_VARIANT_TYPE_STRING) ? g_variant_get_string (val, NULL) : NULL;
g_printerr ("The value \"%s\" of configuration key %s is not a valid accelerator\n",
- str ? str : "(null)",
+ val ? val : "(null)",
key_entry->gsettings_key);
+ g_free (val);
return;
}
key_entry->gsettings_keyval = keyval;
@@ -563,7 +559,7 @@ keys_change_notify (GSettings *settings,
inside_gsettings_notify -= 1;
/* Lock the path if the GSettings key isn't writable */
- key_entry->accel_path_unlocked = g_settings_is_writable (settings, key);
+ key_entry->accel_path_unlocked = TRUE;
if (!key_entry->accel_path_unlocked)
gtk_accel_map_lock_path (key_entry->accel_path);
@@ -577,7 +573,7 @@ keys_change_notify (GSettings *settings,
if (edit_keys_store)
gtk_tree_model_foreach (GTK_TREE_MODEL (edit_keys_store), update_model_foreach, key_entry);
- g_variant_unref(val);
+ g_free (val);
}
static void
@@ -639,31 +635,10 @@ binding_from_string (const char *str,
return TRUE;
}
-static gboolean
-binding_from_value (GVariant *value,
- guint *accelerator_key,
- GdkModifierType *accelerator_mods)
-{
- if (value == NULL)
- {
- /* unset */
- *accelerator_key = 0;
- *accelerator_mods = 0;
- return TRUE;
- }
-
- if (!g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
- return FALSE;
-
- return binding_from_string (g_variant_get_string (value,NULL),
- accelerator_key,
- accelerator_mods);
-}
-
static void
add_key_entry_to_changeset (gpointer key,
KeyEntry *key_entry,
- GSettings *changeset)
+ GKeyFile *changeset)
{
GtkAccelKey gtk_key;
@@ -679,7 +654,7 @@ add_key_entry_to_changeset (gpointer key,
char *accel_name;
accel_name = binding_name (gtk_key.accel_key, gtk_key.accel_mods);
- g_settings_set_string (changeset, key_entry->gsettings_key, accel_name);
+ g_key_file_set_string (changeset, CONF_KEYS_SCHEMA, key_entry->gsettings_key, accel_name);
g_free (accel_name);
}
}
@@ -687,21 +662,13 @@ add_key_entry_to_changeset (gpointer key,
static gboolean
sync_idle_cb (gpointer data)
{
- GSettings *changeset;
-
_terminal_debug_print (TERMINAL_DEBUG_ACCELS,
"GSettings sync handler\n");
sync_idle_id = 0;
- changeset = g_settings_new (CONF_KEYS_SCHEMA);
- g_settings_delay (changeset);
-
- g_hash_table_foreach (gsettings_key_to_entry, (GHFunc) add_key_entry_to_changeset, changeset);
- g_settings_apply(changeset);
-
- g_object_unref (changeset);
-
+ g_hash_table_foreach (gsettings_key_to_entry, (GHFunc) add_key_entry_to_changeset, settings_keybindings);
+
return FALSE;
}
@@ -892,7 +859,7 @@ other_key->user_visible_name ? _(other_key->user_visible_name) : other_key->gset
}
#endif
- g_settings_set_string (settings_keybindings,
+ g_key_file_set_string (settings_keybindings, CONF_KEYS_SCHEMA,
ke->gsettings_key,
str);
g_free (str);
@@ -938,7 +905,7 @@ accel_cleared_callback (GtkCellRendererAccel *cell,
"Cleared keybinding for GSettings %s",
ke->gsettings_key);
- g_settings_set_string (settings_keybindings,
+ g_key_file_set_string (settings_keybindings, CONF_KEYS_SCHEMA,
ke->gsettings_key,
str);
g_free (str);
diff --git a/src/terminal-app.c b/src/terminal-app.c
index 5e5989c..aac25ce 100644
--- a/src/terminal-app.c
+++ b/src/terminal-app.c
@@ -24,7 +24,11 @@
#include
#include
-#include
+#include
+#include
+#include
+#include
+#include
#include "terminal-intl.h"
@@ -47,8 +51,8 @@
#define FALLBACK_PROFILE_ID "default"
/* Settings storage works as follows:
- * /apps/mate-terminal/global/
- * /apps/mate-terminal/profiles/Foo/
+ * ~/.gatuno-terminal/config
+ * ~/.gatuno-terminal/profiles/Foo
*
* It's somewhat tricky to manage the profiles/ dir since we need to track
* the list of profiles, but GSettings doesn't have a concept of notifying that
@@ -90,8 +94,7 @@ struct _TerminalApp
GtkWidget *manage_profiles_delete_button;
GtkWidget *manage_profiles_default_menu;
- GSettings *settings_global;
- GSettings *settings_font;
+ GKeyFile *settings_global;
GHashTable *profiles;
char* default_profile_id;
@@ -161,62 +164,6 @@ static TerminalApp *global_app = NULL;
* FIXME: I suspect there's no need for excessive copies, we might use
* existing profile list to form GVariant's and write them to GSettings
*/
-static gboolean
-gsettings_append_strv (GSettings *settings,
- const gchar *key,
- const gchar *value)
-{
- gchar **old;
- gchar **new;
- gint size;
- gboolean retval;
-
- old = g_settings_get_strv (settings, key);
-
- for (size = 0; old[size] != NULL; size++);
-
- size += 1; /* appended value */
- size += 1; /* NULL */
-
- new = g_realloc_n (old, size, sizeof (gchar *));
-
- new[size - 2] = g_strdup (value);
- new[size - 1] = NULL;
-
- retval = g_settings_set_strv (settings, key,
- (const gchar **) new);
-
- g_strfreev (new);
-
- return retval;
-}
-
-static gboolean
-gsettings_remove_all_from_strv (GSettings *settings,
- const gchar *key,
- const gchar *value)
-{
- GArray *array;
- gchar **old;
- gint i;
- gboolean retval;
-
- old = g_settings_get_strv (settings, key);
- array = g_array_new (TRUE, TRUE, sizeof (gchar *));
-
- for (i = 0; old[i] != NULL; i++) {
- if (g_strcmp0 (old[i], value) != 0)
- array = g_array_append_val (array, old[i]);
- }
-
- retval = g_settings_set_strv (settings, key,
- (const gchar **) array->data);
-
- g_strfreev (old);
- g_array_free (array, TRUE);
-
- return retval;
-}
/* Helper functions */
@@ -383,19 +330,12 @@ terminal_app_delete_profile (TerminalApp *app,
GError *error = NULL;
profile_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME);
- profile_dir = g_strconcat (CONF_PROFILE_PREFIX, profile_name, "/", NULL);
-
- gsettings_remove_all_from_strv (app->settings_global, PROFILE_LIST_KEY, profile_name);
+ profile_dir = g_strconcat ("~/.gatuno-terminal/", profile_name, NULL);
+
+ /* Borrar el archivo */
+ g_unlink (profile_dir);
/* And remove the profile directory */
- DConfClient *client = dconf_client_new ();
- if (!dconf_client_write_sync (client, profile_dir, NULL, NULL, NULL, &error))
- {
- g_warning ("Failed to recursively unset %s: %s\n", profile_dir, error->message);
- g_error_free (error);
- }
-
- g_object_unref (client);
g_free (profile_dir);
}
@@ -563,9 +503,9 @@ profile_combo_box_changed_cb (GtkWidget *widget,
if (!profile)
return;
- g_settings_set_string (app->settings_global, DEFAULT_PROFILE_KEY,
- terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME));
-
+ g_key_file_set_string (app->settings_global, CONF_GLOBAL_SCHEMA, DEFAULT_PROFILE_KEY, terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME));
+ /* FIXME: ¿debería guardar el archivo? */
+
/* Even though the GSettings change notification does this, it happens too late.
* In some cases, the default profile changes twice in quick succession,
* and update_default_profile must be called in sync with those changes.
@@ -809,32 +749,63 @@ find_profile_link (GList *profiles,
return l;
}
+static gchar **terminal_app_profile_list_from_dir (TerminalApp *app) {
+ GDir *dir;
+ gchar *profile_dir;
+ GPtrArray *builder_str;
+ const gchar *file;
+ char *dup;
+ int ret;
+ gchar **profile_list = NULL;
+
+ profile_dir = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/profiles", NULL);
+
+ /* Verificar que exista como directorio */
+ if (g_file_test (profile_dir, G_FILE_TEST_IS_DIR)) {
+ /* Posiblemente no exista, intentar crear como directorio */
+ ret = g_mkdir_with_parents (profile_dir, 0640);
+ } else if (g_file_test (profile_dir, G_FILE_TEST_EXISTS)) {
+ /* Si no es directorio, estamos en problemas */
+ g_free (profile_dir);
+
+ return NULL;
+ }
+
+ builder_str = g_ptr_array_new_with_free_func (g_free);
+ dir = g_dir_open (profile_dir, 0, NULL);
+ g_free (profile_dir);
+ if (dir != NULL) {
+ while (file = g_dir_read_name (dir), file != NULL) {
+ dup = g_strdup (file);
+ g_ptr_array_add (builder_str, dup);
+ }
+
+ g_ptr_array_add (builder_str, NULL);
+ profile_list = (gchar **) g_ptr_array_free (builder_str, FALSE);
+ }
+
+ //g_ptr_array_unref (builder_str);
+ return profile_list;
+}
+
+/* El listador principal de perfiles */
static void
-terminal_app_profile_list_notify_cb (GSettings *settings,
- gchar *key,
- gpointer user_data)
+terminal_app_profile_list_notify_cb (TerminalApp *app)
{
- TerminalApp *app = TERMINAL_APP (user_data);
GObject *object = G_OBJECT (app);
- GVariant *val;
- const gchar **value_list;
+ gchar **value_list;
int i;
GList *profiles_to_delete, *l;
gboolean need_new_default;
TerminalProfile *fallback;
guint count;
-
+
g_object_freeze_notify (object);
profiles_to_delete = terminal_app_get_profile_list (app);
-
- val = g_settings_get_value (settings, key);
- if (val == NULL ||
- (!g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY) &&
- !g_variant_is_of_type (val, G_VARIANT_TYPE_STRING)))
- goto ensure_one_profile;
-
- value_list = g_variant_get_strv (val, NULL);
+
+ value_list = terminal_app_profile_list_from_dir (app);
+
if (value_list == NULL)
goto ensure_one_profile;
@@ -855,13 +826,10 @@ terminal_app_profile_list_notify_cb (GSettings *settings,
terminal_app_create_profile (app, profile_name);
}
- g_free (value_list);
+ g_strfreev (value_list);
ensure_one_profile:
- if (val != NULL)
- g_variant_unref (val);
-
fallback = NULL;
count = g_hash_table_size (app->profiles);
if (count == 0 || count <= g_list_length (profiles_to_delete))
@@ -937,20 +905,17 @@ ensure_one_profile:
}
static void
-terminal_app_default_profile_notify_cb (GSettings *settings,
+terminal_app_default_profile_notify_cb (GKeyFile *settings,
gchar *key,
gpointer user_data)
{
TerminalApp *app = TERMINAL_APP (user_data);
GVariant *val;
- const char *name = NULL;
+ char *name = NULL;
- app->default_profile_locked = !g_settings_is_writable (settings, key);
-
- val = g_settings_get_value (settings, key);
- if (val != NULL &&
- g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))
- name = g_variant_get_string (val, NULL);
+ app->default_profile_locked = FALSE;
+
+ name = g_key_file_get_string (settings, CONF_GLOBAL_SCHEMA, key, NULL);
if (!name || !name[0])
name = FALLBACK_PROFILE_ID;
g_assert (name != NULL);
@@ -961,7 +926,7 @@ terminal_app_default_profile_notify_cb (GSettings *settings,
app->default_profile = terminal_app_get_profile_by_name (app, name);
g_object_notify (G_OBJECT (app), TERMINAL_APP_DEFAULT_PROFILE);
- g_variant_unref (val);
+ g_free (name);
}
static int
@@ -983,18 +948,17 @@ encoding_mark_active (gpointer key,
}
static void
-terminal_app_encoding_list_notify_cb (GSettings *settings,
+terminal_app_encoding_list_notify_cb (GKeyFile *settings,
gchar *key,
gpointer user_data)
{
TerminalApp *app = TERMINAL_APP (user_data);
- GVariant *val;
- const gchar **strings;
+ gchar **strings;
int i;
TerminalEncoding *encoding;
const char *charset;
- app->encodings_locked = !g_settings_is_writable (settings, key);
+ app->encodings_locked = FALSE;
/* 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));
@@ -1010,13 +974,8 @@ terminal_app_encoding_list_notify_cb (GSettings *settings,
g_assert (encoding);
if (terminal_encoding_is_valid (encoding))
encoding->is_active = TRUE;
-
- val = g_settings_get_value (settings, key);
- if (val != NULL &&
- g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY))
- strings = g_variant_get_strv (val, NULL);
- else
- strings = NULL;
+
+ strings = g_key_file_get_string_list (settings, CONF_GLOBAL_SCHEMA, key, NULL, NULL);
if (strings != NULL)
{
@@ -1033,44 +992,38 @@ terminal_app_encoding_list_notify_cb (GSettings *settings,
encoding->is_active = TRUE;
}
- g_free (strings);
+ g_strfreev (strings);
}
g_signal_emit (app, signals[ENCODING_LIST_CHANGED], 0);
-
- if (val != NULL)
- g_variant_unref (val);
}
static void
-terminal_app_system_font_notify_cb (GSettings *settings,
+terminal_app_system_font_notify_cb (GKeyFile *settings,
gchar *key,
gpointer user_data)
{
TerminalApp *app = TERMINAL_APP (user_data);
- GVariant *val;
- const char *font = NULL;
+ char *font = NULL;
PangoFontDescription *font_desc;
if (strcmp (key, MONOSPACE_FONT_KEY) != 0)
return;
-
- val = g_settings_get_value (settings, key);
- if (val &&
- g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))
- font = g_variant_get_string (val, NULL);
+
+ font = g_key_file_get_string (settings, CONF_GLOBAL_SCHEMA, key, NULL);
if (!font)
- font = DEFAULT_MONOSPACE_FONT;
+ font = g_strdup (DEFAULT_MONOSPACE_FONT);
g_assert (font != NULL);
if (font && (strlen (font) == 0)) /* empty string */
- font = DEFAULT_MONOSPACE_FONT;
+ font = g_strdup (DEFAULT_MONOSPACE_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);
+ g_free (font);
return;
}
@@ -1080,18 +1033,24 @@ terminal_app_system_font_notify_cb (GSettings *settings,
app->system_font_desc = font_desc;
g_object_notify (G_OBJECT (app), TERMINAL_APP_SYSTEM_FONT);
- g_variant_unref (val);
+ g_free (font);
}
static void
-terminal_app_enable_mnemonics_notify_cb (GSettings *settings,
+terminal_app_enable_mnemonics_notify_cb (GKeyFile *settings,
gchar *key,
gpointer user_data)
{
TerminalApp *app = TERMINAL_APP (user_data);
gboolean enable;
+ GError *gerror = NULL;
- enable = g_settings_get_boolean (settings, key);
+ enable = g_key_file_get_boolean (settings, CONF_GLOBAL_SCHEMA, key, &gerror);
+ if (gerror != NULL) {
+ /* Ocurrió un error, no es booleano */
+ g_error_free (gerror);
+ return;
+ }
if (enable == app->enable_mnemonics)
return;
@@ -1100,14 +1059,20 @@ terminal_app_enable_mnemonics_notify_cb (GSettings *settings,
}
static void
-terminal_app_enable_menu_accels_notify_cb (GSettings *settings,
+terminal_app_enable_menu_accels_notify_cb (GKeyFile *settings,
gchar *key,
gpointer user_data)
{
TerminalApp *app = TERMINAL_APP (user_data);
gboolean enable;
+ GError *gerror = NULL;
- enable = g_settings_get_boolean (settings, key);
+ enable = g_key_file_get_boolean (settings, CONF_GLOBAL_SCHEMA, key, &gerror);
+ if (gerror != NULL) {
+ /* Ocurrió un error, no es booleano */
+ g_error_free (gerror);
+ return;
+ }
if (enable == app->enable_menu_accels)
return;
@@ -1160,14 +1125,13 @@ new_profile_response_cb (GtkWidget *new_profile_dialog,
{
confirm_dialog = gtk_message_dialog_new (GTK_WINDOW (new_profile_dialog),
GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_YES_NO,
- _("You already have a profile called “%s”. Do you want to create another profile with the same name?"), name);
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _("You already have a profile called “%s”. Can't have two profiles with the same name"), name);
/* Alternative button order was set automatically by GtkMessageDialog */
retval = gtk_dialog_run (GTK_DIALOG (confirm_dialog));
gtk_widget_destroy (confirm_dialog);
- if (retval == GTK_RESPONSE_NO)
- goto cleanup;
+ goto cleanup;
}
g_list_free (profiles);
@@ -1179,11 +1143,6 @@ new_profile_response_cb (GtkWidget *new_profile_dialog,
g_strdup (new_profile_name),
new_profile /* adopts the refcount */);
- /* And now save the new profile name to GSettings */
- gsettings_append_strv (app->settings_global,
- PROFILE_LIST_KEY,
- new_profile_name);
-
terminal_profile_edit (new_profile, transient_parent, NULL);
cleanup:
@@ -1294,7 +1253,7 @@ profile_list_response_cb (GtkWidget *dialog,
if (id == GTK_RESPONSE_HELP)
{
- terminal_util_show_help ("mate-terminal-manage-profiles", GTK_WINDOW (dialog));
+ terminal_util_show_help ("gatuno-terminal-manage-profiles", GTK_WINDOW (dialog));
return;
}
@@ -1415,6 +1374,7 @@ G_DEFINE_TYPE (TerminalApp, terminal_app, G_TYPE_OBJECT)
static void
terminal_app_init (TerminalApp *app)
{
+ gchar *concat;
global_app = app;
gtk_window_set_default_icon_name (MATE_TERMINAL_ICON_NAME);
@@ -1427,51 +1387,21 @@ terminal_app_init (TerminalApp *app)
app->encodings = terminal_encodings_get_builtins ();
- app->settings_global = g_settings_new (CONF_GLOBAL_SCHEMA);
- app->settings_font = g_settings_new (MONOSPACE_FONT_SCHEMA);
-
- g_signal_connect (app->settings_global,
- "changed::" PROFILE_LIST_KEY,
- G_CALLBACK(terminal_app_profile_list_notify_cb),
- app);
-
- g_signal_connect (app->settings_global,
- "changed::" DEFAULT_PROFILE_KEY,
- G_CALLBACK(terminal_app_default_profile_notify_cb),
- app);
-
- g_signal_connect (app->settings_global,
- "changed::" ENCODING_LIST_KEY,
- G_CALLBACK(terminal_app_encoding_list_notify_cb),
- app);
-
- g_signal_connect (app->settings_font,
- "changed::" MONOSPACE_FONT_KEY,
- G_CALLBACK(terminal_app_system_font_notify_cb),
- app);
-
-
- g_signal_connect (app->settings_global,
- "changed::" ENABLE_MNEMONICS_KEY,
- G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),
- app);
-
- g_signal_connect (app->settings_global,
- "changed::" ENABLE_MENU_BAR_ACCEL_KEY,
- G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),
- app);
-
+ app->settings_global = g_key_file_new ();
+ concat = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/config", NULL);
+ g_key_file_load_from_file (app->settings_global, concat, G_KEY_FILE_KEEP_COMMENTS, NULL);
+ g_free (concat);
+
/* Load the settings */
- terminal_app_profile_list_notify_cb (app->settings_global,
- PROFILE_LIST_KEY,
- app);
+ terminal_app_profile_list_notify_cb (app);
+
terminal_app_default_profile_notify_cb (app->settings_global,
DEFAULT_PROFILE_KEY,
app);
terminal_app_encoding_list_notify_cb (app->settings_global,
ENCODING_LIST_KEY,
app);
- terminal_app_system_font_notify_cb (app->settings_font,
+ terminal_app_system_font_notify_cb (app->settings_global,
MONOSPACE_FONT_KEY,
app);
terminal_app_enable_menu_accels_notify_cb (app->settings_global,
@@ -1508,34 +1438,18 @@ static void
terminal_app_finalize (GObject *object)
{
TerminalApp *app = TERMINAL_APP (object);
-
+ gchar *concat;
EggSMClient *sm_client;
sm_client = egg_sm_client_get ();
g_signal_handlers_disconnect_matched (sm_client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, app);
-
- g_signal_handlers_disconnect_by_func (app->settings_global,
- G_CALLBACK(terminal_app_profile_list_notify_cb),
- app);
- g_signal_handlers_disconnect_by_func (app->settings_global,
- G_CALLBACK(terminal_app_default_profile_notify_cb),
- app);
- g_signal_handlers_disconnect_by_func (app->settings_global,
- G_CALLBACK(terminal_app_encoding_list_notify_cb),
- app);
- g_signal_handlers_disconnect_by_func (app->settings_font,
- G_CALLBACK(terminal_app_system_font_notify_cb),
- app);
- g_signal_handlers_disconnect_by_func (app->settings_global,
- G_CALLBACK(terminal_app_enable_menu_accels_notify_cb),
- app);
- g_signal_handlers_disconnect_by_func (app->settings_global,
- G_CALLBACK(terminal_app_enable_mnemonics_notify_cb),
- app);
-
- g_object_unref (app->settings_global);
- g_object_unref (app->settings_font);
+
+ /* Guardar las configuraciones antes de salir */
+ concat = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/config", NULL);
+ g_key_file_save_to_file (app->settings_global, concat, NULL);
+ g_key_file_free (app->settings_global);
+ g_free (concat);
g_free (app->default_profile_id);
@@ -1595,11 +1509,11 @@ terminal_app_set_property (GObject *object,
{
case PROP_ENABLE_MENU_BAR_ACCEL:
app->enable_menu_accels = g_value_get_boolean (value);
- g_settings_set_boolean (app->settings_global, ENABLE_MENU_BAR_ACCEL_KEY, app->enable_menu_accels);
+ g_key_file_set_boolean (app->settings_global, CONF_GLOBAL_SCHEMA, ENABLE_MENU_BAR_ACCEL_KEY, app->enable_menu_accels);
break;
case PROP_ENABLE_MNEMONICS:
app->enable_mnemonics = g_value_get_boolean (value);
- g_settings_set_boolean (app->settings_global, ENABLE_MNEMONICS_KEY, app->enable_mnemonics);
+ g_key_file_set_boolean (app->settings_global, CONF_GLOBAL_SCHEMA, ENABLE_MNEMONICS_KEY, app->enable_mnemonics);
break;
case PROP_DEFAULT_PROFILE:
case PROP_SYSTEM_FONT:
diff --git a/src/terminal-app.h b/src/terminal-app.h
index 70a0665..f787e37 100644
--- a/src/terminal-app.h
+++ b/src/terminal-app.h
@@ -57,12 +57,8 @@ G_BEGIN_DECLS
/* Configuration */
-#define CONF_PREFIX "org.mate.terminal"
-#define CONF_GLOBAL_SCHEMA CONF_PREFIX ".global"
-#define CONF_PROFILES_SCHEMA CONF_PREFIX ".profiles"
-#define CONF_PROFILE_SCHEMA CONF_PREFIX ".profile"
-#define CONF_KEYS_SCHEMA CONF_PREFIX ".keybindings"
-#define CONF_PROFILE_PREFIX "/org/mate/terminal/profiles/"
+#define CONF_GLOBAL_SCHEMA "global"
+#define CONF_KEYS_SCHEMA "keybindings"
#define MATE_TERMINAL_ICON_NAME "utilities-terminal"
diff --git a/src/terminal-profile.c b/src/terminal-profile.c
index a02bc49..7d30e50 100644
--- a/src/terminal-profile.c
+++ b/src/terminal-profile.c
@@ -580,7 +580,7 @@ terminal_profile_ini_read (GKeyFile *settings,
goto out;
}
- g_value_set_boolean (&value, g_variant_get_boolean (settings_value));
+ g_value_set_boolean (&value, res);
}
else if (G_IS_PARAM_SPEC_STRING (pspec))
{
@@ -668,7 +668,7 @@ terminal_profile_ini_read (GKeyFile *settings,
GdkRGBA *colors;
int n_colors, i;
- color_strings = g_key_file_get_string_list (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), NULL);
+ color_strings = g_key_file_get_string_list (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), NULL, NULL);
if (color_strings == NULL) {
goto out;
}
@@ -772,7 +772,7 @@ terminal_profile_ini_write (TerminalProfile *profile, GKeyFile *settings, GParam
if (!color)
goto cleanup;
- cadena = g_snprintf (str, sizeof (str),
+ g_snprintf (str, sizeof (str),
"#%04X%04X%04X",
(guint) (color->red * 65535),
(guint) (color->green * 65535),
@@ -798,13 +798,13 @@ terminal_profile_ini_write (TerminalProfile *profile, GKeyFile *settings, GParam
}
else if (G_IS_PARAM_SPEC_INT (pspec))
{
- g_key_file_set_integer (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), g_value_get_integer (value));
+ g_key_file_set_integer (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), g_value_get_int (value));
}
else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec) &&
G_PARAM_SPEC_VALUE_TYPE (G_PARAM_SPEC_VALUE_ARRAY (pspec)->element_spec) == GDK_TYPE_RGBA)
{
GValueArray *array;
- GStrvBuilder *builder_str;
+ GPtrArray *builder_str;
char **color_strings;
GdkRGBA color;
int n_colors, i;
@@ -812,7 +812,7 @@ terminal_profile_ini_write (TerminalProfile *profile, GKeyFile *settings, GParam
array = (GValueArray *) g_value_get_boxed (value);
- builder_str = g_strv_builder_new ();
+ builder_str = g_ptr_array_new_with_free_func (g_free);
n_colors = array->n_values;
for (i = 0; i < n_colors; ++i)
@@ -821,7 +821,7 @@ terminal_profile_ini_write (TerminalProfile *profile, GKeyFile *settings, GParam
color = g_value_get_boxed (g_value_array_get_nth (array, i));
if (!color) {
- g_strv_builder_add (builder_str, g_strdup (""));
+ g_ptr_array_add (builder_str, g_strdup (""));
continue;
}
@@ -830,13 +830,14 @@ terminal_profile_ini_write (TerminalProfile *profile, GKeyFile *settings, GParam
(guint) (color->green * 65535),
(guint) (color->blue * 65535));
- g_strv_builder_add (builder_str, cadena);
+ g_ptr_array_add (builder_str, cadena);
}
- color_strings = g_strv_builder_end (builder_str);
+ g_ptr_array_add (builder_str, NULL);
+ color_strings = (gchar **) g_ptr_array_free (builder_str, FALSE);
g_key_file_set_string_list (settings, PROFILE_GROUP_NAME, g_param_spec_get_name (pspec), color_strings, n_colors);
g_strfreev (color_strings);
- g_strv_builder_unref (builder_str);
+ g_ptr_array_unref (builder_str);
}
else
{
@@ -874,7 +875,7 @@ terminal_profile_save (TerminalProfile *profile)
priv->dirty_pspecs = NULL;
#endif
- concat = g_strconcat ("~/.gatuno-terminal/", priv->profile_dir, NULL);
+ concat = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/profiles/", priv->profile_dir, NULL);
was_saved = g_key_file_save_to_file (priv->settings, concat, &gerror);
@@ -902,7 +903,9 @@ terminal_profile_schedule_save (TerminalProfile *profile,
g_assert (pspec != NULL);
- terminal_profile_ini_write (profile, priv->settings, pspec);
+ if (pspec->owner_type == TERMINAL_TYPE_PROFILE && (pspec->flags & G_PARAM_WRITABLE) != 0) {
+ terminal_profile_ini_write (profile, priv->settings, pspec);
+ }
if (priv->save_idle_id != 0)
return;
@@ -975,7 +978,7 @@ terminal_profile_constructor (GType type,
g_assert (name != NULL);
priv->settings = g_key_file_new ();
- concat = g_strconcat ("~/.gatuno-terminal/", priv->profile_dir, NULL);
+ concat = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/profiles/", priv->profile_dir, NULL);
g_key_file_load_from_file (priv->settings, concat, G_KEY_FILE_KEEP_COMMENTS, NULL);
g_free (concat);
@@ -1129,7 +1132,7 @@ terminal_profile_set_property (GObject *object,
gchar *concat;
g_key_file_free (priv->settings);
- concat = g_strconcat ("~/.gatuno-terminal/", priv->profile_dir, NULL);
+ concat = g_strconcat (g_get_home_dir (), "/.gatuno-terminal/profiles/", priv->profile_dir, NULL);
priv->settings = g_key_file_new ();
g_key_file_load_from_file (priv->settings, concat, G_KEY_FILE_KEEP_COMMENTS, NULL);
g_free (concat);
@@ -1418,8 +1421,6 @@ _terminal_profile_clone (TerminalProfile *base_profile,
/* Flush the new profile to GSettings */
new_priv = new_profile->priv;
- g_slist_free (new_priv->dirty_pspecs);
- new_priv->dirty_pspecs = NULL;
if (new_priv->save_idle_id != 0)
{
g_source_remove (new_priv->save_idle_id);
@@ -1433,8 +1434,8 @@ _terminal_profile_clone (TerminalProfile *base_profile,
if (pspec->owner_type != TERMINAL_TYPE_PROFILE ||
(pspec->flags & G_PARAM_WRITABLE) == 0)
continue;
-
- new_priv->dirty_pspecs = g_slist_prepend (new_priv->dirty_pspecs, pspec);
+
+ terminal_profile_ini_write (new_profile, new_priv->settings, pspec);
}
g_free (pspecs);