aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hardinfo2/arch/common/blowfish.h2
-rw-r--r--hardinfo2/arch/common/fib.h2
-rw-r--r--hardinfo2/arch/common/md5.h2
-rw-r--r--hardinfo2/arch/common/sha1.h2
-rw-r--r--hardinfo2/arch/common/zlib.h2
-rw-r--r--hardinfo2/shell.c896
-rw-r--r--hardinfo2/shell.h1
7 files changed, 474 insertions, 433 deletions
diff --git a/hardinfo2/arch/common/blowfish.h b/hardinfo2/arch/common/blowfish.h
index 1c5be8c1..900c58e4 100644
--- a/hardinfo2/arch/common/blowfish.h
+++ b/hardinfo2/arch/common/blowfish.h
@@ -63,6 +63,6 @@ benchmark_fish(void)
g_free(bdata_path);
gchar *retval = g_strdup_printf("[Results <i>(in seconds; lower is better)</i>]\n"
- "<b>This Machine</b>=%.2f\n", elapsed);
+ "<i>This Machine</i>=%.2f\n", elapsed);
return benchmark_include_results(retval, "Blowfish");
}
diff --git a/hardinfo2/arch/common/fib.h b/hardinfo2/arch/common/fib.h
index e5d28783..a4fc2151 100644
--- a/hardinfo2/arch/common/fib.h
+++ b/hardinfo2/arch/common/fib.h
@@ -45,6 +45,6 @@ benchmark_fib(void)
g_timer_destroy(timer);
gchar *retval = g_strdup_printf("[Results <i>(in seconds; lower is better)</i>]\n"
- "<b>This Machine</b>=%.3f\n", elapsed);
+ "<i>This Machine</i>=%.3f\n", elapsed);
return benchmark_include_results(retval, "Fibonacci");
}
diff --git a/hardinfo2/arch/common/md5.h b/hardinfo2/arch/common/md5.h
index 3e6248eb..e14da71c 100644
--- a/hardinfo2/arch/common/md5.h
+++ b/hardinfo2/arch/common/md5.h
@@ -60,7 +60,7 @@ benchmark_md5(void)
g_free(bdata_path);
gchar *retval = g_strdup_printf("[Results <i>(in seconds; lower is better)</i>]\n"
- "<b>This Machine</b>=%.2f\n", elapsed);
+ "<i>This Machine</i>=%.2f\n", elapsed);
return benchmark_include_results(retval, "MD5");
}
diff --git a/hardinfo2/arch/common/sha1.h b/hardinfo2/arch/common/sha1.h
index 4b5bed5a..8164e885 100644
--- a/hardinfo2/arch/common/sha1.h
+++ b/hardinfo2/arch/common/sha1.h
@@ -59,7 +59,7 @@ benchmark_sha1(void)
g_free(bdata_path);
gchar *retval = g_strdup_printf("[Results <i>(in seconds; lower is better)</i>]\n"
- "<b>This Machine</b>=%.2f\n", elapsed);
+ "<i>This Machine</i>=%.2f\n", elapsed);
return benchmark_include_results(retval, "SHA1");
}
diff --git a/hardinfo2/arch/common/zlib.h b/hardinfo2/arch/common/zlib.h
index f30cf82c..b3acd472 100644
--- a/hardinfo2/arch/common/zlib.h
+++ b/hardinfo2/arch/common/zlib.h
@@ -82,7 +82,7 @@ benchmark_zlib(void)
g_free(bdata_path);
gchar *retval = g_strdup_printf("[Results <i>(in seconds; lower is better)</i>]\n"
- "<b>This Machine</b>=%.2f\n", elapsed);
+ "<i>This Machine</i>=%.2f\n", elapsed);
return benchmark_include_results(retval, "ZLib");
}
diff --git a/hardinfo2/shell.c b/hardinfo2/shell.c
index a7deb34f..e39cee40 100644
--- a/hardinfo2/shell.c
+++ b/hardinfo2/shell.c
@@ -32,23 +32,23 @@
* Internal Prototypes ********************************************************
*/
-static void create_window();
-static ShellTree *tree_new(void);
-static ShellInfoTree *info_tree_new(gboolean extra);
+static void create_window();
+static ShellTree *tree_new(void);
+static ShellInfoTree *info_tree_new(gboolean extra);
-static void module_selected(GtkTreeSelection * ts, gpointer data);
-static void module_selected_show_info(ShellModuleEntry * entry,
- gboolean reload);
-static void info_selected(GtkTreeSelection * ts, gpointer data);
-static void info_selected_show_extra(gchar * data);
-static gboolean reload_section(gpointer data);
+static void module_selected(GtkTreeSelection * ts, gpointer data);
+static void module_selected_show_info(ShellModuleEntry * entry,
+ gboolean reload);
+static void info_selected(GtkTreeSelection * ts, gpointer data);
+static void info_selected_show_extra(gchar * data);
+static gboolean reload_section(gpointer data);
/*
* Globals ********************************************************************
*/
-static Shell *shell = NULL;
-static GHashTable *update_tbl = NULL;
+static Shell *shell = NULL;
+static GHashTable *update_tbl = NULL;
/*
* Code :) ********************************************************************
@@ -58,78 +58,77 @@ Shell *shell_get_main_shell(void)
{
return shell;
}
-
-void shell_ui_manager_set_visible(const gchar *path,
- gboolean setting)
+
+void shell_ui_manager_set_visible(const gchar * path, gboolean setting)
{
GtkWidget *widget;
-
+
if (!params.gui_running)
- return;
-
+ return;
+
widget = gtk_ui_manager_get_widget(shell->ui_manager, path);
if (!widget)
- return;
-
+ return;
+
if (setting)
gtk_widget_show(widget);
else
gtk_widget_hide(widget);
}
-void shell_action_set_property(const gchar *action_name,
- const gchar *property,
- gboolean setting)
+void shell_action_set_property(const gchar * action_name,
+ const gchar * property, gboolean setting)
{
GtkAction *action;
-
+
if (!params.gui_running)
- return;
+ return;
action = gtk_action_group_get_action(shell->action_group, action_name);
if (action) {
- GValue value = {0};
-
- g_value_init(&value, G_TYPE_BOOLEAN);
- g_value_set_boolean(&value, setting);
-
- g_object_set_property(G_OBJECT(action), property, &value);
-
- g_value_unset(&value);
- }
+ GValue value = { 0 };
+
+ g_value_init(&value, G_TYPE_BOOLEAN);
+ g_value_set_boolean(&value, setting);
+
+ g_object_set_property(G_OBJECT(action), property, &value);
+
+ g_value_unset(&value);
+ }
}
-void shell_action_set_enabled(const gchar *action_name, gboolean setting)
+void shell_action_set_enabled(const gchar * action_name, gboolean setting)
{
if (params.gui_running) {
- GtkAction *action;
+ GtkAction *action;
- action = gtk_action_group_get_action(shell->action_group, action_name);
- if (action) {
- gtk_action_set_sensitive(action, setting);
- }
+ action =
+ gtk_action_group_get_action(shell->action_group, action_name);
+ if (action) {
+ gtk_action_set_sensitive(action, setting);
+ }
}
}
-gboolean shell_action_get_enabled(const gchar *action_name)
+gboolean shell_action_get_enabled(const gchar * action_name)
{
GtkAction *action;
if (!params.gui_running)
- return FALSE;
-
+ return FALSE;
+
action = gtk_action_group_get_action(shell->action_group, action_name);
if (action) {
- return gtk_action_get_sensitive(action);
+ return gtk_action_get_sensitive(action);
}
-
+
return FALSE;
}
void shell_set_side_pane_visible(gboolean setting)
{
if (!params.gui_running)
- return;
+ return;
if (setting)
gtk_widget_show(shell->tree->scroll);
@@ -137,110 +136,109 @@ void shell_set_side_pane_visible(gboolean setting)
gtk_widget_hide(shell->tree->scroll);
}
-gboolean shell_action_get_active(const gchar *action_name)
+gboolean shell_action_get_active(const gchar * action_name)
{
- GtkAction *action;
- GSList *proxies;
-
+ GtkAction *action;
+ GSList *proxies;
+
/* FIXME: Ugh. Are you sure there isn't any simpler way? O_o */
if (!params.gui_running)
- return FALSE;
+ return FALSE;
action = gtk_action_group_get_action(shell->action_group, action_name);
if (action) {
- proxies = gtk_action_get_proxies(action);
-
- for (; proxies; proxies = proxies->next) {
- GtkWidget *widget = (GtkWidget *)proxies->data;
-
- if (GTK_IS_CHECK_MENU_ITEM(widget)) {
- return gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
- }
- }
+ proxies = gtk_action_get_proxies(action);
+
+ for (; proxies; proxies = proxies->next) {
+ GtkWidget *widget = (GtkWidget *) proxies->data;
+
+ if (GTK_IS_CHECK_MENU_ITEM(widget)) {
+ return
+ gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM
+ (widget));
+ }
+ }
}
-
+
return FALSE;
}
-void shell_action_set_active(const gchar *action_name, gboolean setting)
+void shell_action_set_active(const gchar * action_name, gboolean setting)
{
- GtkAction *action;
- GSList *proxies;
-
+ GtkAction *action;
+ GSList *proxies;
+
/* FIXME: Ugh. Are you sure there isn't any simpler way? O_o */
if (!params.gui_running)
- return;
+ return;
action = gtk_action_group_get_action(shell->action_group, action_name);
if (action) {
- proxies = gtk_action_get_proxies(action);
-
- for (; proxies; proxies = proxies->next) {
- GtkWidget *widget = (GtkWidget *)proxies->data;
-
- if (GTK_IS_CHECK_MENU_ITEM(widget)) {
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), setting);
- return;
- }
- }
+ proxies = gtk_action_get_proxies(action);
+
+ for (; proxies; proxies = proxies->next) {
+ GtkWidget *widget = (GtkWidget *) proxies->data;
+
+ if (GTK_IS_CHECK_MENU_ITEM(widget)) {
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget),
+ setting);
+ return;
+ }
+ }
}
}
-void
-shell_status_pulse(void)
+void shell_status_pulse(void)
{
if (params.gui_running) {
- if (shell->_pulses++ == 20) {
- /* we're pulsing for some time, disable the interface and change the cursor
- to a hourglass */
- shell_view_set_enabled(FALSE);
- }
-
- gtk_progress_bar_pulse(GTK_PROGRESS_BAR(shell->progress));
- while (gtk_events_pending())
- gtk_main_iteration();
+ if (shell->_pulses++ == 20) {
+ /* we're pulsing for some time, disable the interface and change the cursor
+ to a hourglass */
+ shell_view_set_enabled(FALSE);
+ }
+
+ gtk_progress_bar_pulse(GTK_PROGRESS_BAR(shell->progress));
+ while (gtk_events_pending())
+ gtk_main_iteration();
} else {
- static gint counter = 0;
-
- fprintf(stderr, "\033[2K\033[40;37;1m %c\033[0m\r",
- "|/-\\"[counter++ % 4]);
+ static gint counter = 0;
+
+ fprintf(stderr, "\033[2K\033[40;37;1m %c\033[0m\r",
+ "|/-\\"[counter++ % 4]);
}
}
-void
-shell_status_set_percentage(gint percentage)
+void shell_status_set_percentage(gint percentage)
{
if (params.gui_running) {
- gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(shell->progress),
- (float)percentage / 100.0);
- while (gtk_events_pending())
- gtk_main_iteration();
+ gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(shell->progress),
+ (float) percentage / 100.0);
+ while (gtk_events_pending())
+ gtk_main_iteration();
} else {
- if (percentage < 1 || percentage >= 100) {
- fprintf(stderr, "\033[2K");
- } else {
- gchar pbar[] = "----------";
-
- memset(pbar, '#', percentage / 10);
-
- fprintf(stderr, "\r\033[40;37;1m%3d%% \033[40;34;1m"
- "%s\033[0m\r",
- percentage, pbar);
- }
+ if (percentage < 1 || percentage >= 100) {
+ fprintf(stderr, "\033[2K");
+ } else {
+ gchar pbar[] = "----------";
+
+ memset(pbar, '#', percentage / 10);
+
+ fprintf(stderr, "\r\033[40;37;1m%3d%% \033[40;34;1m"
+ "%s\033[0m\r", percentage, pbar);
+ }
}
}
-void
-shell_view_set_enabled(gboolean setting)
+void shell_view_set_enabled(gboolean setting)
{
if (!params.gui_running)
- return;
+ return;
if (setting) {
- shell->_pulses = 0;
- widget_set_cursor(shell->window, GDK_LEFT_PTR);
+ shell->_pulses = 0;
+ widget_set_cursor(shell->window, GDK_LEFT_PTR);
} else {
- widget_set_cursor(shell->window, GDK_WATCH);
+ widget_set_cursor(shell->window, GDK_WATCH);
}
gtk_widget_set_sensitive(shell->hpaned, setting);
@@ -250,11 +248,10 @@ shell_view_set_enabled(gboolean setting)
shell_action_set_enabled("ReportAction", setting);
}
-void
-shell_status_set_enabled(gboolean setting)
+void shell_status_set_enabled(gboolean setting)
{
if (!params.gui_running)
- return;
+ return;
if (setting)
gtk_widget_show(shell->progress);
@@ -264,22 +261,21 @@ shell_status_set_enabled(gboolean setting)
}
}
-void
-shell_do_reload(void)
+void shell_do_reload(void)
{
if (!params.gui_running)
- return;
+ return;
shell_action_set_enabled("RefreshAction", FALSE);
shell_action_set_enabled("CopyAction", FALSE);
shell_action_set_enabled("ReportAction", FALSE);
if (shell->selected && shell->selected->reloadfunc) {
- GtkTreeSelection *ts;
-
- ts = gtk_tree_view_get_selection(GTK_TREE_VIEW(shell->tree->view));
+ GtkTreeSelection *ts;
+
+ ts = gtk_tree_view_get_selection(GTK_TREE_VIEW(shell->tree->view));
shell_status_set_enabled(TRUE);
-
+
shell->selected->reloadfunc(shell->selected->number);
module_selected(ts, NULL);
}
@@ -289,36 +285,33 @@ shell_do_reload(void)
shell_action_set_enabled("ReportAction", TRUE);
}
-void
-shell_status_update(const gchar *message)
+void shell_status_update(const gchar * message)
{
if (params.gui_running) {
- gtk_label_set_markup(GTK_LABEL(shell->status), message);
- gtk_progress_bar_pulse(GTK_PROGRESS_BAR(shell->progress));
- while (gtk_events_pending())
+ gtk_label_set_markup(GTK_LABEL(shell->status), message);
+ gtk_progress_bar_pulse(GTK_PROGRESS_BAR(shell->progress));
+ while (gtk_events_pending())
gtk_main_iteration();
} else {
- fprintf(stderr, "\033[2K\033[40;37;1m %s\033[0m\r", message);
+ fprintf(stderr, "\033[2K\033[40;37;1m %s\033[0m\r", message);
}
}
-static void
-destroy_me(void)
+static void destroy_me(void)
{
gtk_main_quit();
exit(0);
}
-static void
-create_window(void)
+static void create_window(void)
{
- GtkWidget *vbox, *hbox;
+ GtkWidget *vbox, *hbox;
shell = g_new0(Shell, 1);
shell->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_icon(GTK_WINDOW(shell->window),
- icon_cache_get_pixbuf("logo.png"));
+ icon_cache_get_pixbuf("logo.png"));
gtk_window_set_title(GTK_WINDOW(shell->window), "System Information");
gtk_widget_set_size_request(shell->window, 600, 400);
g_signal_connect(G_OBJECT(shell->window), "destroy", destroy_me, NULL);
@@ -327,7 +320,7 @@ create_window(void)
gtk_widget_show(vbox);
gtk_container_add(GTK_CONTAINER(shell->window), vbox);
shell->vbox = vbox;
-
+
menu_init(shell);
hbox = gtk_hbox_new(FALSE, 5);
@@ -355,7 +348,7 @@ create_window(void)
shell->notebook = gtk_notebook_new();
gtk_paned_add2(GTK_PANED(shell->vpaned), shell->notebook);
-
+
gtk_widget_show(shell->window);
while (gtk_events_pending())
gtk_main_iteration();
@@ -363,85 +356,79 @@ create_window(void)
static void view_menu_select_entry(gpointer data, gpointer data2)
{
- GtkTreeSelection *ts;
- GtkTreePath *path;
- GtkTreeIter *iter = (GtkTreeIter*) data2;
+ GtkTreeSelection *ts;
+ GtkTreePath *path;
+ GtkTreeIter *iter = (GtkTreeIter *) data2;
ts = gtk_tree_view_get_selection(GTK_TREE_VIEW(shell->tree->view));
path = gtk_tree_model_get_path(shell->tree->model, iter);
-
+
gtk_tree_selection_select_path(ts, path);
- gtk_tree_view_set_cursor(GTK_TREE_VIEW(shell->tree->view), path, NULL, FALSE);
+ gtk_tree_view_set_cursor(GTK_TREE_VIEW(shell->tree->view), path, NULL,
+ FALSE);
gtk_tree_path_free(path);
}
-static void
-add_module_to_view_menu(gchar *name, GdkPixbuf *pixbuf)
+static void add_module_to_view_menu(gchar * name, GdkPixbuf * pixbuf)
{
stock_icon_register_pixbuf(pixbuf, name);
GtkActionEntry entries[] = {
- { name, /* name */
- name, /* stockid */
- name, /* label */
- NULL, /* accelerator */
- NULL, /* tooltip */
- NULL, /* callback */
- },
+ {name, /* name */
+ name, /* stockid */
+ name, /* label */
+ NULL, /* accelerator */
+ NULL, /* tooltip */
+ NULL, /* callback */
+ },
};
-
+
gtk_action_group_add_actions(shell->action_group, entries, 1, NULL);
gtk_ui_manager_add_ui(shell->ui_manager,
- gtk_ui_manager_new_merge_id(shell->ui_manager),
- "/menubar/ViewMenu/LastSep",
- name,
- name,
- GTK_UI_MANAGER_MENU,
- TRUE);
+ gtk_ui_manager_new_merge_id(shell->ui_manager),
+ "/menubar/ViewMenu/LastSep",
+ name, name, GTK_UI_MANAGER_MENU, TRUE);
}
static void
-add_module_entry_to_view_menu(gchar *module, gchar *name, GdkPixbuf *pixbuf, GtkTreeIter *iter)
+add_module_entry_to_view_menu(gchar * module, gchar * name,
+ GdkPixbuf * pixbuf, GtkTreeIter * iter)
{
stock_icon_register_pixbuf(pixbuf, name);
GtkActionEntry entries[] = {
- { name, /* name */
- name, /* stockid */
- name, /* label */
- NULL, /* accelerator */
- NULL, /* tooltip */
- (GCallback)view_menu_select_entry,/* callback */
- },
+ {name, /* name */
+ name, /* stockid */
+ name, /* label */
+ NULL, /* accelerator */
+ NULL, /* tooltip */
+ (GCallback) view_menu_select_entry, /* callback */
+ },
};
-
+
gtk_action_group_add_actions(shell->action_group, entries, 1, iter);
gtk_ui_manager_add_ui(shell->ui_manager,
- gtk_ui_manager_new_merge_id(shell->ui_manager),
- g_strdup_printf("/menubar/ViewMenu/%s", module),
- name,
- name,
- GTK_UI_MANAGER_AUTO,
- FALSE);
+ gtk_ui_manager_new_merge_id(shell->ui_manager),
+ g_strdup_printf("/menubar/ViewMenu/%s", module),
+ name, name, GTK_UI_MANAGER_AUTO, FALSE);
}
-static void
-add_modules_to_gui(gpointer data, gpointer user_data)
+static void add_modules_to_gui(gpointer data, gpointer user_data)
{
- ShellTree *shelltree = (ShellTree *) user_data;
- ShellModule *module = (ShellModule *) data;
- GtkTreeStore *store = GTK_TREE_STORE(shelltree->model);
- GtkTreeIter parent;
+ ShellTree *shelltree = (ShellTree *) user_data;
+ ShellModule *module = (ShellModule *) data;
+ GtkTreeStore *store = GTK_TREE_STORE(shelltree->model);
+ GtkTreeIter parent;
gtk_tree_store_append(store, &parent, NULL);
gtk_tree_store_set(store, &parent, TREE_COL_NAME, module->name,
- TREE_COL_DATA, NULL,
- TREE_COL_SEL, FALSE, -1);
+ TREE_COL_DATA, NULL, TREE_COL_SEL, FALSE, -1);
if (module->icon) {
- gtk_tree_store_set(store, &parent, TREE_COL_PBUF, module->icon, -1);
+ gtk_tree_store_set(store, &parent, TREE_COL_PBUF, module->icon,
+ -1);
}
add_module_to_view_menu(module->name, module->icon);
@@ -457,15 +444,16 @@ add_modules_to_gui(gpointer data, gpointer user_data)
gtk_tree_store_append(store, &child, &parent);
gtk_tree_store_set(store, &child, TREE_COL_NAME, entry->name,
TREE_COL_DATA, entry,
- TREE_COL_SEL, FALSE, -1);
+ TREE_COL_SEL, FALSE, -1);
if (entry->icon) {
gtk_tree_store_set(store, &child, TREE_COL_PBUF,
entry->icon, -1);
}
-
- add_module_entry_to_view_menu(module->name, entry->name, entry->icon,
- gtk_tree_iter_copy(&child));
+
+ add_module_entry_to_view_menu(module->name, entry->name,
+ entry->icon,
+ gtk_tree_iter_copy(&child));
shell_status_pulse();
}
@@ -473,8 +461,7 @@ add_modules_to_gui(gpointer data, gpointer user_data)
}
}
-void
-shell_init(GSList *modules)
+void shell_init(GSList * modules)
{
if (shell) {
g_error("Shell already created");
@@ -498,9 +485,10 @@ shell_init(GSList *modules)
SHELL_PACK_RESIZE, SHELL_PACK_SHRINK);
gtk_notebook_append_page(GTK_NOTEBOOK(shell->notebook),
- shell->moreinfo->scroll, NULL);
+ shell->moreinfo->scroll, NULL);
gtk_notebook_append_page(GTK_NOTEBOOK(shell->notebook),
- load_graph_get_framed(shell->loadgraph), NULL);
+ load_graph_get_framed(shell->loadgraph),
+ NULL);
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(shell->notebook), FALSE);
gtk_notebook_set_show_border(GTK_NOTEBOOK(shell->notebook), FALSE);
@@ -520,48 +508,49 @@ shell_init(GSList *modules)
load_graph_configure_expose(shell->loadgraph);
gtk_widget_hide(shell->notebook);
-
+
shell_action_set_enabled("RefreshAction", FALSE);
shell_action_set_enabled("CopyAction", FALSE);
shell_action_set_active("SidePaneAction", TRUE);
shell_action_set_active("ToolbarAction", TRUE);
}
-static gboolean
-update_field(gpointer data)
+static gboolean update_field(gpointer data)
{
- ShellFieldUpdate *fu = (ShellFieldUpdate *) data;
-
+ ShellFieldUpdate *fu = (ShellFieldUpdate *) data;
+
/* if the entry is still selected, update it */
if (fu->entry->selected && fu->entry->fieldfunc) {
- gchar *value = fu->entry->fieldfunc(fu->field_name);
- GtkTreeIter *iter = g_hash_table_lookup(update_tbl, fu->field_name);
-
- /* this function is also used to feed the load graph when ViewType =
- SHELL_VIEW_LOAD_GRAPH */
- if (fu->loadgraph && shell->view_type == SHELL_VIEW_LOAD_GRAPH) {
- GtkTreeSelection *ts;
-
- ts = gtk_tree_view_get_selection(GTK_TREE_VIEW
- (shell->info->view));
-
- if (iter && gtk_tree_selection_iter_is_selected(ts, iter)) {
- load_graph_update(shell->loadgraph, atoi(value));
- }
-
- g_free(value);
-
- return TRUE;
- }
-
- if (iter) {
- GtkTreeStore *store = GTK_TREE_STORE(shell->info->model);
-
- gtk_tree_store_set(store, iter, INFO_TREE_COL_VALUE, g_strchug(value), -1);
- g_free(value);
-
- return TRUE;
- }
+ gchar *value = fu->entry->fieldfunc(fu->field_name);
+ GtkTreeIter *iter =
+ g_hash_table_lookup(update_tbl, fu->field_name);
+
+ /* this function is also used to feed the load graph when ViewType =
+ SHELL_VIEW_LOAD_GRAPH */
+ if (fu->loadgraph && shell->view_type == SHELL_VIEW_LOAD_GRAPH) {
+ GtkTreeSelection *ts;
+
+ ts = gtk_tree_view_get_selection(GTK_TREE_VIEW
+ (shell->info->view));
+
+ if (iter && gtk_tree_selection_iter_is_selected(ts, iter)) {
+ load_graph_update(shell->loadgraph, atoi(value));
+ }
+
+ g_free(value);
+
+ return TRUE;
+ }
+
+ if (iter) {
+ GtkTreeStore *store = GTK_TREE_STORE(shell->info->model);
+
+ gtk_tree_store_set(store, iter, INFO_TREE_COL_VALUE,
+ g_strchug(value), -1);
+ g_free(value);
+
+ return TRUE;
+ }
}
/* otherwise, cleanup and destroy the timeout */
@@ -571,21 +560,20 @@ update_field(gpointer data)
return FALSE;
}
-static gboolean
-reload_section(gpointer data)
+static gboolean reload_section(gpointer data)
{
- ShellModuleEntry *entry = (ShellModuleEntry *) data;
+ ShellModuleEntry *entry = (ShellModuleEntry *) data;
/* if the entry is still selected, update it */
if (entry->selected && entry->reloadfunc) {
- GtkTreePath *path = NULL;
- GtkTreeSelection *ts;
- GtkTreeIter iter;
+ GtkTreePath *path = NULL;
+ GtkTreeSelection *ts;
+ GtkTreeIter iter;
/* gets the current selected path */
- ts = gtk_tree_view_get_selection(GTK_TREE_VIEW
- (shell->info->view));
- if (gtk_tree_selection_get_selected(ts, &shell->info->model, &iter))
+ ts = gtk_tree_view_get_selection(GTK_TREE_VIEW(shell->info->view));
+ if (gtk_tree_selection_get_selected
+ (ts, &shell->info->model, &iter))
path = gtk_tree_model_get_path(shell->info->model, &iter);
/* update the information, clear the treeview and populate it again */
@@ -604,49 +592,77 @@ reload_section(gpointer data)
return FALSE;
}
-static void
-set_view_type(ShellViewType viewtype)
+gint
+info_tree_compare_val_func(GtkTreeModel * model,
+ GtkTreeIter * a,
+ GtkTreeIter * b,
+ gpointer userdata)
{
+ gint ret = 0;
+ gchar *col1, *col2;
+ gtk_tree_model_get(model, a, INFO_TREE_COL_VALUE, &col1, -1);
+ gtk_tree_model_get(model, b, INFO_TREE_COL_VALUE, &col2, -1);
+
+ if (col1 == NULL || col2 == NULL) {
+ if (col1 == NULL && col2 == NULL)
+ return 0;
+
+ ret = (col1 == NULL) ? -1 : 1;
+ } else {
+ ret = atof(col1) < atof(col2);
+ }
+
+ g_free(col1);
+ g_free(col2);
+
+ return ret;
+}
+
+static void set_view_type(ShellViewType viewtype)
+{
+ /* reset to the default model */
+ gtk_tree_view_set_model(GTK_TREE_VIEW(shell->info->view),
+ shell->info->model);
+
+ /* reset to the default view columns */
gtk_tree_view_column_set_visible(shell->info->col_progress, FALSE);
gtk_tree_view_column_set_visible(shell->info->col_value, TRUE);
+ /* turn off the rules hint */
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(shell->info->view), FALSE);
if (viewtype == shell->view_type)
- return;
+ return;
+
+ if (viewtype < SHELL_VIEW_NORMAL || viewtype >= SHELL_VIEW_N_VIEWS)
+ viewtype = SHELL_VIEW_NORMAL;
+
+ shell->view_type = viewtype;
switch (viewtype) {
default:
case SHELL_VIEW_NORMAL:
gtk_widget_hide(shell->notebook);
-
- shell->view_type = SHELL_VIEW_NORMAL;
break;
case SHELL_VIEW_DUAL:
gtk_notebook_set_page(GTK_NOTEBOOK(shell->notebook), 0);
gtk_widget_show(shell->notebook);
-
- shell->view_type = SHELL_VIEW_DUAL;
break;
case SHELL_VIEW_LOAD_GRAPH:
gtk_notebook_set_page(GTK_NOTEBOOK(shell->notebook), 1);
gtk_widget_show(shell->notebook);
load_graph_clear(shell->loadgraph);
-
- gtk_paned_set_position(GTK_PANED(shell->vpaned),
- shell->hpaned->allocation.height -
- shell->loadgraph->height - 16);
- shell->view_type = SHELL_VIEW_LOAD_GRAPH;
+ gtk_paned_set_position(GTK_PANED(shell->vpaned),
+ shell->hpaned->allocation.height -
+ shell->loadgraph->height - 16);
break;
case SHELL_VIEW_PROGRESS:
- gtk_tree_view_column_set_visible(shell->info->col_progress, TRUE);
- gtk_tree_view_column_set_visible(shell->info->col_value, FALSE);
+ gtk_tree_view_column_set_visible(shell->info->col_progress, TRUE);
+ gtk_tree_view_column_set_visible(shell->info->col_value, FALSE);
gtk_widget_hide(shell->notebook);
-
- shell->view_type = SHELL_VIEW_PROGRESS;
- break;
+ break;
}
}
@@ -655,9 +671,9 @@ group_handle_special(GKeyFile * key_file, ShellModuleEntry * entry,
gchar * group, gchar ** keys)
{
if (g_str_equal(group, "$ShellParam$")) {
- gint i;
-
- for (i = 0; keys[i]; i++) {
+ gint i;
+
+ for (i = 0; keys[i]; i++) {
gchar *key = keys[i];
if (g_str_has_prefix(key, "UpdateInterval")) {
@@ -680,13 +696,14 @@ group_handle_special(GKeyFile * key_file, ShellModuleEntry * entry,
fu->field_name = g_strdup(strchr(key, '$') + 1);
fu->entry = entry;
fu->loadgraph = TRUE;
-
+
g_timeout_add(ms, update_field, fu);
- } else if (g_str_equal(key, "LoadGraphMaxValue")) {
- gint max_value;
-
- max_value = g_key_file_get_integer(key_file, group, key, NULL);
- load_graph_set_max(shell->loadgraph, max_value);
+ } else if (g_str_equal(key, "LoadGraphMaxValue")) {
+ gint max_value;
+
+ max_value =
+ g_key_file_get_integer(key_file, group, key, NULL);
+ load_graph_set_max(shell->loadgraph, max_value);
} else if (g_str_equal(key, "ReloadInterval")) {
gint ms;
@@ -695,25 +712,29 @@ group_handle_special(GKeyFile * key_file, ShellModuleEntry * entry,
g_timeout_add(ms, reload_section, entry);
} else if (g_str_equal(key, "ViewType")) {
set_view_type(g_key_file_get_integer(key_file, group,
- key, NULL));
+ key, NULL));
} else if (g_str_has_prefix(key, "Icon")) {
- GtkTreeIter *iter = g_hash_table_lookup(update_tbl,
- strchr(key, '$') + 1);
-
- if (iter) {
- gchar *file = g_key_file_get_value(key_file, group, key, NULL);
- gtk_tree_store_set(GTK_TREE_STORE(shell->info->model),
- iter, INFO_TREE_COL_PBUF,
- icon_cache_get_pixbuf_at_size(file, 24, 24),
- -1);
- g_free(file);
- }
- } else if (g_str_equal(key, "Zebra")) {
- gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(shell->info->view),
- g_key_file_get_boolean(key_file,
- group,
- key, NULL));
- }
+ GtkTreeIter *iter = g_hash_table_lookup(update_tbl,
+ strchr(key,
+ '$') + 1);
+
+ if (iter) {
+ gchar *file =
+ g_key_file_get_value(key_file, group, key, NULL);
+ gtk_tree_store_set(GTK_TREE_STORE(shell->info->model),
+ iter, INFO_TREE_COL_PBUF,
+ icon_cache_get_pixbuf_at_size(file,
+ 24,
+ 24),
+ -1);
+ g_free(file);
+ }
+ } else if (g_str_equal(key, "Zebra")) {
+ gtk_tree_view_set_rules_hint(GTK_TREE_VIEW
+ (shell->info->view),
+ g_key_file_get_boolean
+ (key_file, group, key, NULL));
+ }
}
} else {
g_warning("Unknown parameter group '%s'", group);
@@ -724,17 +745,17 @@ static void
group_handle_normal(GKeyFile * key_file, ShellModuleEntry * entry,
gchar * group, gchar ** keys, gsize ngroups)
{
- GtkTreeIter parent;
- GtkTreeStore *store = GTK_TREE_STORE(shell->info->model);
- gchar *tmp = g_strdup(group);
- gint i;
+ GtkTreeIter parent;
+ GtkTreeStore *store = GTK_TREE_STORE(shell->info->model);
+ gchar *tmp = g_strdup(group);
+ gint i;
if (ngroups > 1) {
- gtk_tree_store_append(store, &parent, NULL);
+ gtk_tree_store_append(store, &parent, NULL);
- strend(tmp, '#');
- gtk_tree_store_set(store, &parent, INFO_TREE_COL_NAME, tmp, -1);
- g_free(tmp);
+ strend(tmp, '#');
+ gtk_tree_store_set(store, &parent, INFO_TREE_COL_NAME, tmp, -1);
+ g_free(tmp);
}
for (i = 0; keys[i]; i++) {
@@ -744,37 +765,39 @@ group_handle_normal(GKeyFile * key_file, ShellModuleEntry * entry,
value = g_key_file_get_value(key_file, group, key, NULL);
if (g_str_equal(value, "...") && entry->fieldfunc) {
- g_free(value);
- value = entry->fieldfunc(key);
+ g_free(value);
+ value = entry->fieldfunc(key);
}
-
- if (g_utf8_validate(key, -1, NULL) && g_utf8_validate(value, -1, NULL)) {
- if (ngroups == 1) {
- gtk_tree_store_append(store, &child, NULL);
- } else {
- gtk_tree_store_append(store, &child, &parent);
- }
- gtk_tree_store_set(store, &child, INFO_TREE_COL_VALUE, g_strchug(value), -1);
- strend(key, '#');
+ if (g_utf8_validate(key, -1, NULL)
+ && g_utf8_validate(value, -1, NULL)) {
+ if (ngroups == 1) {
+ gtk_tree_store_append(store, &child, NULL);
+ } else {
+ gtk_tree_store_append(store, &child, &parent);
+ }
+ gtk_tree_store_set(store, &child, INFO_TREE_COL_VALUE,
+ g_strchug(value), -1);
- if (*key == '$') {
- gchar **tmp;
+ strend(key, '#');
- tmp = g_strsplit(++key, "$", 0);
+ if (*key == '$') {
+ gchar **tmp;
- gtk_tree_store_set(store, &child, INFO_TREE_COL_NAME, tmp[1],
- INFO_TREE_COL_DATA, tmp[0], -1);
+ tmp = g_strsplit(++key, "$", 0);
- g_strfreev(tmp);
- } else {
- gtk_tree_store_set(store, &child, INFO_TREE_COL_NAME, key,
- INFO_TREE_COL_DATA, NULL, -1);
- }
+ gtk_tree_store_set(store, &child, INFO_TREE_COL_NAME,
+ tmp[1], INFO_TREE_COL_DATA, tmp[0], -1);
+
+ g_strfreev(tmp);
+ } else {
+ gtk_tree_store_set(store, &child, INFO_TREE_COL_NAME, key,
+ INFO_TREE_COL_DATA, NULL, -1);
+ }
+
+ g_hash_table_insert(update_tbl, g_strdup(key),
+ gtk_tree_iter_copy(&child));
- g_hash_table_insert(update_tbl, g_strdup(key),
- gtk_tree_iter_copy(&child));
-
}
g_free(value);
@@ -784,9 +807,9 @@ group_handle_normal(GKeyFile * key_file, ShellModuleEntry * entry,
static void
moreinfo_handle_normal(GKeyFile * key_file, gchar * group, gchar ** keys)
{
- GtkTreeIter parent;
- GtkTreeStore *store = GTK_TREE_STORE(shell->moreinfo->model);
- gint i;
+ GtkTreeIter parent;
+ GtkTreeStore *store = GTK_TREE_STORE(shell->moreinfo->model);
+ gint i;
gtk_tree_store_append(store, &parent, NULL);
gtk_tree_store_set(store, &parent, INFO_TREE_COL_NAME, group, -1);
@@ -794,88 +817,96 @@ moreinfo_handle_normal(GKeyFile * key_file, gchar * group, gchar ** keys)
for (i = 0; keys[i]; i++) {
gchar *key = keys[i];
GtkTreeIter child;
- gchar *value;
-
- value = g_key_file_get_value(key_file, group, key, NULL);
+ gchar *value;
- if (g_utf8_validate(key, -1, NULL) && g_utf8_validate(value, -1, NULL)) {
- strend(key, '#');
-
- gtk_tree_store_append(store, &child, &parent);
- gtk_tree_store_set(store, &child, INFO_TREE_COL_VALUE, g_strchug(value),
- INFO_TREE_COL_NAME, key, -1);
+ value = g_key_file_get_value(key_file, group, key, NULL);
+
+ if (g_utf8_validate(key, -1, NULL)
+ && g_utf8_validate(value, -1, NULL)) {
+ strend(key, '#');
+
+ gtk_tree_store_append(store, &child, &parent);
+ gtk_tree_store_set(store, &child, INFO_TREE_COL_VALUE,
+ g_strchug(value), INFO_TREE_COL_NAME, key,
+ -1);
}
-
- g_free(value);
+
+ g_free(value);
}
}
/* 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()
+static void update_progress()
{
GtkTreeModel *model = shell->info->model;
GtkTreeStore *store = GTK_TREE_STORE(model);
- GtkTreeIter iter, fiter;
- gchar *tmp;
- gdouble maxv = 0, maxp = 0, cur;
-
+ GtkTreeIter iter, fiter;
+ gchar *tmp;
+ gdouble maxv = 0, maxp = 0, cur;
+
gtk_tree_model_get_iter_first(model, &fiter);
/* finds the maximum value */
iter = fiter;
do {
- gtk_tree_model_get(model, &iter, INFO_TREE_COL_VALUE, &tmp, -1);
-
- cur = atof(tmp);
- maxv = MAX(maxv, cur);
+ gtk_tree_model_get(model, &iter, INFO_TREE_COL_VALUE, &tmp, -1);
+
+ cur = atof(tmp);
+ maxv = MAX(maxv, cur);
- g_free(tmp);
+ g_free(tmp);
} while (gtk_tree_model_iter_next(model, &iter));
-
+
/* calculates the relative percentage and finds the maximum percentage */
iter = fiter;
do {
- gtk_tree_model_get(model, &iter, INFO_TREE_COL_VALUE, &tmp, -1);
-
- cur = 100 - 100 * atof(tmp) / maxv;
- maxp = MAX(cur, maxp);
-
- g_free(tmp);
+ gtk_tree_model_get(model, &iter, INFO_TREE_COL_VALUE, &tmp, -1);
+
+ cur = 100 - 100 * atof(tmp) / maxv;
+ maxp = MAX(cur, maxp);
+
+ g_free(tmp);
} while (gtk_tree_model_iter_next(model, &iter));
/* fix the maximum relative percentage */
iter = fiter;
do {
- gtk_tree_model_get(model, &iter, INFO_TREE_COL_VALUE, &tmp, -1);
-
- cur = 100 - 100 * atof(tmp) / maxv + 100 - maxp;
-
- gtk_tree_store_set(store, &iter,
- INFO_TREE_COL_PROGRESS, cur, -1);
- g_free(tmp);
+ gtk_tree_model_get(model, &iter, INFO_TREE_COL_VALUE, &tmp, -1);
+
+ cur = 100 - 100 * atof(tmp) / maxv + 100 - maxp;
+
+ gtk_tree_store_set(store, &iter, INFO_TREE_COL_PROGRESS, cur, -1);
+ g_free(tmp);
} while (gtk_tree_model_iter_next(model, &iter));
-
- /* FIXME: sort by the best result */
+
+ /* now sort everything up. that wasn't as hard as i thought :) */
+ GtkTreeSortable *sortable = GTK_TREE_SORTABLE(shell->info->model);
+
+ gtk_tree_sortable_set_sort_func(sortable, INFO_TREE_COL_VALUE,
+ info_tree_compare_val_func, 0, NULL);
+ gtk_tree_sortable_set_sort_column_id(sortable,
+ INFO_TREE_COL_VALUE,
+ GTK_SORT_DESCENDING);
+ gtk_tree_view_set_model(GTK_TREE_VIEW(shell->info->view),
+ GTK_TREE_MODEL(sortable));
}
static void
module_selected_show_info(ShellModuleEntry * entry, gboolean reload)
{
- GKeyFile *key_file = g_key_file_new();
- gchar *key_data;
- gchar **groups;
- GtkTreeStore *store;
- gint i;
- gsize ngroups;
+ GKeyFile *key_file = g_key_file_new();
+ gchar *key_data;
+ gchar **groups;
+ GtkTreeStore *store;
+ gint i;
+ gsize ngroups;
if (entry->func) {
- key_data = entry->func(entry->number);
+ key_data = entry->func(entry->number);
} else {
- key_data = g_strdup("[Error]\n"
- "Invalid module=");
+ key_data = g_strdup("[Error]\n" "Invalid module=");
}
/* reset the view type to normal */
@@ -884,15 +915,18 @@ module_selected_show_info(ShellModuleEntry * entry, gboolean reload)
/* recreate the iter hash table only if we're not reloading the module section */
if (!reload) {
if (update_tbl != NULL) {
- g_hash_table_foreach_remove(update_tbl, (GHRFunc) gtk_true, NULL);
+ g_hash_table_foreach_remove(update_tbl, (GHRFunc) gtk_true,
+ NULL);
}
- update_tbl = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+ update_tbl =
+ g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
}
store = GTK_TREE_STORE(shell->info->model);
gtk_tree_store_clear(store);
- g_key_file_load_from_data(key_file, key_data, strlen(key_data), 0, NULL);
+ g_key_file_load_from_data(key_file, key_data, strlen(key_data), 0,
+ NULL);
groups = g_key_file_get_groups(key_file, &ngroups);
for (i = 0; groups[i]; i++) {
@@ -905,11 +939,11 @@ module_selected_show_info(ShellModuleEntry * entry, gboolean reload)
group_handle_normal(key_file, entry, group, keys, ngroups - 1);
}
}
-
+
gtk_tree_view_expand_all(GTK_TREE_VIEW(shell->info->view));
-
+
if (shell->view_type == SHELL_VIEW_PROGRESS) {
- update_progress();
+ update_progress();
}
g_strfreev(groups);
@@ -917,10 +951,9 @@ module_selected_show_info(ShellModuleEntry * entry, gboolean reload)
g_free(key_data);
}
-static void
-info_selected_show_extra(gchar * data)
+static void info_selected_show_extra(gchar * data)
{
- GtkTreeStore *store;
+ GtkTreeStore *store;
store = GTK_TREE_STORE(shell->moreinfo->model);
gtk_tree_store_clear(store);
@@ -940,13 +973,13 @@ info_selected_show_extra(gchar * data)
for (i = 0; groups[i]; i++) {
gchar *group = groups[i];
- gchar **keys = g_key_file_get_keys(key_file, group, NULL, NULL);
+ gchar **keys =
+ g_key_file_get_keys(key_file, group, NULL, NULL);
- moreinfo_handle_normal(key_file, group, keys);
+ moreinfo_handle_normal(key_file, group, keys);
}
- gtk_tree_view_expand_all(GTK_TREE_VIEW
- (shell->moreinfo->view));
+ gtk_tree_view_expand_all(GTK_TREE_VIEW(shell->moreinfo->view));
g_strfreev(groups);
g_key_file_free(key_file);
@@ -954,19 +987,18 @@ info_selected_show_extra(gchar * data)
}
}
-static void
-module_selected(GtkTreeSelection * ts, gpointer data)
+static void module_selected(GtkTreeSelection * ts, gpointer data)
{
- ShellTree *shelltree = shell->tree;
- GtkTreeModel *model = GTK_TREE_MODEL(shelltree->model);
- GtkTreeIter parent;
- ShellModuleEntry *entry;
- static ShellModuleEntry *current = NULL;
- static gboolean updating = FALSE;
-
+ ShellTree *shelltree = shell->tree;
+ GtkTreeModel *model = GTK_TREE_MODEL(shelltree->model);
+ GtkTreeIter parent;
+ ShellModuleEntry *entry;
+ static ShellModuleEntry *current = NULL;
+ static gboolean updating = FALSE;
+
if (updating)
- return;
-
+ return;
+
updating = TRUE;
/* Gets the currently selected item on the left-side TreeView; if there is no
@@ -986,67 +1018,76 @@ module_selected(GtkTreeSelection * ts, gpointer data)
shell_status_update("Updating...");
entry->selected = TRUE;
- shell->selected = entry;
+ shell->selected = entry;
module_selected_show_info(entry, FALSE);
info_selected_show_extra(NULL); /* clears the more info store */
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);
-
+ 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);
+
shell_status_update("Done.");
shell_status_set_enabled(FALSE);
-
- gchar *tmp = g_strdup_printf("%s - System Information", entry->name);
+
+ gchar *tmp =
+ g_strdup_printf("%s - System Information", entry->name);
gtk_window_set_title(GTK_WINDOW(shell->window), tmp);
g_free(tmp);
-
- shell_action_set_enabled("RefreshAction", entry->reloadfunc ? TRUE : FALSE);
- shell_action_set_enabled("CopyAction", entry->reloadfunc ? TRUE : FALSE);
+
+ shell_action_set_enabled("RefreshAction",
+ entry->reloadfunc ? TRUE : FALSE);
+ shell_action_set_enabled("CopyAction",
+ entry->reloadfunc ? TRUE : FALSE);
} else {
- gtk_window_set_title(GTK_WINDOW(shell->window), "System Information");
- shell_action_set_enabled("RefreshAction", FALSE);
- shell_action_set_enabled("CopyAction", FALSE);
+ gtk_window_set_title(GTK_WINDOW(shell->window),
+ "System Information");
+ shell_action_set_enabled("RefreshAction", FALSE);
+ shell_action_set_enabled("CopyAction", FALSE);
gtk_tree_store_clear(GTK_TREE_STORE(shell->info->model));
set_view_type(SHELL_VIEW_NORMAL);
}
-
+
current = entry;
updating = FALSE;
}
-static void
-info_selected(GtkTreeSelection * ts, gpointer data)
+static void info_selected(GtkTreeSelection * ts, gpointer data)
{
- ShellInfoTree *info = (ShellInfoTree *) data;
- GtkTreeModel *model = GTK_TREE_MODEL(info->model);
- GtkTreeIter parent;
- gchar *datacol;
+ ShellInfoTree *info = (ShellInfoTree *) data;
+ GtkTreeModel *model = GTK_TREE_MODEL(info->model);
+ GtkTreeIter parent;
+ gchar *datacol;
if (!gtk_tree_selection_get_selected(ts, &model, &parent))
return;
gtk_tree_model_get(model, &parent, INFO_TREE_COL_DATA, &datacol, -1);
info_selected_show_extra(datacol);
- gtk_tree_view_columns_autosize(GTK_TREE_VIEW
- (shell->moreinfo->view));
+ gtk_tree_view_columns_autosize(GTK_TREE_VIEW(shell->moreinfo->view));
}
-static ShellInfoTree *
-info_tree_new(gboolean extra)
+static ShellInfoTree *info_tree_new(gboolean extra)
{
- ShellInfoTree *info;
- GtkWidget *treeview, *scroll;
- GtkTreeModel *model;
- GtkTreeStore *store;
- GtkTreeViewColumn *column;
- GtkCellRenderer *cr_text, *cr_pbuf, *cr_progress;
-
+ ShellInfoTree *info;
+ GtkWidget *treeview, *scroll;
+ GtkTreeModel *model;
+ GtkTreeStore *store;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *cr_text, *cr_pbuf, *cr_progress;
+
info = g_new0(ShellInfoTree, 1);
scroll = gtk_scrolled_window_new(NULL, NULL);
@@ -1056,9 +1097,9 @@ info_tree_new(gboolean extra)
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- store = gtk_tree_store_new(INFO_TREE_NCOL, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, GDK_TYPE_PIXBUF,
- G_TYPE_FLOAT);
+ store =
+ gtk_tree_store_new(INFO_TREE_NCOL, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_FLOAT);
model = GTK_TREE_MODEL(store);
treeview = gtk_tree_view_new_with_model(model);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
@@ -1075,7 +1116,7 @@ info_tree_new(gboolean extra)
gtk_tree_view_column_pack_start(column, cr_text, FALSE);
gtk_tree_view_column_add_attribute(column, cr_text, "markup",
INFO_TREE_COL_NAME);
-
+
info->col_value = column = gtk_tree_view_column_new();
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
@@ -1094,7 +1135,7 @@ info_tree_new(gboolean extra)
gtk_tree_view_column_add_attribute(column, cr_progress, "text",
INFO_TREE_COL_VALUE);
gtk_tree_view_column_set_visible(column, FALSE);
-
+
if (!extra) {
GtkTreeSelection *sel;
@@ -1114,16 +1155,15 @@ info_tree_new(gboolean extra)
return info;
}
-static ShellTree *
-tree_new()
+static ShellTree *tree_new()
{
- ShellTree *shelltree;
- GtkWidget *treeview, *scroll;
- GtkTreeModel *model;
- GtkTreeStore *store;
- GtkCellRenderer *cr_text, *cr_pbuf;
- GtkTreeViewColumn *column;
- GtkTreeSelection *sel;
+ ShellTree *shelltree;
+ GtkWidget *treeview, *scroll;
+ GtkTreeModel *model;
+ GtkTreeStore *store;
+ GtkCellRenderer *cr_text, *cr_pbuf;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *sel;
shelltree = g_new0(ShellTree, 1);
diff --git a/hardinfo2/shell.h b/hardinfo2/shell.h
index b9ba7aa8..c5508422 100644
--- a/hardinfo2/shell.h
+++ b/hardinfo2/shell.h
@@ -40,6 +40,7 @@ typedef enum {
SHELL_VIEW_DUAL,
SHELL_VIEW_LOAD_GRAPH,
SHELL_VIEW_PROGRESS,
+ SHELL_VIEW_N_VIEWS
} ShellViewType;
typedef enum {