Insert quick fix, that prevents starting multiple instances in GUI mode the same time

This commit is contained in:
Mario Hüttel 2019-03-13 22:54:52 +01:00
parent 6a78e0df15
commit 178ef2d5b2
1 changed files with 32 additions and 26 deletions

6
main.c
View File

@ -64,12 +64,18 @@ const static GActionEntry app_actions[] = {
static void gapp_activate(GApplication *app, gpointer user_data)
{
GtkWindow *main_window;
static int activated = 0;
struct application_data * const appdata = (struct application_data *)user_data;
if (!activated) {
activated = 1;
main_window = create_main_window();
appdata->main_window = main_window;
gtk_application_add_window(GTK_APPLICATION(app), main_window);
gtk_widget_show(GTK_WIDGET(main_window));
} else {
fprintf(stderr, "Only one instance of the GUI can be started at the same time, for now.\nThis will probably be fixed in later releases.");
}
}
static int start_gui(int argc, char **argv)