diff options
author | Leandro Pereira <leandro@hardinfo.org> | 2012-01-26 22:14:43 -0200 |
---|---|---|
committer | Leandro Pereira <leandro@hardinfo.org> | 2012-01-26 22:14:43 -0200 |
commit | d3b9aa19f04e6be78afb8497e7808a3d42042bf2 (patch) | |
tree | 340e9be8f863e1ad29e1da91cd87a66409d6f706 /modules/devices/printers.c | |
parent | d9e242117b7a73dd3057af25956027a361f7999f (diff) |
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.
Diffstat (limited to 'modules/devices/printers.c')
-rw-r--r-- | modules/devices/printers.c | 11 |
1 files changed, 3 insertions, 8 deletions
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); } |