diff options
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/terminal-app.c | 10 | ||||
-rw-r--r-- | src/terminal-gsettings.c | 110 | ||||
-rw-r--r-- | src/terminal-gsettings.h | 49 | ||||
-rw-r--r-- | src/terminal-util.c | 5 |
5 files changed, 8 insertions, 168 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 9f135d7..7f7477f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,8 +27,6 @@ mate_terminal_SOURCES= \ terminal-debug.h \ terminal-encoding.c \ terminal-encoding.h \ - terminal-gsettings.c \ - terminal-gsettings.h \ terminal-info-bar.c \ terminal-info-bar.h \ terminal-intl.h \ diff --git a/src/terminal-app.c b/src/terminal-app.c index bdbd50e..24c00f8 100644 --- a/src/terminal-app.c +++ b/src/terminal-app.c @@ -36,8 +36,8 @@ #include "terminal-util.h" #include "profile-editor.h" #include "terminal-encoding.h" -#include "terminal-gsettings.h" #include <libmate-desktop/mate-dconf.h> +#include <libmate-desktop/mate-gsettings.h> #include <string.h> #include <stdlib.h> #include <time.h> @@ -328,7 +328,7 @@ terminal_app_delete_profile (TerminalApp *app, profile_name = terminal_profile_get_property_string (profile, TERMINAL_PROFILE_NAME); profile_dir = g_strconcat (CONF_PROFILE_PREFIX, profile_name, "/", NULL); - terminal_gsettings_remove_all_from_strv (app->settings_global, PROFILE_LIST_KEY, profile_name); + mate_gsettings_remove_all_from_strv (app->settings_global, PROFILE_LIST_KEY, profile_name); /* And remove the profile directory */ if (!mate_dconf_recursive_reset (profile_dir, &error)) @@ -756,7 +756,7 @@ terminal_app_profile_list_notify_cb (GSettings *settings, !g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))) goto ensure_one_profile; - value_list = terminal_gsettings_strv_to_gslist( g_variant_get_strv (val, NULL)); + value_list = mate_gsettings_strv_to_gslist( g_variant_get_strv (val, NULL)); /* Add any new ones */ for (sl = value_list; sl != NULL; sl = sl->next) @@ -928,7 +928,7 @@ terminal_app_encoding_list_notify_cb (GSettings *settings, val = g_settings_get_value (settings, key); if (val != NULL && g_variant_is_of_type (val, G_VARIANT_TYPE_STRING_ARRAY)) - strings = terminal_gsettings_strv_to_gslist (g_variant_get_strv (val, NULL)); + strings = mate_gsettings_strv_to_gslist (g_variant_get_strv (val, NULL)); else strings = NULL; @@ -1088,7 +1088,7 @@ new_profile_response_cb (GtkWidget *new_profile_dialog, new_profile /* adopts the refcount */); /* And now save the new profile name to GSettings */ - terminal_gsettings_append_strv (app->settings_global, + mate_gsettings_append_strv (app->settings_global, PROFILE_LIST_KEY, new_profile_name); diff --git a/src/terminal-gsettings.c b/src/terminal-gsettings.c deleted file mode 100644 index fdd0163..0000000 --- a/src/terminal-gsettings.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * terminal-gsettings.c: terminal gsettings utility methods - * - * Copyright (C) 2001 - 2003 Sun Microsystems, Inc. - * 2012 Stefano Karapetsas - * - * 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 2 of the - * License, or (at your option) any later version. - * - * This program 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * Authors: - * Mark McLoughlin <[email protected]> - * Glynn Foster <[email protected]> - * Stefano Karapetsas <[email protected]> - */ - -#include <config.h> - -#include "terminal-gsettings.h" - -#include <string.h> -#include <glib.h> -#include <gio/gio.h> - -/* copied from gnome-panel */ -gboolean -terminal_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; -} - -/* copied from gnome-panel */ -gboolean -terminal_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; -} - - - -/* convert a gchar ** to GList (taken from libmatekbd code) */ -GSList* -terminal_gsettings_strv_to_gslist (const gchar *const *array) -{ - GSList *list = NULL; - gint i; - if (array != NULL) { - for (i = 0; array[i]; i++) { - list = g_slist_append (list, g_strdup (array[i])); - } - } - return list; -} - diff --git a/src/terminal-gsettings.h b/src/terminal-gsettings.h deleted file mode 100644 index 1611c86..0000000 --- a/src/terminal-gsettings.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * terminal-gsettings.h: terminal gsettings utility methods - * - * Copyright (C) 2001 - 2003 Sun Microsystems, Inc. - * 2012 Stefano Karapetsas - * - * 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 2 of the - * License, or (at your option) any later version. - * - * This program 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * Authors: - * Mark McLoughlin <[email protected]> - * Glynn Foster <[email protected]> - * Stefano Karapetsas <[email protected]> - */ - -#ifndef __TERMINAL_GSETTINGS_H__ -#define __TERMINAL_GSETTINGS_H__ - -#include <glib.h> -#include <gio/gio.h> - -G_BEGIN_DECLS - -gboolean terminal_gsettings_append_strv (GSettings *settings, - const gchar *key, - const gchar *value); - -gboolean terminal_gsettings_remove_all_from_strv (GSettings *settings, - const gchar *key, - const gchar *value); - -GSList* terminal_gsettings_strv_to_gslist (const gchar *const *array); - -G_END_DECLS - -#endif /* __TEMRINAL_GSETTINGS_H__ */ - diff --git a/src/terminal-util.c b/src/terminal-util.c index c847595..5cfa350 100644 --- a/src/terminal-util.c +++ b/src/terminal-util.c @@ -37,9 +37,10 @@ #include <X11/Xatom.h> #endif +#include <libmate-desktop/mate-gsettings.h> + #include "terminal-accels.h" #include "terminal-app.h" -#include "terminal-gsettings.h" #include "terminal-intl.h" #include "terminal-util.h" #include "terminal-window.h" @@ -611,7 +612,7 @@ setup_ignore_host_env (GHashTable *env_table, GSList *ignore; gchar **ignore_strv = g_settings_get_strv (settings, "ignore-hosts"); - ignore = terminal_gsettings_strv_to_gslist ((const gchar *const *)ignore_strv); + ignore = mate_gsettings_strv_to_gslist ((const gchar *const *)ignore_strv); if (ignore) { GString *buf = g_string_sized_new (64); |