[gnome-terminal] client: Remove obsolete code
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] client: Remove obsolete code
- Date: Thu, 3 May 2012 19:06:01 +0000 (UTC)
commit 536cd5dad7afffe6bb72e2a6b0571ef8cea6a3ce
Author: Christian Persch <chpe gnome org>
Date: Sat Apr 14 21:35:01 2012 +0200
client: Remove obsolete code
The --save-config option is not supported anymore; make it just warn and
restructure the remaining code.
src/Makefile.am | 1 -
src/terminal-options.c | 59 ++++++++++++++++++++++-------------------------
src/terminal-options.h | 11 +++++----
src/terminal-util.c | 32 --------------------------
src/terminal-util.h | 3 --
src/terminal.c | 53 -------------------------------------------
6 files changed, 34 insertions(+), 125 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 50d45c5..23e4e9b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -68,7 +68,6 @@ nodist_gnome_terminal_server_SOURCES = $(BUILT_SOURCES)
gnome_terminal_server_CPPFLAGS = \
-DTERMINAL_COMPILATION \
- -DTERMINAL_SERVER \
-DEXECUTABLE_NAME=\"gnome-terminal\" \
-DTERM_DATADIR="\"$(datadir)\"" \
-DTERM_LOCALEDIR="\"$(datadir)/locale\"" \
diff --git a/src/terminal-options.c b/src/terminal-options.c
index 2654d28..b7b7795 100644
--- a/src/terminal-options.c
+++ b/src/terminal-options.c
@@ -208,7 +208,6 @@ 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,
@@ -216,12 +215,10 @@ unsupported_option_callback (const gchar *option_name,
gpointer data,
GError **error)
{
- g_printerr (_("Option \"%s\" is no longer supported in this version of gnome-terminal;"
- " you might want to create a profile with the desired setting, and use"
- " the new '--profile' option\n"), option_name);
+ g_printerr (_("Option \"%s\" is no longer supported in this version of gnome-terminal."),
+ 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,
@@ -551,27 +548,29 @@ option_disable_factory_callback (const gchar *option_name,
}
static gboolean
-option_load_save_config_cb (const gchar *option_name,
- const gchar *value,
- gpointer data,
- GError **error)
+option_load_config_cb (const gchar *option_name,
+ const gchar *value,
+ gpointer data,
+ GError **error)
{
-#ifdef TERMINAL_SERVER
TerminalOptions *options = data;
-
- if (options->config_file)
- {
- g_set_error_literal (error, TERMINAL_OPTION_ERROR, TERMINAL_OPTION_ERROR_EXCLUSIVE_OPTIONS,
- "Options \"--load-config\" and \"--save-config\" are mutually exclusive");
- return FALSE;
- }
-
- options->config_file = terminal_util_resolve_relative_path (options->default_working_dir, value);
- options->load_config = strcmp (option_name, "--load-config") == 0;
- options->save_config = strcmp (option_name, "--save-config") == 0;
-#endif
-
- return TRUE;
+ GFile *file;
+ char *config_file;
+ GKeyFile *key_file;
+ gboolean result;
+
+ file = g_file_new_for_commandline_arg (value);
+ config_file = g_file_get_path (file);
+ g_object_unref (file);
+
+ key_file = g_key_file_new ();
+ result = g_key_file_load_from_file (key_file, config_file, 0, error) &&
+ terminal_options_merge_config (options, key_file,
+ strcmp (option_name, "load-config") == 0 ? SOURCE_DEFAULT : SOURCE_SESSION,
+ error);
+ g_key_file_free (key_file);
+
+ return result;
}
static gboolean
@@ -975,7 +974,6 @@ terminal_options_free (TerminalOptions *options)
g_free (options->startup_id);
g_free (options->server_bus_name);
- g_free (options->sm_client_state_file);
g_free (options->sm_client_id);
g_free (options->sm_config_prefix);
@@ -1009,18 +1007,17 @@ get_goption_context (TerminalOptions *options)
0,
G_OPTION_FLAG_FILENAME,
G_OPTION_ARG_CALLBACK,
- option_load_save_config_cb,
+ option_load_config_cb,
N_("Load a terminal configuration file"),
N_("FILE")
},
{
"save-config",
0,
- G_OPTION_FLAG_FILENAME,
+ G_OPTION_FLAG_FILENAME | G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_CALLBACK,
- option_load_save_config_cb,
- N_("Save the terminal configuration to a file"),
- N_("FILE")
+ unsupported_option_callback,
+ NULL, NULL
},
{ "version", 0, G_OPTION_FLAG_NO_ARG | G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_CALLBACK, option_version_cb, NULL, NULL },
{ NULL, 0, 0, 0, NULL, NULL, NULL }
@@ -1408,7 +1405,7 @@ get_goption_context (TerminalOptions *options)
const GOptionEntry smclient_goptions[] = {
{ "sm-client-disable", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &options->sm_client_disable, NULL, NULL },
- { "sm-client-state-file", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_FILENAME, &options->sm_client_state_file, NULL, NULL },
+ { "sm-client-state-file", 0, G_OPTION_FLAG_HIDDEN | G_OPTION_FLAG_FILENAME, G_OPTION_ARG_CALLBACK, option_load_config_cb, NULL, NULL },
{ "sm-client-id", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &options->sm_client_id, NULL, NULL },
{ "sm-disable", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &options->sm_client_disable, NULL, NULL },
{ "sm-config-prefix", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &options->sm_config_prefix, NULL, NULL },
diff --git a/src/terminal-options.h b/src/terminal-options.h
index 2254a61..0f00a21 100644
--- a/src/terminal-options.h
+++ b/src/terminal-options.h
@@ -50,6 +50,12 @@ G_BEGIN_DECLS
#define TERMINAL_CONFIG_TERMINAL_PROP_WORKING_DIRECTORY "WorkingDirectory"
#define TERMINAL_CONFIG_TERMINAL_PROP_ZOOM "Zoom"
+enum
+{
+ SOURCE_DEFAULT = 0,
+ SOURCE_SESSION = 1
+};
+
typedef struct
{
char *server_bus_name;
@@ -74,12 +80,7 @@ typedef struct
gboolean use_factory;
double zoom;
- char *config_file;
- gboolean load_config;
- gboolean save_config;
-
gboolean sm_client_disable;
- char *sm_client_state_file;
char *sm_client_id;
char *sm_config_prefix;
diff --git a/src/terminal-util.c b/src/terminal-util.c
index 567fa51..95cd26d 100644
--- a/src/terminal-util.c
+++ b/src/terminal-util.c
@@ -266,38 +266,6 @@ terminal_util_open_url (GtkWidget *parent,
}
/**
- * terminal_util_resolve_relative_path:
- * @path:
- * @relative_path:
- *
- * Returns: a newly allocate string
- */
-char *
-terminal_util_resolve_relative_path (const char *path,
- const char *relative_path)
-{
- GFile *file, *resolved_file;
- char *resolved_path = NULL;
-
- g_return_val_if_fail (relative_path != NULL, NULL);
-
- if (path == NULL)
- return g_strdup (relative_path);
-
- file = g_file_new_for_path (path);
- resolved_file = g_file_resolve_relative_path (file, relative_path);
- g_object_unref (file);
-
- if (resolved_file == NULL)
- return NULL;
-
- resolved_path = g_file_get_path (resolved_file);
- g_object_unref (resolved_file);
-
- return resolved_path;
-}
-
-/**
* terminal_util_transform_uris_to_quoted_fuse_paths:
* @uris:
*
diff --git a/src/terminal-util.h b/src/terminal-util.h
index 3715553..e9c3c36 100644
--- a/src/terminal-util.h
+++ b/src/terminal-util.h
@@ -48,9 +48,6 @@ void terminal_util_open_url (GtkWidget *parent,
TerminalURLFlavour flavor,
guint32 user_time);
-char *terminal_util_resolve_relative_path (const char *path,
- const char *relative_path);
-
void terminal_util_transform_uris_to_quoted_fuse_paths (char **uris);
char *terminal_util_concat_uris (char **uris,
diff --git a/src/terminal.c b/src/terminal.c
index 41e6003..d8378ed 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -40,12 +40,6 @@
#include "terminal-defines.h"
#include "terminal-client-utils.h"
-enum
-{
- SOURCE_DEFAULT = 0,
- SOURCE_SESSION = 1
-};
-
/**
* handle_options:
* @app:
@@ -73,53 +67,6 @@ handle_options (TerminalFactory *factory,
options->screen_number);
#endif
- if (options->save_config)
- {
-#if 0
- if (options->remote_arguments)
- return terminal_app_save_config_file (app, options->config_file, error);
-
- g_set_error_literal (error, TERMINAL_OPTION_ERROR, TERMINAL_OPTION_ERROR_NOT_IN_FACTORY,
- "Cannot use \"--save-config\" when starting the factory process");
- return FALSE;
-#endif
- g_set_error (error, TERMINAL_OPTION_ERROR, TERMINAL_OPTION_ERROR_NOT_SUPPORTED,
- "Not supported anymore");
- return FALSE;
- }
-
- if (options->load_config)
- {
- GKeyFile *key_file;
- gboolean result;
-
- key_file = g_key_file_new ();
- result = g_key_file_load_from_file (key_file, options->config_file, 0, error) &&
- terminal_options_merge_config (options, key_file, SOURCE_DEFAULT, error);
- g_key_file_free (key_file);
-
- if (!result)
- return FALSE;
-
- /* fall-through on success */
- }
-
- if (options->sm_client_state_file && !options->sm_client_disable)
- {
- GKeyFile *key_file;
- gboolean result;
-
- key_file = g_key_file_new ();
- result = g_key_file_load_from_file (key_file, options->sm_client_state_file, 0, error) &&
- terminal_options_merge_config (options, key_file, SOURCE_SESSION, error);
- g_key_file_free (key_file);
-
- if (!result)
- return FALSE;
-
- /* fall-through on success */
- }
-
/* Make sure we open at least one window */
terminal_options_ensure_window (options);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]