summaryrefslogtreecommitdiffstats
path: root/sw/linux/src/ui.c
diff options
context:
space:
mode:
authorleleraffa97@hotmail.it <leleraffa97@hotmail.it>2017-08-23 21:18:02 +0200
committerleleraffa97@hotmail.it <leleraffa97@hotmail.it>2017-08-23 21:18:02 +0200
commit3f92d0e29700fc2da45354a4cf3e3afe5c5245c2 (patch)
treecb6def68635ff2b4e4ab30c7e8fdbdf3e730bc05 /sw/linux/src/ui.c
parentFilesystem struct order (diff)
parentnew programmer interface for linux (diff)
downloadz80uPC-3f92d0e29700fc2da45354a4cf3e3afe5c5245c2.tar.gz
z80uPC-3f92d0e29700fc2da45354a4cf3e3afe5c5245c2.zip
Merge remote-tracking branch 'origin/naopross' into atlas
Diffstat (limited to 'sw/linux/src/ui.c')
-rw-r--r--sw/linux/src/ui.c90
1 files changed, 0 insertions, 90 deletions
diff --git a/sw/linux/src/ui.c b/sw/linux/src/ui.c
deleted file mode 100644
index b33aa04..0000000
--- a/sw/linux/src/ui.c
+++ /dev/null
@@ -1,90 +0,0 @@
-#include "ui.h"
-
-static bool ui_connected, ui_fileset;
-static GtkTextBuffer *ui_logbuf;
-static GtkBuilder *ui_builder;
-
-void ui_init(int *argc, char **argv[])
-{
- GtkWindow *window;
- GtkTextView *logview;
- GtkFileChooserButton *filechoosebtn;
- GtkButton *connectbtn, *flashbtn;
-
- /* set ui global variables */
- ui_connected = ui_fileset = false;
-
- /* start gtk */
- gtk_init(argc, argv);
-
- /* load glade gtk ui */
- ui_builder = gtk_builder_new();
- gtk_builder_add_from_file(ui_builder, "gbprog.ui", NULL);
-
- /* connect logger buffer (extern variable) */
- ui_logbuf = gtk_text_buffer_new(NULL);
- logview = GTK_TEXT_VIEW(gtk_builder_get_object(ui_builder, "logview"));
-
- gtk_text_view_set_buffer(logview, ui_logbuf);
-
- /* connect objects to function calls */
- // window
- window = GTK_WINDOW(gtk_builder_get_object(ui_builder, "window"));
- g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
-
- // connectbtn
- connectbtn = GTK_BUTTON(gtk_builder_get_object(ui_builder, "flashbtn"));
- g_signal_connect(connectbtn, "clicked",
- G_CALLBACK(ui_connect_clicked), NULL);
-
- // flashbtn
- flashbtn = GTK_BUTTON(gtk_builder_get_object(ui_builder, "flashbtn"));
- g_signal_connect(flashbtn, "clicked", G_CALLBACK(ui_flash_clicked), NULL);
-
- // file chooser
- filechoosebtn = GTK_FILE_CHOOSER_BUTTON(
- gtk_builder_get_object(ui_builder, "filechoosebtn"));
- g_signal_connect(filechoosebtn, "file-set", G_CALLBACK(ui_file_set), NULL);
-
- /* start gtk window */
- gtk_main();
-}
-
-void ui_log(const char *msg, char type)
-{
- GtkTextIter end;
- gchar typech[4] = "[ ] ";
-
- switch (type) {
- case 'm': typech[1] = '@'; break; // message
- case 'w': typech[1] = '#'; break; // warning
- case 'e': typech[1] = '!'; break; // error
- }
-
- gtk_text_buffer_get_end_iter(ui_logbuf, &end);
- gtk_text_buffer_insert(ui_logbuf, &end, typech, 4);
- gtk_text_buffer_get_end_iter(ui_logbuf, &end);
- gtk_text_buffer_insert(ui_logbuf, &end, (const gchar *) msg, strlen(msg));
-}
-
-void ui_file_set(GtkFileChooserButton *btn, gpointer user_data)
-{
- GtkEntry *filepath =
- GTK_ENTRY(gtk_builder_get_object(ui_builder, "filepath"));
-
- gtk_entry_set_text(filepath,
- gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(btn)));
-
- ui_log("File set\n", 'm');
- ui_fileset = true;
-}
-
-void ui_connect_clicked(void)
-{
-
-}
-
-void ui_flash_clicked(void)
-{
-
-}