[metacity/matching] Put stuff back in its proper file



commit d4d254a0b58a8c939e2288ddcb121be800958dab
Author: Thomas Thurman <tthurman gnome org>
Date:   Fri Jul 10 09:06:43 2009 -0400

    Put stuff back in its proper file

 src/core/matching.c |   98 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/core/window.c   |   99 ---------------------------------------------------
 2 files changed, 98 insertions(+), 99 deletions(-)
---
diff --git a/src/core/matching.c b/src/core/matching.c
index ee8bf0c..3c51a62 100644
--- a/src/core/matching.c
+++ b/src/core/matching.c
@@ -25,6 +25,104 @@
 #include "constraints.h"
 #include "window-private.h"
 
+/*
+ * Window matching
+ */
+
+/**
+ * We currently keep this information in a GKeyFile.
+ * It is global.
+ * This is just for an example and may change.
+ */
+GKeyFile *matching_keyfile = NULL;
+
+static void
+load_matching_data (void)
+{
+  if (matching_keyfile)
+    return;
+
+  /* load it, or... (stub) */
+  matching_keyfile = g_key_file_new ();
+  /* FIXME: would be helpful to add a leading comment */
+}
+
+static gchar*
+get_window_role (MetaWindow *window)
+{
+  if (window->role)
+    return window->role;
+  else if (window->title) /* hacky fallback */
+    return window->title;
+  else /* give up */
+    return NULL;
+}
+
+void
+meta_matching_load_from_role (MetaWindow *window)
+{
+  gint x, y, w, h;
+  gchar *role = get_window_role (window);
+
+  if (!role)
+      return;
+
+  load_matching_data ();
+
+  if (!g_key_file_has_group (matching_keyfile,
+                             role))
+    return;
+
+  /* FIXME error checking */
+  x = g_key_file_get_integer (matching_keyfile, role, "x", NULL);
+  y = g_key_file_get_integer (matching_keyfile, role, "y", NULL);
+  w = g_key_file_get_integer (matching_keyfile, role, "w", NULL);
+  h = g_key_file_get_integer (matching_keyfile, role, "h", NULL);
+
+  g_warning ("So we got %d %d %d %d\n", x, y, w, h);
+
+  meta_window_move_resize (window,
+                           FALSE,
+                           x, y, w, h);
+}
+
+void
+meta_matching_save_to_role (MetaWindow *window)
+{
+  gint x, y, w, h;
+  gchar *role = get_window_role (window);
+
+  if (!role)
+      return;
+
+  load_matching_data ();
+
+  meta_window_get_geometry (window, &x, &y, &w, &h);
+
+  g_key_file_set_integer (matching_keyfile, role, "x", x);
+  g_key_file_set_integer (matching_keyfile, role, "y", y);
+  g_key_file_set_integer (matching_keyfile, role, "w", w);
+  g_key_file_set_integer (matching_keyfile, role, "h", h);
+
+  meta_matching_save_all ();
+}
+
+void
+meta_matching_save_all (void)
+{
+  char *data = NULL;
+
+  load_matching_data ();
+
+  data = g_key_file_to_data (matching_keyfile, NULL, NULL);
+
+  g_file_set_contents ("/tmp/metacity-matching.conf",
+                       data,
+                       -1,
+                       NULL);
+
+  g_free (data);
+}
 
 /* eof matching.c */
 
diff --git a/src/core/window.c b/src/core/window.c
index ccfaa9e..2ab4c29 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -8151,103 +8151,4 @@ meta_window_get_xwindow (MetaWindow *window)
   return window->xwindow;
 }
 
-/*
- * Window matching
- */
-
-/**
- * We currently keep this information in a GKeyFile.
- * It is global.
- * This is just for an example and may change.
- */
-GKeyFile *matching_keyfile = NULL;
-
-static void
-load_matching_data (void)
-{
-  if (matching_keyfile)
-    return;
-
-  /* load it, or... (stub) */
-  matching_keyfile = g_key_file_new ();
-  /* FIXME: would be helpful to add a leading comment */
-}
-
-static gchar*
-get_window_role (MetaWindow *window)
-{
-  if (window->role)
-    return window->role;
-  else if (window->title) /* hacky fallback */
-    return window->title;
-  else /* give up */
-    return NULL;
-}
-
-void
-meta_matching_load_from_role (MetaWindow *window)
-{
-  gint x, y, w, h;
-  gchar *role = get_window_role (window);
-
-  if (!role)
-      return;
-
-  load_matching_data ();
-
-  if (!g_key_file_has_group (matching_keyfile,
-                             role))
-    return;
-
-  /* FIXME error checking */
-  x = g_key_file_get_integer (matching_keyfile, role, "x", NULL);
-  y = g_key_file_get_integer (matching_keyfile, role, "y", NULL);
-  w = g_key_file_get_integer (matching_keyfile, role, "w", NULL);
-  h = g_key_file_get_integer (matching_keyfile, role, "h", NULL);
-
-  g_warning ("So we got %d %d %d %d\n", x, y, w, h);
-
-  meta_window_move_resize (window,
-                           FALSE,
-                           x, y, w, h);
-}
-
-void
-meta_matching_save_to_role (MetaWindow *window)
-{
-  gint x, y, w, h;
-  gchar *role = get_window_role (window);
-
-  if (!role)
-      return;
-
-  load_matching_data ();
-
-  meta_window_get_geometry (window, &x, &y, &w, &h);
-
-  g_key_file_set_integer (matching_keyfile, role, "x", x);
-  g_key_file_set_integer (matching_keyfile, role, "y", y);
-  g_key_file_set_integer (matching_keyfile, role, "w", w);
-  g_key_file_set_integer (matching_keyfile, role, "h", h);
-
-  meta_matching_save_all ();
-}
-
-void
-meta_matching_save_all (void)
-{
-  char *data = NULL;
-
-  load_matching_data ();
-
-  data = g_key_file_to_data (matching_keyfile, NULL, NULL);
-
-  g_file_set_contents ("/tmp/metacity-matching.conf",
-                       data,
-                       -1,
-                       NULL);
-
-  g_free (data);
-}
-
 /* eof window.c */



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