static void gfio_update_thread_status(struct gui_entry *ge, char *status_message, double perc);
static void gfio_update_thread_status_all(char *status_message, double perc);
-void report_error(GError *error);
+static void report_error(GError *error);
static struct graph *setup_iops_graph(void)
{
g->bandwidth_graph = setup_bandwidth_graph();
}
-static void multitext_add_entry(struct multitext_widget *mt, const char *text)
-{
- mt->text = realloc(mt->text, (mt->max_text + 1) * sizeof(char *));
- mt->text[mt->max_text] = strdup(text);
- mt->max_text++;
-}
-
-static void multitext_set_entry(struct multitext_widget *mt, unsigned int index)
-{
- if (index >= mt->max_text)
- return;
- if (!mt->text || !mt->text[index])
- return;
-
- mt->cur_text = index;
- gtk_entry_set_text(GTK_ENTRY(mt->entry), mt->text[index]);
-}
-
-static void multitext_update_entry(struct multitext_widget *mt,
- unsigned int index, const char *text)
-{
- if (!mt->text)
- return;
-
- if (mt->text[index])
- free(mt->text[index]);
-
- mt->text[index] = strdup(text);
- if (mt->cur_text == index)
- gtk_entry_set_text(GTK_ENTRY(mt->entry), mt->text[index]);
-}
-
-static void multitext_free(struct multitext_widget *mt)
-{
- int i;
-
- gtk_entry_set_text(GTK_ENTRY(mt->entry), "");
-
- for (i = 0; i < mt->max_text; i++) {
- if (mt->text[i])
- free(mt->text[i]);
- }
-
- free(mt->text);
- mt->cur_text = -1;
- mt->max_text = 0;
-}
-
static void clear_ge_ui_info(struct gui_entry *ge)
{
gtk_label_set_text(GTK_LABEL(ge->probe.hostname), "");
update_button_states(ge->ui, ge);
}
-#define ALIGN_LEFT 1
-#define ALIGN_RIGHT 2
-#define INVISIBLE 4
-#define UNSORTABLE 8
-
-GtkTreeViewColumn *tree_view_column(GtkWidget *tree_view, int index, const char *title, unsigned int flags)
-{
- GtkCellRenderer *renderer;
- GtkTreeViewColumn *col;
- double xalign = 0.0; /* left as default */
- PangoAlignment align;
- gboolean visible;
-
- align = (flags & ALIGN_LEFT) ? PANGO_ALIGN_LEFT :
- (flags & ALIGN_RIGHT) ? PANGO_ALIGN_RIGHT :
- PANGO_ALIGN_CENTER;
- visible = !(flags & INVISIBLE);
-
- renderer = gtk_cell_renderer_text_new();
- col = gtk_tree_view_column_new();
-
- gtk_tree_view_column_set_title(col, title);
- if (!(flags & UNSORTABLE))
- gtk_tree_view_column_set_sort_column_id(col, index);
- gtk_tree_view_column_set_resizable(col, TRUE);
- gtk_tree_view_column_pack_start(col, renderer, TRUE);
- gtk_tree_view_column_add_attribute(col, renderer, "text", index);
- gtk_object_set(GTK_OBJECT(renderer), "alignment", align, NULL);
- switch (align) {
- case PANGO_ALIGN_LEFT:
- xalign = 0.0;
- break;
- case PANGO_ALIGN_CENTER:
- xalign = 0.5;
- break;
- case PANGO_ALIGN_RIGHT:
- xalign = 1.0;
- break;
- }
- gtk_cell_renderer_set_alignment(GTK_CELL_RENDERER(renderer), xalign, 0.5);
- gtk_tree_view_column_set_visible(col, visible);
- gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), col);
- return col;
-}
-
static void gfio_ui_setup_log(struct gui *ui)
{
GtkTreeSelection *selection;
}
}
-void report_error(GError *error)
+static void report_error(GError *error)
{
struct gui *ui = &main_ui;
#include <gtk/gtk.h>
+#include "ghelpers.h"
+
struct probe_widget {
GtkWidget *hostname;
GtkWidget *os;
GtkWidget *fio_ver;
};
-struct multitext_widget {
- GtkWidget *entry;
- char **text;
- unsigned int cur_text;
- unsigned int max_text;
-};
-
struct eta_widget {
GtkWidget *names;
struct multitext_widget iotype;
+#include <stdlib.h>
+#include <string.h>
#include <gtk/gtk.h>
+#include "ghelpers.h"
+
GtkWidget *new_combo_entry_in_frame(GtkWidget *box, const char *label)
{
GtkWidget *entry, *frame;
sprintf(tmp, "%u", val);
gtk_entry_set_text(GTK_ENTRY(entry), tmp);
}
+
+GtkTreeViewColumn *tree_view_column(GtkWidget *tree_view, int index, const char *title, unsigned int flags)
+{
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *col;
+ double xalign = 0.0; /* left as default */
+ PangoAlignment align;
+ gboolean visible;
+
+ align = (flags & ALIGN_LEFT) ? PANGO_ALIGN_LEFT :
+ (flags & ALIGN_RIGHT) ? PANGO_ALIGN_RIGHT :
+ PANGO_ALIGN_CENTER;
+ visible = !(flags & INVISIBLE);
+
+ renderer = gtk_cell_renderer_text_new();
+ col = gtk_tree_view_column_new();
+
+ gtk_tree_view_column_set_title(col, title);
+ if (!(flags & UNSORTABLE))
+ gtk_tree_view_column_set_sort_column_id(col, index);
+ gtk_tree_view_column_set_resizable(col, TRUE);
+ gtk_tree_view_column_pack_start(col, renderer, TRUE);
+ gtk_tree_view_column_add_attribute(col, renderer, "text", index);
+ gtk_object_set(GTK_OBJECT(renderer), "alignment", align, NULL);
+ switch (align) {
+ case PANGO_ALIGN_LEFT:
+ xalign = 0.0;
+ break;
+ case PANGO_ALIGN_CENTER:
+ xalign = 0.5;
+ break;
+ case PANGO_ALIGN_RIGHT:
+ xalign = 1.0;
+ break;
+ }
+ gtk_cell_renderer_set_alignment(GTK_CELL_RENDERER(renderer), xalign, 0.5);
+ gtk_tree_view_column_set_visible(col, visible);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), col);
+ return col;
+}
+
+void multitext_add_entry(struct multitext_widget *mt, const char *text)
+{
+ mt->text = realloc(mt->text, (mt->max_text + 1) * sizeof(char *));
+ mt->text[mt->max_text] = strdup(text);
+ mt->max_text++;
+}
+
+void multitext_set_entry(struct multitext_widget *mt, unsigned int index)
+{
+ if (index >= mt->max_text)
+ return;
+ if (!mt->text || !mt->text[index])
+ return;
+
+ mt->cur_text = index;
+ gtk_entry_set_text(GTK_ENTRY(mt->entry), mt->text[index]);
+}
+
+void multitext_update_entry(struct multitext_widget *mt, unsigned int index,
+ const char *text)
+{
+ if (!mt->text)
+ return;
+
+ if (mt->text[index])
+ free(mt->text[index]);
+
+ mt->text[index] = strdup(text);
+ if (mt->cur_text == index)
+ gtk_entry_set_text(GTK_ENTRY(mt->entry), mt->text[index]);
+}
+
+void multitext_free(struct multitext_widget *mt)
+{
+ int i;
+
+ gtk_entry_set_text(GTK_ENTRY(mt->entry), "");
+
+ for (i = 0; i < mt->max_text; i++) {
+ if (mt->text[i])
+ free(mt->text[i]);
+ }
+
+ free(mt->text);
+ mt->cur_text = -1;
+ mt->max_text = 0;
+}
void label_set_int_value(GtkWidget *entry, unsigned int val);
void entry_set_int_value(GtkWidget *entry, unsigned int val);
+
+struct multitext_widget {
+ GtkWidget *entry;
+ char **text;
+ unsigned int cur_text;
+ unsigned int max_text;
+};
+
+void multitext_add_entry(struct multitext_widget *mt, const char *text);
+void multitext_set_entry(struct multitext_widget *mt, unsigned int index);
+void multitext_update_entry(struct multitext_widget *mt, unsigned int index,
+ const char *text);
+void multitext_free(struct multitext_widget *mt);
+
+#define ALIGN_LEFT 1
+#define ALIGN_RIGHT 2
+#define INVISIBLE 4
+#define UNSORTABLE 8
+
+GtkTreeViewColumn *tree_view_column(GtkWidget *tree_view, int index, const char *title, unsigned int flags);
+
#endif