aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro A. F. Pereira <leandro@hardinfo.org>2009-07-27 19:10:24 -0300
committerLeandro A. F. Pereira <leandro@hardinfo.org>2009-07-27 19:10:24 -0300
commit4e89125c9bec74053f8ddce3051e256f4071bd6a (patch)
tree4416083fd2c5a53385ceea9f2d71b2921140f0e7
parent30b198e4d9f2e834dde8a4d258d90ef48257d0d5 (diff)
Add printer icons
-rw-r--r--hardinfo2/arch/common/printers.h7
-rw-r--r--hardinfo2/devices.c7
2 files changed, 11 insertions, 3 deletions
diff --git a/hardinfo2/arch/common/printers.h b/hardinfo2/arch/common/printers.h
index 75b6e84a..16063737 100644
--- a/hardinfo2/arch/common/printers.h
+++ b/hardinfo2/arch/common/printers.h
@@ -184,10 +184,12 @@ __scan_printers(void)
gchar *prn_id, *prn_moreinfo;
g_free(printer_list);
+ g_free(printer_icons);
if (!cups_init) {
__init_cups();
+ printer_icons = g_strdup("");
printer_list = g_strdup("[Printers]\n"
"No suitable CUPS library found=");
return;
@@ -199,6 +201,7 @@ __scan_printers(void)
num_dests = cups_dests_get(&dests);
if (num_dests > 0) {
printer_list = g_strdup_printf("[Printers (CUPS)]\n");
+ printer_icons = g_strdup("");
for (i = 0; i < num_dests; i++) {
GHashTable *options;
@@ -217,6 +220,10 @@ __scan_printers(void)
prn_id,
dests[i].name,
dests[i].is_default ? "<i>Default</i>" : "");
+ printer_icons = h_strdup_cprintf("\nIcon$%s$%s=printer.png",
+ printer_icons,
+ prn_id,
+ dests[i].name);
prn_moreinfo = g_strdup("");
for (j = 0; j < G_N_ELEMENTS(cups_fields); j++) {
diff --git a/hardinfo2/devices.c b/hardinfo2/devices.c
index 7fbac390..3ecce794 100644
--- a/hardinfo2/devices.c
+++ b/hardinfo2/devices.c
@@ -83,7 +83,7 @@ static ModuleEntry entries[] = {
static GHashTable *moreinfo = NULL;
static GSList *processors = NULL;
-static gchar *printer_list = NULL;
+static gchar *printer_list = NULL, *printer_icons = NULL;
static gchar *pci_list = NULL;
static gchar *input_list = NULL;
static gchar *storage_list = NULL;
@@ -375,9 +375,10 @@ gchar *callback_sensors()
gchar *callback_printers()
{
return g_strdup_printf("%s\n"
- "[$ShellParam$]\n"
+ "[$ShellParam$]\n"
"ViewType=1\n"
- "ReloadInterval=5000", printer_list);
+ "ReloadInterval=5000\n"
+ "%s", printer_list, printer_icons);
}
gchar *callback_storage()