debug : simple working area access
This commit is contained in:
parent
310340a17e
commit
4cc6bda354
|
@ -133,6 +133,7 @@ void ui_model_loading(GObject *source_object,
|
||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
GemGraphClientWindow *self);
|
GemGraphClientWindow *self);
|
||||||
|
|
||||||
|
void ui_debug_model_loading (GemGraphClientWindow *self, const char *file);
|
||||||
//
|
//
|
||||||
// General events
|
// General events
|
||||||
//
|
//
|
||||||
|
|
|
@ -71,7 +71,10 @@ static void gem_graph_client_application_activate(GApplication *app)
|
||||||
"application", app,
|
"application", app,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
// Launch with sidebar off
|
||||||
|
ui_toggle_sidebar();
|
||||||
ui_set_stack(HOME_MODE);
|
ui_set_stack(HOME_MODE);
|
||||||
|
ui_debug_model_loading(window, "data/models/dimers random walk.xml");
|
||||||
|
|
||||||
gtk_window_present(window);
|
gtk_window_present(window);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <libgen.h>
|
||||||
|
|
||||||
#include "../../include/base.h"
|
#include "../../include/base.h"
|
||||||
#include "../../include/graphics.h"
|
#include "../../include/graphics.h"
|
||||||
|
@ -325,7 +326,7 @@ void ui_model_loading(GObject *source_object,
|
||||||
size_t length = 0;
|
size_t length = 0;
|
||||||
|
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
char *basename = g_file_get_basename(file);
|
char *basenamestr = g_file_get_basename(file);
|
||||||
|
|
||||||
// Gives you the contents of the file as a byte array, or
|
// Gives you the contents of the file as a byte array, or
|
||||||
// set the error argument
|
// set the error argument
|
||||||
|
@ -343,14 +344,14 @@ void ui_model_loading(GObject *source_object,
|
||||||
error->message);
|
error->message);
|
||||||
ui_send_internal_notification("Unable to open file !");
|
ui_send_internal_notification("Unable to open file !");
|
||||||
g_free(error);
|
g_free(error);
|
||||||
g_free(basename);
|
g_free(basenamestr);
|
||||||
g_free(content);
|
g_free(content);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model_init(content, length, basename) == false) {
|
if (model_init(content, length, basenamestr) == false) {
|
||||||
ui_send_internal_notification("Error while loading the model");
|
ui_send_internal_notification("Error while loading the model");
|
||||||
g_free(basename);
|
g_free(basenamestr);
|
||||||
g_free(content);
|
g_free(content);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -363,10 +364,43 @@ void ui_model_loading(GObject *source_object,
|
||||||
ui_enable_action("togglesidebar");
|
ui_enable_action("togglesidebar");
|
||||||
ui_set_stack(RUN_MODE);
|
ui_set_stack(RUN_MODE);
|
||||||
|
|
||||||
g_free(basename);
|
g_free(basenamestr);
|
||||||
g_free(content);
|
g_free(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ui_debug_model_loading (GemGraphClientWindow *self, const char *file)
|
||||||
|
{
|
||||||
|
char *content = NULL;
|
||||||
|
size_t length = 0;
|
||||||
|
char *basenamestr = basename(file);
|
||||||
|
|
||||||
|
content = read_file (file);
|
||||||
|
length = strlen (content);
|
||||||
|
|
||||||
|
/* // In case of error, print a warning to the standard error output */
|
||||||
|
/* if (error != NULL) { */
|
||||||
|
/* g_printerr("Unable to open “%s”: %s\n", */
|
||||||
|
/* g_file_peek_path(file), */
|
||||||
|
/* error->message); */
|
||||||
|
/* ui_send_internal_notification("Unable to open file !"); */
|
||||||
|
/* return; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
if (model_init(content, length, basenamestr) == false) {
|
||||||
|
ui_send_internal_notification("Error while loading the model");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_enable_action("closefile");
|
||||||
|
ui_enable_action("savefile");
|
||||||
|
ui_enable_action("runmode");
|
||||||
|
ui_enable_action("editmode");
|
||||||
|
ui_enable_action("presentmode");
|
||||||
|
ui_enable_action("togglesidebar");
|
||||||
|
ui_set_stack(RUN_MODE);
|
||||||
|
ui_toggle_sidebar();
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -123,9 +123,6 @@ static void gem_graph_client_window_init(GemGraphClientWindow *self)
|
||||||
{
|
{
|
||||||
gtk_widget_init_template(GTK_WIDGET(self));
|
gtk_widget_init_template(GTK_WIDGET(self));
|
||||||
window = self;
|
window = self;
|
||||||
|
|
||||||
// Launch with sidebar off
|
|
||||||
ui_toggle_sidebar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
Loading…
Reference in New Issue