diff options
author | Thomas Thurman <tthurman@gnome.org> | 2009-07-10 08:24:59 -0400 |
---|---|---|
committer | Thomas Thurman <tthurman@gnome.org> | 2009-07-10 08:24:59 -0400 |
commit | b9c9711a379d74f83644d4b3a8b3d452a1d2eab9 (patch) | |
tree | 9e42db4846ca54ee4f4e89fe13095a95335154a0 /src/core/matching.c | |
parent | b6cc1d38b537012cb746b8bb5f9dfc4ae8c0524a (diff) | |
download | metacity-b9c9711a379d74f83644d4b3a8b3d452a1d2eab9.tar.gz |
move stuff into window.c (will clean up later)
Diffstat (limited to 'src/core/matching.c')
-rw-r--r-- | src/core/matching.c | 86 |
1 files changed, 1 insertions, 85 deletions
diff --git a/src/core/matching.c b/src/core/matching.c index 1888b121..ee8bf0cd 100644 --- a/src/core/matching.c +++ b/src/core/matching.c @@ -22,93 +22,9 @@ */ #include "matching.h" +#include "constraints.h" #include "window-private.h" -/** - * We currently keep this information in a GKeyFile. - * 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 (); - - /* 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); - - -} - -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 */ |