ui->connected = 0;
gtk_button_set_label(GTK_BUTTON(ui->button[CONNECT_BUTTON]), "Connect");
gtk_widget_set_sensitive(ui->button[START_JOB_BUTTON], 0);
- clear_ui_info(ui);
}
}
gdk_threads_enter();
gfio_set_connected(ui, 0);
+ clear_ui_info(ui);
sprintf(buf, "Client %s: timeout talking to server.\n", client->hostname);
} else {
fio_clients_terminate();
gfio_set_connected(ui, 0);
+ clear_ui_info(ui);
}
}
}
}
-static int get_connection_details(char **host, int *port, int *type)
+static int get_connection_details(char **host, int *port, int *type,
+ int *server_start)
{
GtkWidget *dialog, *box, *vbox, *hentry, *hbox, *frame, *pentry, *combo;
+ GtkWidget *button;
char *typeentry;
dialog = gtk_dialog_new_with_buttons("Connection details",
gtk_container_add(GTK_CONTAINER(hbox), combo);
+ frame = gtk_frame_new("Options");
+ gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5);
+ box = gtk_vbox_new(FALSE, 10);
+ gtk_container_add(GTK_CONTAINER(frame), box);
+
+ hbox = gtk_hbox_new(TRUE, 4);
+ gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0);
+
+ button = gtk_check_button_new_with_label("Auto-spawn fio backend");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), 1);
+ gtk_widget_set_tooltip_text(button, "When running fio locally, it is necessary to have the backend running on the same system. If this is checked, gfio will start the backend automatically for you if it isn't already running.");
+ gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 6);
+
gtk_widget_show_all(dialog);
if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_ACCEPT) {
*type = Fio_client_socket;
g_free(typeentry);
+ *server_start = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+
gtk_widget_destroy(dialog);
return 0;
}
GSList *filenames, *fn_glist;
GtkFileFilter *filter;
char *host;
- int port, type;
+ int port, type, server_start;
dialog = gtk_file_chooser_dialog_new("Open File",
GTK_WINDOW(ui.window),
gtk_widget_destroy(dialog);
- if (get_connection_details(&host, &port, &type))
+ if (get_connection_details(&host, &port, &type, &server_start))
goto err;
filenames = fn_glist;
gtk_widget_destroy(dialog);
}
+static void preferences(GtkWidget *w, gpointer data)
+{
+ GtkWidget *dialog, *frame, *box, **buttons;
+ int i;
+
+ dialog = gtk_dialog_new_with_buttons("Preferences",
+ GTK_WINDOW(ui.window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
+ NULL);
+
+ frame = gtk_frame_new("Debug");
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), frame, FALSE, FALSE, 5);
+ box = gtk_hbox_new(FALSE, 6);
+ gtk_container_add(GTK_CONTAINER(frame), box);
+
+ buttons = malloc(sizeof(GtkWidget *) * FD_DEBUG_MAX);
+
+ for (i = 0; i < FD_DEBUG_MAX; i++) {
+ buttons[i] = gtk_check_button_new_with_label(debug_levels[i].name);
+ gtk_box_pack_start(GTK_BOX(box), buttons[i], FALSE, FALSE, 6);
+ }
+
+ gtk_widget_show_all(dialog);
+
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_ACCEPT) {
+ gtk_widget_destroy(dialog);
+ return;
+ }
+
+ for (i = 0; i < FD_DEBUG_MAX; i++) {
+ int set;
+
+ set = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(buttons[i]));
+ if (set)
+ fio_debug |= (1UL << i);
+ }
+
+ gtk_widget_destroy(dialog);
+}
+
static void about_dialog(GtkWidget *w, gpointer data)
{
gtk_show_about_dialog(NULL,
}
static GtkActionEntry menu_items[] = {
- { "FileMenuAction", GTK_STOCK_FILE, "File", NULL, NULL, NULL},
- { "HelpMenuAction", GTK_STOCK_HELP, "Help", NULL, NULL, NULL},
- { "OpenFile", GTK_STOCK_OPEN, NULL, "<Control>O", NULL, G_CALLBACK(file_open) },
- { "SaveFile", GTK_STOCK_SAVE, NULL, "<Control>S", NULL, G_CALLBACK(file_save) },
- { "Quit", GTK_STOCK_QUIT, NULL, "<Control>Q", NULL, G_CALLBACK(quit_clicked) },
- { "About", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK(about_dialog) },
+ { "FileMenuAction", GTK_STOCK_FILE, "File", NULL, NULL, NULL},
+ { "HelpMenuAction", GTK_STOCK_HELP, "Help", NULL, NULL, NULL},
+ { "OpenFile", GTK_STOCK_OPEN, NULL, "<Control>O", NULL, G_CALLBACK(file_open) },
+ { "SaveFile", GTK_STOCK_SAVE, NULL, "<Control>S", NULL, G_CALLBACK(file_save) },
+ { "Preferences", GTK_STOCK_PREFERENCES, NULL, "<Control>p", NULL, G_CALLBACK(preferences) },
+ { "Quit", GTK_STOCK_QUIT, NULL, "<Control>Q", NULL, G_CALLBACK(quit_clicked) },
+ { "About", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK(about_dialog) },
};
static gint nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
<menuitem name=\"Open\" action=\"OpenFile\" /> \
<menuitem name=\"Save\" action=\"SaveFile\" /> \
<separator name=\"Separator\"/> \
+ <menuitem name=\"Preferences\" action=\"Preferences\" /> \
+ <separator name=\"Separator2\"/> \
<menuitem name=\"Quit\" action=\"Quit\" /> \
</menu> \
<menu name=\"Help\" action=\"HelpMenuAction\"> \
if (fio_init_options())
return 1;
- fio_debug = ~0UL;
init_ui(&argc, &argv, &ui);
gdk_threads_enter();