Stop using gtk_main and gtk_main_quit

Replace these calls with direct use of GMainContext api.
This commit is contained in:
Matthias Clasen
2020-02-09 22:24:47 -05:00
parent c789711652
commit a6c5466900
121 changed files with 1198 additions and 292 deletions

View File

@@ -286,6 +286,17 @@ match_selected_cb (GtkEntryCompletion *completion,
return TRUE;
}
static void
quit_cb (GtkWidget *widget,
gpointer data)
{
gboolean *done = data;
*done = TRUE;
g_main_context_wakeup (NULL);
}
int
main (int argc, char *argv[])
{
@@ -295,11 +306,12 @@ main (int argc, char *argv[])
GtkEntryCompletion *completion;
GtkTreeModel *completion_model;
GtkCellRenderer *cell;
gboolean done = FALSE;
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy", gtk_main_quit, NULL);
g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
gtk_container_add (GTK_CONTAINER (window), vbox);
@@ -407,7 +419,8 @@ main (int argc, char *argv[])
gtk_widget_show (window);
gtk_main ();
while (!done)
g_main_context_iteration (NULL, TRUE);
return 0;
}