Prepare for Gtk+ 4 support

This commit is contained in:
Pierre Pronchery 2021-09-29 09:29:59 +02:00
parent fe75f4857f
commit e51054db29
2 changed files with 11 additions and 3 deletions

View File

@ -88,7 +88,11 @@ int main(int argc, char * argv[])
int ret = 0;
int o;
#if GTK_CHECK_VERSION(4, 0, 0)
gtk_init();
#else
gtk_init(&argc, &argv);
#endif
while((o = getopt(argc, argv, "")) != -1)
switch(o)
{

View File

@ -60,7 +60,7 @@ static int _usage(char const * error);
/* functions */
/* widget */
static gboolean _widget_on_closex(void);
static gboolean _widget_on_closex(GtkWidget * widget);
static int _widget(WidgetPrefs * prefs, int namec, char ** namev)
{
@ -101,12 +101,12 @@ static int _widget(WidgetPrefs * prefs, int namec, char ** namev)
gtk_container_add(GTK_CONTAINER(window), box);
gtk_widget_show_all(window);
gtk_main();
gtk_widget_destroy(window);
return ret;
}
static gboolean _widget_on_closex(void)
static gboolean _widget_on_closex(GtkWidget * widget)
{
gtk_widget_destroy(widget);
gtk_main_quit();
return TRUE;
}
@ -141,7 +141,11 @@ int main(int argc, char * argv[])
char * p;
memset(&prefs, 0, sizeof(prefs));
#if GTK_CHECK_VERSION(4, 0, 0)
gtk_init(&argc, &argv);
#else
gtk_init(&argc, &argv);
#endif
while((o = getopt(argc, argv, "h:t:w:")) != -1)
switch(o)
{