diff options
author | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 14:38:44 -0500 |
---|---|---|
committer | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 14:38:44 -0500 |
commit | ee6c3f9b4cf08a276c971dee66e1acdb32b3dff9 (patch) | |
tree | f7dc3f671114fd867204dca23871eaf2fa4ccc4a | |
parent | 7aeb5ac87c6105bd8fcc9b1fd12e37ba1550f587 (diff) |
Import Upstream version 0.4.2.3
-rw-r--r-- | Makefile.in | 10 | ||||
-rw-r--r-- | arch/linux/common/alsa.h | 7 | ||||
-rw-r--r-- | arch/linux/common/os.h | 9 | ||||
-rw-r--r-- | arch/linux/common/pci.h | 32 | ||||
-rw-r--r-- | arch/linux/common/sensors.h | 2 | ||||
-rw-r--r-- | arch/linux/common/storage.h | 8 | ||||
-rw-r--r-- | autopackage/default.apspec | 2 | ||||
-rw-r--r-- | binreloc.c | 6 | ||||
-rw-r--r-- | callbacks.c | 8 | ||||
-rw-r--r-- | computer.h | 1 | ||||
-rwxr-xr-x | configure | 9 | ||||
-rw-r--r-- | devices.c | 17 | ||||
-rw-r--r-- | hardinfo.h | 2 | ||||
-rw-r--r-- | hardinfo.xml | 34 | ||||
-rw-r--r-- | iconcache.c | 10 | ||||
-rw-r--r-- | report.c | 44 | ||||
-rw-r--r-- | shell.c | 91 | ||||
-rw-r--r-- | stock.c | 14 | ||||
-rw-r--r-- | syncmanager.c | 11 | ||||
-rw-r--r-- | syncmanager.h | 1 | ||||
-rw-r--r-- | util.c | 29 | ||||
-rw-r--r-- | vendor.c | 1 |
22 files changed, 201 insertions, 147 deletions
diff --git a/Makefile.in b/Makefile.in index cc713aab..52158394 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -CC = gcc $(ARCHOPTS) -CCSLOW = gcc -O0 -CFLAGS = -fPIC -pipe -Wall $(GTK_CFLAGS) $(GLADE_CFLAGS) $(SOUP_CFLAGS) -I. +CC = gcc $(ARCHOPTS) -g +CCSLOW = gcc -O0 -g +CFLAGS = -fPIC -pipe -Wall -g $(GTK_CFLAGS) $(GLADE_CFLAGS) $(SOUP_CFLAGS) -I. # ---------------------------------------------------------------------------- @@ -61,7 +61,7 @@ install: all mkdir -p ${DESTDIR}/usr/bin mkdir -p ${DESTDIR}/usr/local mkdir -p ${DESTDIR}/usr/share/applications - mkdir -p ${DESTDIR}/usr/lib/hardinfo/modules + mkdir -p ${DESTDIR}${LIBDIR}/hardinfo/modules mkdir -p ${DESTDIR}/usr/share/hardinfo/pixmaps @echo '[01;34m*** Installing icon...[00m' @@ -71,7 +71,7 @@ install: all cp hardinfo ${DESTDIR}/usr/bin/hardinfo @echo '[01;34m*** Installing modules...[00m' - cp -Lr modules/*.so ${DESTDIR}/usr/lib/hardinfo/modules + cp -Lr modules/*.so ${DESTDIR}${LIBDIR}/hardinfo/modules @echo '[01;34m*** Installing pixmaps...[00m' cp -Lr pixmaps/* ${DESTDIR}/usr/share/hardinfo/pixmaps diff --git a/arch/linux/common/alsa.h b/arch/linux/common/alsa.h index 0c0744ae..8f4cc2ac 100644 --- a/arch/linux/common/alsa.h +++ b/arch/linux/common/alsa.h @@ -20,16 +20,15 @@ gchar * computer_get_alsacards(Computer * computer) { GSList *p; - gchar *tmp = ""; + gchar *tmp = g_strdup(""); gint n = 0; if (computer->alsa) { for (p = computer->alsa->cards; p; p = p->next) { AlsaCard *ac = (AlsaCard *) p->data; - tmp = - g_strdup_printf("Audio Adapter#%d=%s\n%s", ++n, - ac->friendly_name, tmp); + tmp = h_strdup_cprintf("Audio Adapter#%d=%s\n", + tmp, ++n, ac->friendly_name); } } diff --git a/arch/linux/common/os.h b/arch/linux/common/os.h index 0fe06709..e4f35e95 100644 --- a/arch/linux/common/os.h +++ b/arch/linux/common/os.h @@ -185,6 +185,15 @@ computer_get_os(void) os->distro = g_strdup(buf); } } + + if (g_str_equal(distro_db[i].codename, "ppy")) { + gchar *tmp; + + tmp = g_strdup_printf("Puppy Linux %.2f", atof(os->distro) / 100.0); + g_free(os->distro); + os->distro = tmp; + } + os->distrocode = g_strdup(distro_db[i].codename); break; diff --git a/arch/linux/common/pci.h b/arch/linux/common/pci.h index 554c3dca..388ce9aa 100644 --- a/arch/linux/common/pci.h +++ b/arch/linux/common/pci.h @@ -21,16 +21,32 @@ __scan_pci(void) { FILE *lspci; gchar buffer[256], *buf, *strhash = NULL, *strdevice = NULL; - gchar *category = NULL, *name = NULL; - gint n = 0; - - if (!(lspci = popen(LSPCI, "r"))) { - goto pci_error; + gchar *category = NULL, *name = NULL, *icon; + gint n = 0, x = 0; + + buf = g_build_filename(g_get_home_dir(), ".hardinfo", "pci.ids", NULL); + if (!g_file_test(buf, G_FILE_TEST_EXISTS)) { + DEBUG("using system-provided PCI IDs"); + g_free(buf); + if (!(lspci = popen(LSPCI, "r"))) { + goto pci_error; + } + } else { + gchar *tmp; + + tmp = g_strdup_printf("%s -i '%s'", LSPCI, buf); + g_free(buf); + buf = tmp; + + DEBUG("using updated PCI IDs (from %s)", buf); + if (!(lspci = popen(tmp, "r"))) { + g_free(buf); + goto pci_error; + } else { + g_free(buf); + } } - gchar *icon; - - int x = 0; /* unique Memory, Capability and I/O port */ while (fgets(buffer, 256, lspci)) { buf = g_strstrip(buffer); diff --git a/arch/linux/common/sensors.h b/arch/linux/common/sensors.h index bc84014b..1c4fd69f 100644 --- a/arch/linux/common/sensors.h +++ b/arch/linux/common/sensors.h @@ -254,7 +254,7 @@ static void read_sensors_acpi(void) if ((tz = g_dir_open(path_tz, 0, NULL))) { const gchar *entry; - gchar *temp = ""; + gchar *temp = g_strdup(""); while ((entry = g_dir_read_name(tz))) { diff --git a/arch/linux/common/storage.h b/arch/linux/common/storage.h index 6700984b..71c206cd 100644 --- a/arch/linux/common/storage.h +++ b/arch/linux/common/storage.h @@ -79,9 +79,13 @@ __scan_scsi_devices(void) model = g_strdup_printf("%s %s", vendor, model + 7); } else if (!strncmp(buf, "Type: ", 8)) { - char *p = strstr(buf, "ANSI SCSI revi"); + char *p; gchar *type = NULL, *icon = NULL; + if (!(p = strstr(buf, "ANSI SCSI revision"))) { + p = strstr(buf, "ANSI SCSI revision"); + } + if (p != NULL) { while (*(--p) == ' '); *(++p) = 0; @@ -335,7 +339,7 @@ __scan_ide_devices(void) g_hash_table_insert(moreinfo, devid, strhash); g_free(model); - model = ""; + model = g_strdup(""); } else g_free(device); diff --git a/autopackage/default.apspec b/autopackage/default.apspec index 9042d252..f12960c1 100644 --- a/autopackage/default.apspec +++ b/autopackage/default.apspec @@ -2,7 +2,7 @@ # Generated by mkapspec 0.2 [Meta] ShortName: hardinfo -SoftwareVersion: 0.4.2.2 +SoftwareVersion: 0.4.2.1 DisplayName: HardInfo $SOFTWAREVERSION RootName: @tia.mat.br/hardinfo:$SOFTWAREVERSION Summary: System profiler and benchmark tool @@ -21,6 +21,7 @@ #include <limits.h> #include <string.h> #include "binreloc.h" +#include "config.h" G_BEGIN_DECLS /** @internal @@ -592,7 +593,12 @@ gchar *gbr_find_lib_dir(const gchar * default_lib_dir) return NULL; } +#ifdef ARCH_x86_64 + dir = g_build_filename(prefix, "lib64", NULL); +#else dir = g_build_filename(prefix, "lib", NULL); +#endif + g_free(prefix); return dir; } diff --git a/callbacks.c b/callbacks.c index 6a84de79..32db0791 100644 --- a/callbacks.c +++ b/callbacks.c @@ -72,22 +72,22 @@ void cb_save_graphic() void cb_open_web_page() { - open_url("http://hardinfo.berlios.de"); + open_url("http://wiki.hardinfo.org"); } void cb_open_online_docs() { - open_url("http://hardinfo.berlios.de/web/Documentation"); + open_url("http://wiki.hardinfo.org/Documentation"); } void cb_report_bug() { - open_url("http://hardinfo.berlios.de/web/BugReports"); + open_url("http://wiki.hardinfo.org/BugReports"); } void cb_donate() { - open_url("http://hardinfo.berlios.de/web/Donate"); + open_url("http://wiki.hardinfo.org/Donate"); } void cb_refresh() @@ -34,6 +34,7 @@ static struct { { DB_PREFIX "SuSE-release", "suse" }, { DB_PREFIX "sun-release", "sun" }, { DB_PREFIX "zenwalk-version", "zen" }, + { DB_PREFIX "puppyversion", "ppy" }, /* * RedHat must be the *last* one to be checked, since * some distros (like Mandrake) includes a redhat-relase @@ -45,6 +45,7 @@ case $OS in esac PROC=`uname -m` +LIBDIR='/usr/lib' case $PROC in i?86) ln -sf linux/x86 arch/this @@ -54,7 +55,8 @@ case $PROC in ARCH="ARCH_PPC" ;; x86_64) ln -sf linux/x86_64 arch/this - ARCH="ARCH_x86_64" ;; + ARCH="ARCH_x86_64" + LIBDIR="/usr/lib64" ;; mips*) ln -sf linux/mips arch/this ARCH="ARCH_MIPS" ;; @@ -73,7 +75,7 @@ case $PROC in alpha) ln -sf linux/alpha arch/this ARCH="ARCH_ALPHA" ;; - s390) + s390*) ln -sf linux/s390 arch/this ARCH="ARCH_S390" ;; m68k) @@ -167,7 +169,7 @@ done # -------------------------------------------------------------------------- if [ $SOUP -eq -1 ]; then - echo "Disabling libsoup support. (Network Manager won't be available.)" + echo "Disabling libsoup support. (Network Updater won't be available.)" fi # -------------------------------------------------------------------------- @@ -214,6 +216,7 @@ echo "SOUP_LIBS = ${SOUP_LIBS}" >> Makefile echo "SOUP_CFLAGS = ${SOUP_FLAGS}" >> Makefile echo "PACKAGE = `basename ${PWD}`" >> Makefile echo "ARCHOPTS = " >> Makefile +echo "LIBDIR = $LIBDIR" >> Makefile cat Makefile.in >> Makefile @@ -23,6 +23,7 @@ #include <hardinfo.h> #include <shell.h> #include <iconcache.h> +#include <syncmanager.h> #include <expr.h> #include <socket.h> @@ -346,8 +347,20 @@ guchar hi_module_get_weight(void) void hi_module_init(void) { - moreinfo = - g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); + if (!g_file_test("/usr/share/misc/pci.ids", G_FILE_TEST_EXISTS)) { + static SyncEntry se[] = { + { + .fancy_name = "Update PCI ID listing", + .name = "GetPCIIds", + .save_to = "pci.ids", + .get_data = NULL + } + }; + + sync_manager_add_entry(&se[0]); + } + + moreinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); __init_memory_labels(); } @@ -98,6 +98,8 @@ gchar *seconds_to_string(unsigned int seconds); gchar *h_strdup_cprintf(const gchar *format, gchar *source, ...); gchar *h_strconcat(gchar *string1, ...); +void h_hash_table_remove_all (GHashTable *hash_table); + void module_entry_scan_all_except(ModuleEntry *entries, gint except_entry); void module_entry_scan_all(ModuleEntry *entries); diff --git a/hardinfo.xml b/hardinfo.xml deleted file mode 100644 index 82b3ac26..00000000 --- a/hardinfo.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" ?> -<!DOCTYPE luau-repository SYSTEM - "http://luau.sourceforge.net/luau-repository-1.2.dtd"> - -<luau-repository interface="1.2"> - - <program-info id="@tia.mat.br/hardinfo"> - - <shortname>hardinfo</shortname> - <fullname>HardInfo 0.4.2.2</fullname> - <desc>System profiler and benchmark tool</desc> - <url></url> - - </program-info> - - <software version="0.4.2.2"> - <date>2007-07-20</date> - <interface version="0.0" /> - <keyword>UNSTABLE</keyword> - - <short>Short declarative statement(s) about release for language en.</short> - <long> - Paragraphs describing the release for language en. - </long> - - <package type="autopackage" - version="1" - size="9255" - md5="70a39bcef7d5175feff7fb1fdfe805b5"> - /HardInfo%200.4.2.2%200.4.2.2.package - </package> - </software> - -</luau-repository> diff --git a/iconcache.c b/iconcache.c index 49325e39..ed7ce209 100644 --- a/iconcache.c +++ b/iconcache.c @@ -26,6 +26,8 @@ void icon_cache_init(void) DEBUG("initializing icon cache"); if (!cache) { cache = g_hash_table_new(g_str_hash, g_str_equal); + } else { + DEBUG("already initialized? huh?"); } } @@ -48,7 +50,9 @@ GdkPixbuf *icon_cache_get_pixbuf(const gchar * file) g_free(path); } - g_object_ref(icon); + if (icon) { + g_object_ref(icon); + } return icon; } @@ -81,7 +85,9 @@ GdkPixbuf *icon_cache_get_pixbuf_at_size(const gchar * file, gint wid, g_free(path); } - g_object_ref(icon); + if (icon) { + g_object_ref(icon); + } return icon; } @@ -161,6 +161,7 @@ static void report_html_header(ReportContext * ctx) g_strdup_printf ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Final//EN\">\n" "<html><head>\n" "<title>HardInfo (%s) System Report</title>\n" + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n" "<style>\n" " body { background: #fff }\n" " .title { font: bold 130%% serif; color: #0066FF; padding: 30px 0 10px 0 }\n" " .stitle { font: bold 100%% sans-serif; color: #0044DD; padding: 30px 0 10px 0 }\n" @@ -173,40 +174,39 @@ static void report_html_header(ReportContext * ctx) static void report_html_footer(ReportContext * ctx) { - ctx->output = g_strconcat(ctx->output, + ctx->output = h_strconcat(ctx->output, "</tbody></table></body></html>", NULL); } static void report_html_title(ReportContext * ctx, gchar * text) { - ctx->output = g_strdup_printf("%s" - "<tr><td colspan=\"2\" class=\"titl" + ctx->output = h_strdup_cprintf("<tr><td colspan=\"2\" class=\"titl" "e\">%s</td></tr>\n", ctx->output, text); } static void report_html_subtitle(ReportContext * ctx, gchar * text) { - ctx->output = g_strdup_printf("%s" - "<tr><td colspan=\"2\" class=\"stit" + ctx->output = h_strdup_cprintf("<tr><td colspan=\"2\" class=\"stit" "le\">%s</td></tr>\n", - ctx->output, text); + ctx->output, + text); } static void report_html_subsubtitle(ReportContext * ctx, gchar * text) { - ctx->output = g_strdup_printf("%s" - "<tr><td colspan=\"2\" class=\"ssti" + ctx->output = h_strdup_cprintf("<tr><td colspan=\"2\" class=\"ssti" "tle\">%s</td></tr>\n", - ctx->output, text); + ctx->output, + text); } static void report_html_key_value(ReportContext * ctx, gchar * key, gchar * value) { - ctx->output = g_strdup_printf("%s" - "<tr><td class=\"field\">%s</td>" + ctx->output = h_strdup_cprintf("<tr><td class=\"field\">%s</td>" "<td class=\"value\">%s</td></tr>\n", - ctx->output, key, value); + ctx->output, + key, value); } static void report_text_header(ReportContext * ctx) @@ -226,11 +226,11 @@ static void report_text_title(ReportContext * ctx, gchar * text) gchar *str = (gchar *) ctx->output; int i = strlen(text); - str = g_strdup_printf("%s\n%s\n", str, text); + str = h_strdup_cprintf("\n%s\n", str, text); for (; i; i--) - str = g_strconcat(str, "*", NULL); + str = h_strconcat(str, "*", NULL); - str = g_strconcat(str, "\n\n", NULL); + str = h_strconcat(str, "\n\n", NULL); ctx->output = str; } @@ -239,17 +239,17 @@ static void report_text_subtitle(ReportContext * ctx, gchar * text) gchar *str = ctx->output; int i = strlen(text); - str = g_strdup_printf("%s\n%s\n", str, text); + str = h_strdup_cprintf("\n%s\n", str, text); for (; i; i--) - str = g_strconcat(str, "-", NULL); + str = h_strconcat(str, "-", NULL); - str = g_strconcat(str, "\n\n", NULL); + str = h_strconcat(str, "\n\n", NULL); ctx->output = str; } static void report_text_subsubtitle(ReportContext * ctx, gchar * text) { - ctx->output = g_strdup_printf("%s-%s-\n", ctx->output, text); + ctx->output = h_strdup_cprintf("-%s-\n", ctx->output, text); } static void @@ -257,9 +257,9 @@ report_text_key_value(ReportContext * ctx, gchar * key, gchar * value) { if (strlen(value)) ctx->output = - g_strdup_printf("%s%s\t\t: %s\n", ctx->output, key, value); + h_strdup_cprintf("%s\t\t: %s\n", ctx->output, key, value); else - ctx->output = g_strdup_printf("%s%s\n", ctx->output, key); + ctx->output = h_strdup_cprintf("%s\n", ctx->output, key); } static GSList *report_create_module_list_from_dialog(ReportDialog * rd) @@ -366,7 +366,7 @@ static gchar *report_get_filename(void) GTK_RESPONSE_ACCEPT, NULL); gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), - "hardinfo report"); + "hardinfo_report"); file_chooser_add_filters(dialog, file_types); file_chooser_open_expander(dialog); @@ -24,6 +24,7 @@ #include <hardinfo.h> #include <shell.h> +#include <syncmanager.h> #include <iconcache.h> #include <menu.h> #include <stock.h> @@ -104,7 +105,7 @@ void shell_action_set_property(const gchar * action_name, void shell_action_set_enabled(const gchar * action_name, gboolean setting) { - if (params.gui_running) { + if (params.gui_running && shell->action_group) { GtkAction *action; action = @@ -419,8 +420,6 @@ static void add_module_to_menu(gchar * name, GdkPixbuf * pixbuf) { gchar *about_module = g_strdup_printf("AboutModule%s", name); - stock_icon_register_pixbuf(pixbuf, name); - GtkActionEntry entries[] = { { name, /* name */ @@ -440,6 +439,8 @@ static void add_module_to_menu(gchar * name, GdkPixbuf * pixbuf) }, }; + stock_icon_register_pixbuf(pixbuf, name); + gtk_action_group_add_actions(shell->action_group, entries, 2, NULL); gtk_ui_manager_add_ui(shell->ui_manager, @@ -458,8 +459,6 @@ static void add_module_entry_to_view_menu(gchar * module, gchar * name, GdkPixbuf * pixbuf, GtkTreeIter * iter) { - stock_icon_register_pixbuf(pixbuf, name); - GtkActionEntry entries[] = { { name, /* name */ @@ -471,6 +470,7 @@ add_module_entry_to_view_menu(gchar * module, gchar * name, }, }; + stock_icon_register_pixbuf(pixbuf, name); gtk_action_group_add_actions(shell->action_group, entries, 1, iter); gtk_ui_manager_add_ui(shell->ui_manager, @@ -525,6 +525,11 @@ static void add_modules_to_gui(gpointer data, gpointer user_data) } } +static void __tree_iter_destroy(gpointer data) +{ + gtk_tree_iter_free((GtkTreeIter *) data); +} + void shell_init(GSList * modules) { if (shell) { @@ -544,6 +549,8 @@ void shell_init(GSList * modules) shell->info = info_tree_new(FALSE); shell->moreinfo = info_tree_new(TRUE); shell->loadgraph = load_graph_new(75); + update_tbl = g_hash_table_new_full(g_str_hash, g_str_equal, + g_free, __tree_iter_destroy); gtk_paned_pack1(GTK_PANED(shell->hpaned), shell->tree->scroll, SHELL_PACK_RESIZE, SHELL_PACK_SHRINK); @@ -581,12 +588,24 @@ void shell_init(GSList * modules) shell_action_set_enabled("SaveGraphAction", FALSE); shell_action_set_active("SidePaneAction", TRUE); shell_action_set_active("ToolbarAction", TRUE); + +#ifndef HAS_LIBSOUP + shell_action_set_enabled("SyncManagerAction", FALSE); +#else + shell_action_set_enabled("SyncManagerAction", sync_manager_count_entries() > 0); +#endif } static gboolean update_field(gpointer data) { - ShellFieldUpdate *fu = (ShellFieldUpdate *) data; - GtkTreeIter *iter = g_hash_table_lookup(update_tbl, fu->field_name); + ShellFieldUpdate *fu; + GtkTreeIter *iter; + + fu = (ShellFieldUpdate *) data; + g_return_val_if_fail(fu != NULL, FALSE); + + iter = g_hash_table_lookup(update_tbl, fu->field_name); + g_return_val_if_fail(iter != NULL, FALSE); /* if the entry is still selected, update it */ if (iter && fu->entry->selected && fu->entry->fieldfunc) { @@ -917,9 +936,6 @@ moreinfo_handle_normal(GKeyFile * key_file, gchar * group, gchar ** keys) } } -/* FIXME: This code must be rewritten. Although it works, it is *very* slow and - too complex for this simple task. I am lazy, so I'm not fixing it. - Be my guest to fix it. */ static void update_progress() { GtkTreeModel *model = shell->info->model; @@ -1002,9 +1018,8 @@ static void module_selected_show_info(ShellModuleEntry * entry, gboolean reload) { GKeyFile *key_file = g_key_file_new(); - gchar *key_data; - gchar **groups; GtkTreeStore *store; + gchar *key_data, **groups; gint i; gsize ngroups; @@ -1016,16 +1031,9 @@ module_selected_show_info(ShellModuleEntry * entry, gboolean reload) /* recreate the iter hash table */ if (!reload) { - if (update_tbl) { - g_hash_table_foreach_remove(update_tbl, (GHRFunc) gtk_true, - NULL); - } else { - update_tbl = - g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - g_free); - } + h_hash_table_remove_all(update_tbl); } - + if (update_sfusrc) { GSList *sfusrc; @@ -1124,22 +1132,26 @@ static void module_selected(gpointer data) ShellModuleEntry *entry; static ShellModuleEntry *current = NULL; static gboolean updating = FALSE; - - if (updating) - return; - - updating = TRUE; + /* Gets the currently selected item on the left-side TreeView; if there is no selection, silently return */ if (!gtk_tree_selection_get_selected - (shelltree->selection, &model, &parent)) + (shelltree->selection, &model, &parent)) { return; + } /* Mark the currently selected module as "unselected"; this is used to kill the update timeout. */ - if (current) + if (current) { current->selected = FALSE; + } + + if (updating) { + return; + } else { + updating = TRUE; + } /* Get the current selection and shows its related info */ gtk_tree_model_get(model, &parent, TREE_COL_DATA, &entry, -1); @@ -1157,18 +1169,17 @@ static void module_selected(gpointer data) gtk_tree_view_columns_autosize(GTK_TREE_VIEW(shell->info->view)); /* urgh. why don't GTK do this when the model is cleared? */ - gtk_range_set_value(GTK_RANGE - (GTK_SCROLLED_WINDOW(shell->info->scroll)-> - vscrollbar), 0.0); - gtk_range_set_value(GTK_RANGE - (GTK_SCROLLED_WINDOW(shell->info->scroll)-> - hscrollbar), 0.0); - gtk_range_set_value(GTK_RANGE - (GTK_SCROLLED_WINDOW(shell->moreinfo->scroll)-> - vscrollbar), 0.0); - gtk_range_set_value(GTK_RANGE - (GTK_SCROLLED_WINDOW(shell->moreinfo->scroll)-> - hscrollbar), 0.0); +#define RANGE_SET_VALUE(tree,scrollbar,value) \ + gtk_range_set_value(GTK_RANGE \ + (GTK_SCROLLED_WINDOW(shell->tree->scroll)-> \ + scrollbar), value); + + RANGE_SET_VALUE(info, vscrollbar, 0.0); + RANGE_SET_VALUE(info, hscrollbar, 0.0); + RANGE_SET_VALUE(moreinfo, vscrollbar, 0.0); + RANGE_SET_VALUE(moreinfo, hscrollbar, 0.0); + +#undef RANGE_SET_VALUE shell_status_update("Done."); shell_status_set_enabled(FALSE); @@ -25,13 +25,13 @@ static struct { gchar *filename; gchar *stock_id; } stock_icons[] = { - { - "report.png", HI_STOCK_REPORT}, { - "internet.png", HI_STOCK_INTERNET}, { - "module.png", HI_STOCK_MODULE}, { - "about-modules.png", HI_STOCK_ABOUT_MODULES}, { - "syncmanager-small.png", HI_STOCK_SYNC_MENU}, { -"face-grin.png", HI_STOCK_DONATE},}; + { "report.png", HI_STOCK_REPORT}, + { "internet.png", HI_STOCK_INTERNET}, + { "module.png", HI_STOCK_MODULE}, + { "about-modules.png", HI_STOCK_ABOUT_MODULES}, + { "syncmanager-small.png", HI_STOCK_SYNC_MENU}, + { "face-grin.png", HI_STOCK_DONATE}, +}; static GtkIconFactory *icon_factory; diff --git a/syncmanager.c b/syncmanager.c index 599804eb..f4949644 100644 --- a/syncmanager.c +++ b/syncmanager.c @@ -94,6 +94,15 @@ static void sync_dialog_netarea_start_actions(SyncDialog * sd, #endif /* HAS_LIBSOUP */ +gint sync_manager_count_entries(void) +{ +#ifdef HAS_LIBSOUP + return g_slist_length(entries); +#else + return 0; +#endif +} + void sync_manager_add_entry(SyncEntry * entry) { #ifdef HAS_LIBSOUP @@ -110,7 +119,7 @@ void sync_manager_show(void) { #ifndef HAS_LIBSOUP g_warning - ("HardInfo was compiled without libsoup support. (Network Manager requires it.)"); + ("HardInfo was compiled without libsoup support. (Network Updater requires it.)"); #else /* !HAS_LIBSOUP */ SyncDialog *sd = sync_dialog_new(); diff --git a/syncmanager.h b/syncmanager.h index 78ca2153..93e238d7 100644 --- a/syncmanager.h +++ b/syncmanager.h @@ -36,5 +36,6 @@ struct _SyncEntry { void sync_manager_add_entry(SyncEntry *entry); void sync_manager_show(void); +gint sync_manager_count_entries(void); #endif /* __SYNCMANAGER_H__ */ @@ -662,16 +662,11 @@ static GSList *modules_check_deps(GSList * modules) ShellModule *m; gboolean found = FALSE; - for (l = modules; l; l = l->next) { + for (l = modules; l && !found; l = l->next) { m = (ShellModule *) l->data; - gchar *name = - g_path_get_basename(g_module_name(m->dll)); - - if (g_str_equal(name, deps[i])) { - found = TRUE; - break; - } + gchar *name = g_path_get_basename(g_module_name(m->dll)); + found = g_str_equal(name, deps[i]); g_free(name); } @@ -707,7 +702,7 @@ static GSList *modules_check_deps(GSList * modules) ShellModule *mod = module_load(deps[i]); if (mod) - modules = g_slist_append(modules, mod); + modules = g_slist_prepend(modules, mod); modules = modules_check_deps(modules); /* re-check dependencies */ } else { modules = g_slist_remove(modules, module); @@ -743,7 +738,7 @@ static GSList *modules_load(gchar ** module_list) if (g_strrstr(filename, "." G_MODULE_SUFFIX) && module_in_module_list(filename, module_list) && ((module = module_load(filename)))) { - modules = g_slist_append(modules, module); + modules = g_slist_prepend(modules, module); } } @@ -1001,7 +996,6 @@ gchar *h_strdup_cprintf(const gchar * format, gchar * source, ...) retn = buffer; } - return retn; } @@ -1041,3 +1035,16 @@ gchar *h_strconcat(gchar * string1, ...) return concat; } + +static gboolean h_hash_table_remove_all_true(gpointer key, gpointer data, gpointer user_data) +{ + return TRUE; +} + +void +h_hash_table_remove_all(GHashTable *hash_table) +{ + g_hash_table_foreach_remove(hash_table, + h_hash_table_remove_all_true, + NULL); +} @@ -57,6 +57,7 @@ static const Vendor vendors[] = { {"Logitech", "Logitech International SA", "www.logitech.com"}, {"FUJITSU", "Fujitsu", "www.fujitsu.com"}, {"CDU", "Sony", "www.sony.com"}, + {"SanDisk", "SanDisk", "www.sandisk.com"}, {NULL, NULL, NULL}, }; |