Signed-off-by: Jens Axboe <axboe@kernel.dk>
};
static void gfio_update_thread_status(struct gui_entry *ge, char *status_message, double perc);
};
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);
+static void gfio_update_thread_status_all(struct gui *ui, char *status_message, double perc);
static void report_error(GError *error);
static struct graph *setup_iops_graph(void)
static void report_error(GError *error);
static struct graph *setup_iops_graph(void)
static void gfio_text_op(struct fio_client *client, struct fio_net_cmd *cmd)
{
struct cmd_text_pdu *p = (struct cmd_text_pdu *) cmd->payload;
static void gfio_text_op(struct fio_client *client, struct fio_net_cmd *cmd)
{
struct cmd_text_pdu *p = (struct cmd_text_pdu *) cmd->payload;
- struct gui *ui = &main_ui;
+ struct gfio_client *gc = client->client_data;
+ struct gui_entry *ge = gc->ge;
+ struct gui *ui = ge->ui;
GtkTreeIter iter;
struct tm *tm;
time_t sec;
GtkTreeIter iter;
struct tm *tm;
time_t sec;
sprintf(dst, " - %s", eta_str);
}
sprintf(dst, " - %s", eta_str);
}
- gfio_update_thread_status_all(output, perc);
+ gfio_update_thread_status_all(ui, output, perc);
strncpy(message, status_message, sizeof(message) - 1);
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ge->thread_status_pb), m);
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ge->thread_status_pb), perc / 100.0);
strncpy(message, status_message, sizeof(message) - 1);
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ge->thread_status_pb), m);
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ge->thread_status_pb), perc / 100.0);
- gtk_widget_queue_draw(main_ui.window);
+ gtk_widget_queue_draw(ge->ui->window);
-static void gfio_update_thread_status_all(char *status_message, double perc)
+static void gfio_update_thread_status_all(struct gui *ui, char *status_message,
+ double perc)
- struct gui *ui = &main_ui;
static char message[100];
const char *m = message;
static char message[100];
const char *m = message;
static void quit_clicked(__attribute__((unused)) GtkWidget *widget,
__attribute__((unused)) gpointer data)
{
static void quit_clicked(__attribute__((unused)) GtkWidget *widget,
__attribute__((unused)) gpointer data)
{
+ struct gui *ui = (struct gui *) data;
+
+ gfio_quit(ui);
}
static void *job_thread(void *arg)
}
static void *job_thread(void *arg)
-static void gfio_start_server(void)
+static void gfio_start_server(struct gui *ui)
- struct gui *ui = &main_ui;
-
if (!gfio_server_running) {
gfio_server_running = 1;
pthread_create(&ui->server_t, NULL, server_thread, NULL);
if (!gfio_server_running) {
gfio_server_running = 1;
pthread_create(&ui->server_t, NULL, server_thread, NULL);
* Return the 'ge' corresponding to the tab. If the active tab is the
* main tab, open a new tab.
*/
* Return the 'ge' corresponding to the tab. If the active tab is the
* main tab, open a new tab.
*/
-static struct gui_entry *get_ge_from_page(gint cur_page, int *created)
+static struct gui_entry *get_ge_from_page(struct gui *ui, gint cur_page,
+ int *created)
{
struct flist_head *entry;
struct gui_entry *ge;
{
struct flist_head *entry;
struct gui_entry *ge;
if (created)
*created = 0;
if (created)
*created = 0;
- flist_for_each(entry, &main_ui.list) {
+ flist_for_each(entry, &ui->list) {
ge = flist_entry(entry, struct gui_entry, list);
if (ge->page_num == cur_page)
return ge;
ge = flist_entry(entry, struct gui_entry, list);
if (ge->page_num == cur_page)
return ge;
*/
cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(ui->notebook));
if (cur_page)
*/
cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(ui->notebook));
if (cur_page)
- return get_ge_from_page(cur_page, NULL);
+ return get_ge_from_page(ui, cur_page, NULL);
* current tab already has a client.
*/
cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(ui->notebook));
* current tab already has a client.
*/
cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(ui->notebook));
- ge = get_ge_from_page(cur_page, &ge_is_new);
+ ge = get_ge_from_page(ui, cur_page, &ge_is_new);
if (ge->client) {
ge = get_new_ge_with_tab("Untitled");
ge_is_new = 1;
if (ge->client) {
ge = get_new_ge_with_tab("Untitled");
ge_is_new = 1;
if (!ret) {
if (server_start)
if (!ret) {
if (server_start)
} else {
if (ge_is_new)
gtk_widget_destroy(ge->vbox);
} else {
if (ge_is_new)
gtk_widget_destroy(ge->vbox);
{
GtkWidget *dialog, *frame, *box, **buttons, *vbox, *font;
GtkWidget *hbox, *spin, *entry, *spin_int;
{
GtkWidget *dialog, *frame, *box, **buttons, *vbox, *font;
GtkWidget *hbox, *spin, *entry, *spin_int;
+ struct gui *ui = (struct gui *) data;
int i;
dialog = gtk_dialog_new_with_buttons("Preferences",
int i;
dialog = gtk_dialog_new_with_buttons("Preferences",
- GTK_WINDOW(main_ui.window),
+ GTK_WINDOW(ui->window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
}
set_job_menu_visible(ui, 1);
}
set_job_menu_visible(ui, 1);
- ge = get_ge_from_page(page, NULL);
+ ge = get_ge_from_page(ui, page, NULL);
if (ge)
update_button_states(ui, ge);
if (ge)
update_button_states(ui, ge);
}
static void drag_and_drop_received(GtkWidget *widget, GdkDragContext *ctx,
}
static void drag_and_drop_received(GtkWidget *widget, GdkDragContext *ctx,
- gint x, gint y, GtkSelectionData *data,
- guint info, guint time)
+ gint x, gint y, GtkSelectionData *seldata,
+ guint info, guint time, gpointer *data)
- struct gui *ui = &main_ui;
+ struct gui *ui = (struct gui *) data;
gchar **uris;
GtkWidget *source;
int i;
gchar **uris;
GtkWidget *source;
int i;
- uris = gtk_selection_data_get_uris(data);
+ uris = gtk_selection_data_get_uris(seldata);
if (!uris) {
gtk_drag_finish(ctx, FALSE, FALSE, time);
return;
if (!uris) {
gtk_drag_finish(ctx, FALSE, FALSE, time);
return;
gtk_window_set_title(GTK_WINDOW(ui->window), "fio");
gtk_window_set_default_size(GTK_WINDOW(ui->window), 1024, 768);
gtk_window_set_title(GTK_WINDOW(ui->window), "fio");
gtk_window_set_default_size(GTK_WINDOW(ui->window), 1024, 768);
- g_signal_connect(ui->window, "delete-event", G_CALLBACK(quit_clicked), NULL);
- g_signal_connect(ui->window, "destroy", G_CALLBACK(quit_clicked), NULL);
+ g_signal_connect(ui->window, "delete-event", G_CALLBACK(quit_clicked), ui);
+ g_signal_connect(ui->window, "destroy", G_CALLBACK(quit_clicked), ui);
ui->vbox = gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(ui->window), ui->vbox);
ui->vbox = gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(ui->window), ui->vbox);