Insert quick fix, that prevents starting multiple instances in GUI mode the same time
This commit is contained in:
parent
6a78e0df15
commit
178ef2d5b2
6
main.c
6
main.c
@ -64,12 +64,18 @@ const static GActionEntry app_actions[] = {
|
|||||||
static void gapp_activate(GApplication *app, gpointer user_data)
|
static void gapp_activate(GApplication *app, gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkWindow *main_window;
|
GtkWindow *main_window;
|
||||||
|
static int activated = 0;
|
||||||
struct application_data * const appdata = (struct application_data *)user_data;
|
struct application_data * const appdata = (struct application_data *)user_data;
|
||||||
|
|
||||||
|
if (!activated) {
|
||||||
|
activated = 1;
|
||||||
main_window = create_main_window();
|
main_window = create_main_window();
|
||||||
appdata->main_window = main_window;
|
appdata->main_window = main_window;
|
||||||
gtk_application_add_window(GTK_APPLICATION(app), main_window);
|
gtk_application_add_window(GTK_APPLICATION(app), main_window);
|
||||||
gtk_widget_show(GTK_WIDGET(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)
|
static int start_gui(int argc, char **argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user