From d3b9aa19f04e6be78afb8497e7808a3d42042bf2 Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Thu, 26 Jan 2012 22:14:43 -0200 Subject: Better manage moreinfo hashes Have only one for the whole program and use per-module namespaces/prefixes so that each module can clear its own information easily. --- modules/devices/printers.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'modules/devices/printers.c') diff --git a/modules/devices/printers.c b/modules/devices/printers.c index 80851a00..013291cf 100644 --- a/modules/devices/printers.c +++ b/modules/devices/printers.c @@ -42,12 +42,6 @@ static gboolean cups_init = FALSE; GModule *cups; -static gboolean -remove_printer_devices(gpointer key, gpointer value, gpointer data) -{ - return g_str_has_prefix(key, "PRN"); -} - void init_cups(void) { @@ -199,7 +193,7 @@ scan_printers_do(void) } /* remove old devices from global device table */ - g_hash_table_foreach_remove(moreinfo, remove_printer_devices, NULL); + moreinfo_del_with_prefix("DEV:PRN"); num_dests = cups_dests_get(&dests); if (num_dests > 0) { @@ -259,7 +253,8 @@ scan_printers_do(void) } } - g_hash_table_insert(moreinfo, prn_id, prn_moreinfo); + moreinfo_add_with_prefix("DEV", prn_id, prn_moreinfo); + g_free(prn_id); g_hash_table_destroy(options); } -- cgit v1.2.3