From 0c725d75ecdd0f47a80f9e8c5d22c35e13a5a606 Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Wed, 16 May 2012 14:07:18 +0000 Subject: [PATCH] Fixed menu loading Signed-off-by: Gergely POLONKAI (W00d5t0ck) --- wmud/db.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wmud/db.c b/wmud/db.c index 35294d5..3bd7618 100644 --- a/wmud/db.c +++ b/wmud/db.c @@ -566,7 +566,7 @@ wmud_db_load_menu(GSList **menu_items, GError **err) return FALSE; } - if ((sqlite_code = sqlite3_prepare_v2(dbh, "SELECT id, menuchar, need_active_char, placement, display_text, fnctn FROM menu", -1, &sth, NULL)) != SQLITE_OK) + if ((sqlite_code = sqlite3_prepare_v2(dbh, "SELECT id, menuchar, need_active_char, placement, display_text, fnctn FROM menu ORDER BY placement", -1, &sth, NULL)) != SQLITE_OK) { g_set_error(err, WMUD_DB_ERROR, WMUD_DB_ERROR_BADQUERY, "Bad query in wmud_db_load_menu(): %s", sqlite3_errmsg(dbh)); @@ -582,11 +582,11 @@ wmud_db_load_menu(GSList **menu_items, GError **err) menu_item->id = sqlite3_column_int(sth, 0); menu_item->menuchar = *(sqlite3_column_text(sth, 1)); menu_item->need_active_char = (sqlite3_column_int(sth, 2) != 0); - menu_item->placement = sqlite3_column_int(sth, 4); - menu_item->text = g_strdup((gchar *)sqlite3_column_text(sth, 5)); - menu_item->func = g_strdup((gchar *)sqlite3_column_text(sth, 6)); + menu_item->placement = sqlite3_column_int(sth, 3); + menu_item->text = g_strdup((gchar *)sqlite3_column_text(sth, 4)); + menu_item->func = g_strdup((gchar *)sqlite3_column_text(sth, 5)); - g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Loaded menu item %s(%d)", menu_item->text, menu_item->id); + g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Loaded menu item %d: %s", menu_item->id, menu_item->text); *menu_items = g_slist_prepend(*menu_items, menu_item); }