[gnome-terminal] app: Remove unused code



commit 7391805f5cc259a0e04e07710b2a6db9452bd8e9
Author: Christian Persch <chpe gnome org>
Date:   Mon Apr 16 18:32:14 2012 +0200

    app: Remove unused code
    
    The old --save-config option is gone, so remove the code that saved the
    state to a key file.

 src/terminal-app.c    |   58 -------------------------------------------
 src/terminal-app.h    |    7 -----
 src/terminal-window.c |   65 -------------------------------------------------
 src/terminal-window.h |    4 ---
 4 files changed, 0 insertions(+), 134 deletions(-)
---
diff --git a/src/terminal-app.c b/src/terminal-app.c
index 927b39c..b06c47c 100644
--- a/src/terminal-app.c
+++ b/src/terminal-app.c
@@ -1579,64 +1579,6 @@ terminal_app_get_active_encodings (TerminalApp *app)
   return g_slist_sort (list, (GCompareFunc) compare_encodings);
 }
 
-#include "terminal-options.h"
-
-void
-terminal_app_save_config (TerminalApp *app,
-                          GKeyFile *key_file)
-{
-  GList *lw;
-  guint n = 0;
-  GPtrArray *window_names_array;
-  char **window_names;
-  gsize len;
-
-  g_key_file_set_comment (key_file, NULL, NULL, "Written by " PACKAGE_STRING, NULL);
-
-  g_key_file_set_integer (key_file, TERMINAL_CONFIG_GROUP, TERMINAL_CONFIG_PROP_VERSION, TERMINAL_CONFIG_VERSION);
-  g_key_file_set_integer (key_file, TERMINAL_CONFIG_GROUP, TERMINAL_CONFIG_PROP_COMPAT_VERSION, TERMINAL_CONFIG_COMPAT_VERSION);
-
-  window_names_array = g_ptr_array_sized_new (g_list_length (app->windows) + 1);
-
-  for (lw = app->windows; lw != NULL; lw = lw->next)
-    {
-      TerminalWindow *window = TERMINAL_WINDOW (lw->data);
-      char *group;
-
-      group = g_strdup_printf ("Window%u", n++);
-      g_ptr_array_add (window_names_array, group);
-
-      terminal_window_save_state (window, key_file, group);
-    }
-
-  len = window_names_array->len;
-  g_ptr_array_add (window_names_array, NULL);
-  window_names = (char **) g_ptr_array_free (window_names_array, FALSE);
-  g_key_file_set_string_list (key_file, TERMINAL_CONFIG_GROUP, TERMINAL_CONFIG_PROP_WINDOWS, (const char * const *) window_names, len);
-  g_strfreev (window_names);
-}
-
-gboolean
-terminal_app_save_config_file (TerminalApp *app,
-                               const char *file_name,
-                               GError **error)
-{
-  GKeyFile *key_file;
-  char *data;
-  gsize len;
-  gboolean result;
-
-  key_file = g_key_file_new ();
-  terminal_app_save_config (app, key_file);
-
-  data = g_key_file_to_data (key_file, &len, NULL);
-  result = g_file_set_contents (file_name, data, len, error);
-  g_free (data);
-
-  return result;
-}
-
-
 /**
  * terminal_app_get_global_settings:
  * @app: a #TerminalApp
diff --git a/src/terminal-app.h b/src/terminal-app.h
index 7c63242..17dbae9 100644
--- a/src/terminal-app.h
+++ b/src/terminal-app.h
@@ -105,13 +105,6 @@ GHashTable *terminal_app_get_encodings (TerminalApp *app);
 
 GSList* terminal_app_get_active_encodings (TerminalApp *app);
 
-void terminal_app_save_config (TerminalApp *app,
-                               GKeyFile *key_file);
-
-gboolean terminal_app_save_config_file (TerminalApp *app,
-                                        const char *file_name,
-                                        GError **error);
-
 /* GSettings */
 
 GSettings *terminal_app_get_global_settings (TerminalApp *app);
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 32ea1fb..d33dd9e 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -3526,68 +3526,3 @@ terminal_window_get_ui_manager (TerminalWindow *window)
 
   return priv->ui_manager;
 }
-
-#include "terminal-options.h"
-void
-terminal_window_save_state (TerminalWindow *window,
-                            GKeyFile *key_file,
-                            const char *group)
-{
-  TerminalWindowPrivate *priv = window->priv;
-  GList *tabs, *lt;
-  TerminalScreen *active_screen;
-  GdkWindowState state;
-  GPtrArray *tab_names_array;
-  char **tab_names;
-  gsize len;
-
-  g_key_file_set_string (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_ROLE,
-                         gtk_window_get_role (GTK_WINDOW (window)));
-
-  state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window)));
-  if (state & GDK_WINDOW_STATE_MAXIMIZED)
-    g_key_file_set_boolean (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_MAXIMIZED, TRUE);
-  if (state & GDK_WINDOW_STATE_FULLSCREEN)
-    g_key_file_set_boolean (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_FULLSCREEN, TRUE);
-
-  active_screen = terminal_window_get_active (window);
-  tabs = terminal_window_list_screen_containers (window);
-
-  tab_names_array = g_ptr_array_sized_new (g_list_length (tabs) + 1);
-
-  for (lt = tabs; lt != NULL; lt = lt->next)
-    {
-      TerminalScreen *screen;
-      char *tab_group;
-
-      screen = terminal_screen_container_get_screen (TERMINAL_SCREEN_CONTAINER (lt->data));
-
-      tab_group = g_strdup_printf ("Terminal%p", screen);
-      g_ptr_array_add (tab_names_array, tab_group);
-
-      terminal_screen_save_config (screen, key_file, tab_group);
-
-      if (screen == active_screen)
-        {
-          int w, h, x, y;
-          char *geometry;
-
-          g_key_file_set_string (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_ACTIVE_TAB, tab_group);
-
-          /* FIXME saving the geometry is not great :-/ */
-          terminal_screen_get_size (screen, &w, &h);
-          gtk_window_get_position (GTK_WINDOW (window), &x, &y);
-          geometry = g_strdup_printf ("%dx%d+%d+%d", w, h, x, y);
-          g_key_file_set_string (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_GEOMETRY, geometry);
-          g_free (geometry);
-        }
-    }
-
-  g_list_free (tabs);
-
-  len = tab_names_array->len;
-  g_ptr_array_add (tab_names_array, NULL);
-  tab_names = (char **) g_ptr_array_free (tab_names_array, FALSE);
-  g_key_file_set_string_list (key_file, group, TERMINAL_CONFIG_WINDOW_PROP_TABS, (const char * const *) tab_names, len);
-  g_strfreev (tab_names);
-}
diff --git a/src/terminal-window.h b/src/terminal-window.h
index 59ab77b..f64b863 100644
--- a/src/terminal-window.h
+++ b/src/terminal-window.h
@@ -87,10 +87,6 @@ void terminal_window_set_size_force_grid (TerminalWindow *window,
 
 GtkWidget* terminal_window_get_mdi_container (TerminalWindow *window);
 
-void terminal_window_save_state (TerminalWindow *window,
-                                 GKeyFile *key_file,
-                                 const char *group);
-
 G_END_DECLS
 
 #endif /* TERMINAL_WINDOW_H */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]