aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro Augusto Fogolin Pereira <leandro@zorg.(none)>2009-02-08 10:06:30 -0200
committerLeandro Augusto Fogolin Pereira <leandro@zorg.(none)>2009-02-08 10:06:30 -0200
commit444dca3f3d7e4b035e23d55cde33338d33f912ce (patch)
treec94cc6b3d0fb05c9c944291a8048134bcc72e199
parentb09158b2cb9e98669a95fbb58763882d36fcd446 (diff)
Cleanups
-rw-r--r--hardinfo2/Makefile.in22
-rw-r--r--hardinfo2/TODO2
-rw-r--r--hardinfo2/shell.c6
-rw-r--r--hardinfo2/stack.c78
-rw-r--r--hardinfo2/stack.h27
5 files changed, 118 insertions, 17 deletions
diff --git a/hardinfo2/Makefile.in b/hardinfo2/Makefile.in
index b970ffc8..9ec4c197 100644
--- a/hardinfo2/Makefile.in
+++ b/hardinfo2/Makefile.in
@@ -1,14 +1,14 @@
CCFLAGS = -fPIC -pipe -Wall -g
CFLAGS = $(GTK_CFLAGS) $(SOUP_CFLAGS) -I.
-CCC = $(CC) $(ARCHOPTS) -g
-CCCSLOW = $(CC) -O0 -g
+CC = gcc $(ARCHOPTS) -g
+CCSLOW = gcc -O0 -g
# ----------------------------------------------------------------------------
OBJECTS = hardinfo.o shell.o util.o iconcache.o loadgraph.o \
menu.o stock.o callbacks.o expr.o report.o binreloc.o \
- vendor.o socket.o syncmanager.o
+ vendor.o socket.o syncmanager.o stack.o
BENCHMARK_OBJECTS = fbench.o sha1.o blowfish.o md5.o nqueens.o
MODULES = computer.so devices.so benchmark.so network.so
@@ -16,34 +16,34 @@ MODULES = computer.so devices.so benchmark.so network.so
all: $(OBJECTS) $(MODULES) hardinfo
hardinfo:
- $(CCC) $(CCFLAGS) -o hardinfo -Wl,-export-dynamic $(OBJECTS) $(GTK_LIBS) \
+ $(CC) $(CCFLAGS) -o hardinfo -Wl,-export-dynamic $(OBJECTS) $(GTK_LIBS) \
$(SOUP_LIBS)
md5.o:
- $(CCCSLOW) $(CCFLAGS) $(CFLAGS) -c md5.c -o $@
+ $(CCSLOW) $(CCFLAGS) $(CFLAGS) -c md5.c -o $@
blowfish.o:
- $(CCCSLOW) $(CCFLAGS) $(CFLAGS) -c blowfish.c -o $@
+ $(CCSLOW) $(CCFLAGS) $(CFLAGS) -c blowfish.c -o $@
sha1.o:
- $(CCCSLOW) $(CCFLAGS) $(CFLAGS) -c sha1.c -o $@
+ $(CCSLOW) $(CCFLAGS) $(CFLAGS) -c sha1.c -o $@
fbench.o:
- $(CCCSLOW) $(CCFLAGS) $(CFLAGS) -c fbench.c -o $@
+ $(CCSLOW) $(CCFLAGS) $(CFLAGS) -c fbench.c -o $@
nqueens.o:
- $(CCCSLOW) $(CCFLAGS) $(CFLAGS) -c nqueens.c -o $@
+ $(CCSLOW) $(CCFLAGS) $(CFLAGS) -c nqueens.c -o $@
benchmark.so: benchmark.c
@echo "--- Module: $< ($@)"
make $(BENCHMARK_OBJECTS)
- $(CCCSLOW) $(CCFLAGS) $(CFLAGS) -o $@ -shared $< $(BENCHMARK_OBJECTS) \
+ $(CCSLOW) $(CCFLAGS) $(CFLAGS) -o $@ -shared $< $(BENCHMARK_OBJECTS) \
$(GTK_FLAGS) $(GTK_LIBS)
ln -sf ../$@ modules
%.so: %.c
@echo "--- Module: $< ($@)"
- $(CCC) $(CCFLAGS) $(CFLAGS) -o $@ -shared $< $(GTK_FLAGS) $(GTK_LIBS)
+ $(CC) $(CCFLAGS) $(CFLAGS) -o $@ -shared $< $(GTK_FLAGS) $(GTK_LIBS)
ln -sf ../$@ modules
clean:
diff --git a/hardinfo2/TODO b/hardinfo2/TODO
index 548f4782..e92870cd 100644
--- a/hardinfo2/TODO
+++ b/hardinfo2/TODO
@@ -12,9 +12,7 @@
o Disk
o Phoronix?
* Change current benchmarks
- o Remove CPU Zlib
o Remove CPU Fibonacci
- * Add CPU N-Queens
* Add CPU Rubik Cube solver? :P
- More information
diff --git a/hardinfo2/shell.c b/hardinfo2/shell.c
index 420d690e..bbe14dbb 100644
--- a/hardinfo2/shell.c
+++ b/hardinfo2/shell.c
@@ -674,7 +674,7 @@ static gboolean reload_section(gpointer data)
/* if there was a selection, reselect it */
if (path) {
gtk_tree_selection_select_path(shell->info->selection, path);
- gtk_tree_view_set_cursor(GTK_TREE_VIEW(shell->tree->view), path, NULL,
+ gtk_tree_view_set_cursor(GTK_TREE_VIEW(shell->info->view), path, NULL,
FALSE);
gtk_tree_path_free(path);
}
@@ -738,9 +738,6 @@ static void set_view_type(ShellViewType viewtype)
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 column headers */
- gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(shell->info->view), FALSE);
-
/* turn off the rules hint */
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(shell->info->view), FALSE);
@@ -751,6 +748,7 @@ static void set_view_type(ShellViewType viewtype)
default:
case SHELL_VIEW_NORMAL:
gtk_widget_hide(shell->notebook);
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(shell->info->view), FALSE);
break;
case SHELL_VIEW_DUAL:
gtk_notebook_set_page(GTK_NOTEBOOK(shell->notebook), 0);
diff --git a/hardinfo2/stack.c b/hardinfo2/stack.c
new file mode 100644
index 00000000..02a7bea6
--- /dev/null
+++ b/hardinfo2/stack.c
@@ -0,0 +1,78 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "stack.h"
+
+Stack*
+stack_new(void)
+{
+ Stack *stack;
+
+ stack = g_new0(Stack, 1);
+ stack->_stack = NULL;
+
+ return stack;
+}
+
+void
+stack_free(Stack *stack)
+{
+ g_return_if_fail(stack);
+
+ g_slist_free(stack->_stack);
+ g_free(stack);
+}
+
+gboolean
+stack_is_empty(Stack *stack)
+{
+ g_return_val_if_fail(stack, TRUE);
+
+ return stack->_stack == NULL;
+}
+
+void
+stack_push(Stack *stack, gpointer data)
+{
+ g_return_if_fail(stack);
+
+ stack->_stack = g_slist_prepend(stack->_stack, data);
+}
+
+gpointer
+stack_pop(Stack *stack)
+{
+ GSList *element;
+ gpointer data = NULL;
+
+ if (G_LIKELY(stack && stack->_stack)) {
+ element = stack->_stack;
+ stack->_stack = element->next;
+
+ data = element->data;
+ g_slist_free_1(element);
+ }
+
+ return data;
+}
+
+gpointer
+stack_peek(Stack *stack)
+{
+ return (G_LIKELY(stack && stack->_stack)) ? stack->_stack->data : NULL;
+}
diff --git a/hardinfo2/stack.h b/hardinfo2/stack.h
new file mode 100644
index 00000000..e706de2e
--- /dev/null
+++ b/hardinfo2/stack.h
@@ -0,0 +1,27 @@
+/*
+ * Simple Pascal Compiler
+ * Stack
+ *
+ * Copyright (c) 2007-2008 Leandro A. F. Pereira <leandro@hardinfo.org>
+ */
+#ifndef __STACK_H__
+#define __STACK_H__
+
+#include <glib.h>
+
+typedef struct _Stack Stack;
+
+struct _Stack {
+ GSList *_stack;
+};
+
+
+Stack *stack_new(void);
+void stack_free(Stack *stack);
+
+gboolean stack_is_empty(Stack *stack);
+void stack_push(Stack *stack, gpointer data);
+gpointer stack_pop(Stack *stack);
+gpointer stack_peek(Stack *stack);
+
+#endif /* __STACK_H__ */