X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=plugins%2Fplacement%2Fhistory.c;h=7203fe119378236bb4fd00cfc17291a845dfe438;hb=21b07748aff9a1719f3970659630aa867b23bb40;hp=9d932b9edfbe7e0ca292738f298f91ae0d6782ce;hpb=d2857b11944146e2e6973b7f7280cb57e1ee260b;p=chaz%2Fopenbox diff --git a/plugins/placement/history.c b/plugins/placement/history.c index 9d932b9e..7203fe11 100644 --- a/plugins/placement/history.c +++ b/plugins/placement/history.c @@ -1,9 +1,10 @@ +#include "kernel/debug.h" #include "kernel/openbox.h" #include "kernel/dispatch.h" #include "kernel/frame.h" #include "kernel/client.h" #include "kernel/screen.h" -#include "kernel/parse.h" +#include "parser/parse.h" #include "history.h" #include #include @@ -41,15 +42,15 @@ static struct HistoryItem *history_find(const char *name, const char *class, /* find the client */ for (it = history_list; it != NULL; it = it->next) { hi = it->data; - if (!g_utf8_collate(hi->name, name) && - !g_utf8_collate(hi->class, class) && - !g_utf8_collate(hi->role, role)) + if (!strcmp(hi->name, name) && + !strcmp(hi->class, class) && + !strcmp(hi->role, role)) return hi; } return NULL; } -gboolean place_history(Client *c) +gboolean place_history(ObClient *c) { struct HistoryItem *hi; int x, y, w, h; @@ -58,7 +59,7 @@ gboolean place_history(Client *c) if (hi && !(hi->flags & PLACED)) { hi->flags |= PLACED; - if (ob_state != State_Starting) { + if (ob_state() != OB_STATE_STARTING) { if (hi->flags & HAVE_POSITION || hi->flags & HAVE_SIZE) { if (hi->flags & HAVE_POSITION) { @@ -77,7 +78,7 @@ gboolean place_history(Client *c) w = c->area.width; h = c->area.height; } - client_configure(c, Corner_TopLeft, x, y, w, h, + client_configure(c, OB_CORNER_TOPLEFT, x, y, w, h, TRUE, TRUE); } if (hi->flags & HAVE_DESKTOP) { @@ -90,7 +91,7 @@ gboolean place_history(Client *c) return FALSE; } -static void set_history(Client *c) +static void set_history(ObClient *c) { struct HistoryItem *hi; @@ -145,7 +146,7 @@ static void save_history() for (it = history_list; it; it = g_slist_next(it)) { struct HistoryItem *hi = it->data; - g_message("adding %s", hi->name); + ob_debug("adding %s\n", hi->name); node = xmlNewChild(root, NULL, (const xmlChar*) "entry", NULL); xmlNewProp(node, (const xmlChar*) "name", (const xmlChar*) hi->name); xmlNewProp(node, (const xmlChar*) "class", (const xmlChar*) hi->class); @@ -181,7 +182,7 @@ static void save_history() xmlIndentTreeOutput = 1; xmlSaveFormatFile(history_path, doc, 1); - xmlFree(doc); + xmlFreeDoc(doc); } static void load_history() @@ -193,18 +194,8 @@ static void load_history() char *role; struct HistoryItem *hi; - if (!(doc = xmlParseFile(history_path))) + if (!parse_load(history_path, "openbox_history", &doc, &node)) return; - if (!(node = xmlDocGetRootElement(doc))) { - xmlFreeDoc(doc); - doc = NULL; - return; - } - if (xmlStrcasecmp(node->name, (const xmlChar*)"openbox_history")) { - xmlFreeDoc(doc); - doc = NULL; - return; - } node = parse_find_node("entry", node->xmlChildrenNode); while (node) { @@ -246,7 +237,7 @@ static void load_history() g_free(name); g_free(class); g_free(role); node = parse_find_node("entry", node->next); } - xmlFree(doc); + xmlFreeDoc(doc); } void history_startup() @@ -259,7 +250,7 @@ void history_startup() history_path = g_strdup_printf("%s.%d", path, ob_screen); g_free(path); - load_history(); /* load from the historydb file */ + /*load_history(); /\* load from the historydb file */ dispatch_register(Event_Client_Destroy, (EventHandler)event, NULL); } @@ -268,7 +259,7 @@ void history_shutdown() { GSList *it; - save_history(); /* save to the historydb file */ + /*save_history(); /\* save to the historydb file */ for (it = history_list; it != NULL; it = it->next) { struct HistoryItem *hi = it->data; g_free(hi->name);