diff options
Diffstat (limited to 'hardinfo2')
| -rw-r--r-- | hardinfo2/benchmark.c | 5 | ||||
| -rw-r--r-- | hardinfo2/computer.c | 22 | ||||
| -rw-r--r-- | hardinfo2/shell.c | 76 | ||||
| -rw-r--r-- | hardinfo2/shell.h | 4 | 
4 files changed, 93 insertions, 14 deletions
| diff --git a/hardinfo2/benchmark.c b/hardinfo2/benchmark.c index d8f07d13..1c756202 100644 --- a/hardinfo2/benchmark.c +++ b/hardinfo2/benchmark.c @@ -184,6 +184,11 @@ static gchar *__benchmark_include_results(gdouble result,  			   "Zebra=1\n"  			   "OrderType=%d\n"  			   "ViewType=3\n" +			   "ColumnTitle$Extra1=CPU Clock\n" +			   "ColumnTitle$Extra2=Memory\n" +			   "ColumnTitle$Progress=Results\n" +			   "ColumnTitle$TextValue=CPU\n" +			   "ShowColumnHeaders=true\n"  			   "[%s]\n"  			   "<big><b>This Machine</b></big>=%.3f\n"  			   "%s", order_type, benchmark, result, results); diff --git a/hardinfo2/computer.c b/hardinfo2/computer.c index 0ae68be3..84e87610 100644 --- a/hardinfo2/computer.c +++ b/hardinfo2/computer.c @@ -282,18 +282,30 @@ gchar *callback_modules()  {      return g_strdup_printf("[Loaded Modules]\n"  			   "%s" -			   "[$ShellParam$]\n" "ViewType=1", module_list); +			   "[$ShellParam$]\n" +			   "ViewType=1\n" +			   "ColumnTitle$TextValue=Name\n" +			   "ColumnTitle$Value=Full Name\n" +			   "ShowColumnHeaders=true\n", module_list);  }  gchar *callback_boots()  { -    return g_strdup(computer->os->boots); +    return g_strdup_printf("[$ShellParam$]\n" +			   "ColumnTitle$TextValue=Date\n" +			   "ColumnTitle$Value=Kernel Version\n" +			   "ShowColumnHeaders=true\n" +			   "\n" +			   "%s", computer->os->boots);  }  gchar *callback_locales()  {      return g_strdup_printf("[$ShellParam$]\n"  			   "ViewType=1\n" +			   "ColumnTitle$TextValue=Language Code\n" +			   "ColumnTitle$Value=Name\n" +			   "ShowColumnHeaders=true\n"  			   "[Available Languages]\n"  			   "%s", computer->os->languages);  } @@ -303,6 +315,9 @@ gchar *callback_fs()      return g_strdup_printf("[$ShellParam$]\n"  			   "ViewType=1\n"  			   "ReloadInterval=5000\n" +			   "ColumnTitle$TextValue=Mount Point\n" +			   "ColumnTitle$Value=Total / Free Space\n" +			   "ShowColumnHeaders=true\n"  			   "[Mounted File Systems]\n%s\n", fs_list);  } @@ -347,6 +362,9 @@ gchar *callback_network()  			   "[$ShellParam$]\n"  			   "ReloadInterval=3000\n"  			   "ViewType=1\n" +			   "ColumnTitle$TextValue=Device\n" +			   "ColumnTitle$Value=Statistics\n" +			   "ShowColumnHeaders=true\n"  			   "%s", network_interfaces, network_icons);  } diff --git a/hardinfo2/shell.c b/hardinfo2/shell.c index cf3b776d..7487bf13 100644 --- a/hardinfo2/shell.c +++ b/hardinfo2/shell.c @@ -724,7 +724,12 @@ static void set_view_type(ShellViewType viewtype)      gtk_tree_view_set_model(GTK_TREE_VIEW(shell->info->view),  			    shell->info->model); +    /* reset to the default header values */ +    gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(shell->info->view), FALSE); +      /* reset to the default view columns */ +    gtk_tree_view_column_set_visible(shell->info->col_extra1, FALSE); +    gtk_tree_view_column_set_visible(shell->info->col_extra2, FALSE);      gtk_tree_view_column_set_visible(shell->info->col_progress, FALSE);      gtk_tree_view_column_set_visible(shell->info->col_value, TRUE); @@ -811,6 +816,34 @@ group_handle_special(GKeyFile * key_file, ShellModuleEntry * entry,  		ms = g_key_file_get_integer(key_file, group, key, NULL);  		g_timeout_add(ms, rescan_section, entry); +	    } else if (g_str_equal(key, "ShowColumnHeaders")) { +		gboolean show; + +		show = g_key_file_get_boolean(key_file, group, key, NULL); + +		gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(shell->info->view), show); +	    } else if (g_str_has_prefix(key, "ColumnTitle")) { +                GtkTreeViewColumn *column; +		gchar *value, *title = strchr(key, '$') + 1; + +                value = g_key_file_get_value(key_file, group, key, NULL); + +                if (g_str_equal(title, "Extra1")) { +			column = shell->info->col_extra1; +                } else if (g_str_equal(title, "Extra2")) { +			column = shell->info->col_extra2; +                } else if (g_str_equal(title, "Value")) { +			column = shell->info->col_value; +                } else if (g_str_equal(title, "TextValue")) { +			column = shell->info->col_textvalue; +                } else if (g_str_equal(title, "Progress")) { +			column = shell->info->col_progress; +                } + +                gtk_tree_view_column_set_title(column, value); +                gtk_tree_view_column_set_visible(column, TRUE); + +                g_free(value);  	    } else if (g_str_equal(key, "OrderType")) {  		shell->_order_type = g_key_file_get_integer(key_file,  							    group, @@ -1249,12 +1282,26 @@ static ShellInfoTree *info_tree_new(gboolean extra)      store =  	gtk_tree_store_new(INFO_TREE_NCOL, G_TYPE_STRING, G_TYPE_STRING, -			   G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_FLOAT); +			   G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_FLOAT, +                           G_TYPE_STRING, G_TYPE_STRING);      model = GTK_TREE_MODEL(store);      treeview = gtk_tree_view_new_with_model(model);      gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE); -    column = gtk_tree_view_column_new(); +    info->col_progress = column = gtk_tree_view_column_new(); +    gtk_tree_view_column_set_visible(column, FALSE); +    gtk_tree_view_column_set_min_width(column, 240); +    gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); + +    cr_progress = gtk_cell_renderer_progress_new(); +    gtk_tree_view_column_pack_start(column, cr_progress, TRUE); +    gtk_tree_view_column_add_attribute(column, cr_progress, "value", +				       INFO_TREE_COL_PROGRESS); +    gtk_tree_view_column_add_attribute(column, cr_progress, "text", +				       INFO_TREE_COL_VALUE); +    gtk_tree_view_column_set_visible(column, FALSE); + +    info->col_textvalue = column = gtk_tree_view_column_new();      gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);      cr_pbuf = gtk_cell_renderer_pixbuf_new(); @@ -1267,24 +1314,31 @@ static ShellInfoTree *info_tree_new(gboolean extra)      gtk_tree_view_column_add_attribute(column, cr_text, "markup",  				       INFO_TREE_COL_NAME); -    info->col_value = column = gtk_tree_view_column_new(); +    info->col_extra1 = column = gtk_tree_view_column_new(); +    gtk_tree_view_column_set_visible(column, FALSE);      gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);      cr_text = gtk_cell_renderer_text_new();      gtk_tree_view_column_pack_start(column, cr_text, FALSE);      gtk_tree_view_column_add_attribute(column, cr_text, "markup", -				       INFO_TREE_COL_VALUE); +				       INFO_TREE_COL_EXTRA1); -    info->col_progress = column = gtk_tree_view_column_new(); +    info->col_extra2 = column = gtk_tree_view_column_new(); +    gtk_tree_view_column_set_visible(column, FALSE);      gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); -    cr_progress = gtk_cell_renderer_progress_new(); -    gtk_tree_view_column_pack_start(column, cr_progress, TRUE); -    gtk_tree_view_column_add_attribute(column, cr_progress, "value", -				       INFO_TREE_COL_PROGRESS); -    gtk_tree_view_column_add_attribute(column, cr_progress, "text", +    cr_text = gtk_cell_renderer_text_new(); +    gtk_tree_view_column_pack_start(column, cr_text, FALSE); +    gtk_tree_view_column_add_attribute(column, cr_text, "markup", +				       INFO_TREE_COL_EXTRA2); + +    info->col_value = column = gtk_tree_view_column_new(); +    gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); + +    cr_text = gtk_cell_renderer_text_new(); +    gtk_tree_view_column_pack_start(column, cr_text, FALSE); +    gtk_tree_view_column_add_attribute(column, cr_text, "markup",  				       INFO_TREE_COL_VALUE); -    gtk_tree_view_column_set_visible(column, FALSE);      sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); diff --git a/hardinfo2/shell.h b/hardinfo2/shell.h index f8f3afed..2fa2f968 100644 --- a/hardinfo2/shell.h +++ b/hardinfo2/shell.h @@ -65,6 +65,8 @@ typedef enum {      INFO_TREE_COL_DATA,      INFO_TREE_COL_PBUF,      INFO_TREE_COL_PROGRESS, +    INFO_TREE_COL_EXTRA1, +    INFO_TREE_COL_EXTRA2,      INFO_TREE_NCOL  } ShellInfoTreeColumns; @@ -104,7 +106,7 @@ struct _ShellInfoTree {      GtkTreeModel        *model;      GtkTreeSelection	*selection; -    GtkTreeViewColumn	 *col_progress, *col_value; +    GtkTreeViewColumn	 *col_progress, *col_value, *col_extra1, *col_extra2, *col_textvalue;  };  struct _ShellNote { | 
