Compare commits

...

10 Commits

Author SHA1 Message Date
Matthias Clasen
1ae7240932 Update callers
Adapt all our tests and examples to the new initialization api.
2016-12-28 18:57:55 -05:00
Matthias Clasen
a3e2fc2df6 Drop gdk init api
Supporting separately initialized gdk is just not worth it.
2016-12-28 18:57:39 -05:00
Matthias Clasen
deed306e5a Drop arguments from gtk_init
This is our ultimate goal: no more commandline argument handling.
Lots of callers will have to be updated.
2016-12-28 08:49:37 -05:00
Matthias Clasen
9cc64449a8 Simplify initialization code
Now that gtk_get_option_group and gtk_parse_args are no longer
public, we can get rid of them.
2016-12-28 07:46:56 -05:00
Matthias Clasen
72877343fd Drop the --gtk-debug and --gtk-no-debug options
We have environment variables that cover this.
2016-12-27 18:49:30 -05:00
Matthias Clasen
8a816dbc19 Drop the --g-fatal-warnings argument
We don't need it, GLib has an environment variable for this.
2016-12-27 18:48:02 -05:00
Matthias Clasen
002d616ca4 Drop the --gtk-modules argument
We don't need it; the environment variable is enough.
2016-12-27 18:46:45 -05:00
Matthias Clasen
3ea1b37aff Don't export gtk_get_option_group
We want to get rid of commandline option handling in GTK+.
This is a step in that direction.
2016-12-27 18:45:53 -05:00
Matthias Clasen
1d6435db48 Stop exporting gtk_parse_args
We want to stop handling commandline arguments, and that is the
sole purpose of this function. So it has to go
2016-12-27 18:36:19 -05:00
Matthias Clasen
5b411031ba Drop gtk_init_with_args
We want to simplify our initialization code and remove all commandline
argument handling from it. The first stop for this is to reduce the
number of gtk_init variants we have.
2016-12-27 18:31:03 -05:00
155 changed files with 232 additions and 709 deletions

View File

@@ -15,7 +15,7 @@ main (int argc,
GObject *window;
GObject *button;
gtk_init (&argc, &argv);
gtk_init ();
/* Construct a GtkBuilder instance and load our UI description */
builder = gtk_builder_new ();

187
gdk/gdk.c
View File

@@ -173,93 +173,7 @@ static const GDebugKey gdk_debug_keys[] = {
{ "opengl", GDK_DEBUG_OPENGL },
{ "vulkan", GDK_DEBUG_VULKAN }
};
static gboolean
gdk_arg_debug_cb (const char *key, const char *value, gpointer user_data, GError **error)
{
guint debug_value = g_parse_debug_string (value,
(GDebugKey *) gdk_debug_keys,
G_N_ELEMENTS (gdk_debug_keys));
if (debug_value == 0 && value != NULL && strcmp (value, "") != 0)
{
g_set_error (error,
G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
_("Error parsing option --gdk-debug"));
return FALSE;
}
_gdk_debug_flags |= debug_value;
return TRUE;
}
static gboolean
gdk_arg_no_debug_cb (const char *key, const char *value, gpointer user_data, GError **error)
{
guint debug_value = g_parse_debug_string (value,
(GDebugKey *) gdk_debug_keys,
G_N_ELEMENTS (gdk_debug_keys));
if (debug_value == 0 && value != NULL && strcmp (value, "") != 0)
{
g_set_error (error,
G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
_("Error parsing option --gdk-no-debug"));
return FALSE;
}
_gdk_debug_flags &= ~debug_value;
return TRUE;
}
#endif /* G_ENABLE_DEBUG */
static gboolean
gdk_arg_class_cb (const char *key, const char *value, gpointer user_data, GError **error)
{
gdk_set_program_class (value);
gdk_progclass_overridden = TRUE;
return TRUE;
}
static gboolean
gdk_arg_name_cb (const char *key, const char *value, gpointer user_data, GError **error)
{
g_set_prgname (value);
return TRUE;
}
static const GOptionEntry gdk_args[] = {
{ "class", 0, 0, G_OPTION_ARG_CALLBACK, gdk_arg_class_cb,
/* Description of --class=CLASS in --help output */ N_("Program class as used by the window manager"),
/* Placeholder in --class=CLASS in --help output */ N_("CLASS") },
{ "name", 0, 0, G_OPTION_ARG_CALLBACK, gdk_arg_name_cb,
/* Description of --name=NAME in --help output */ N_("Program name as used by the window manager"),
/* Placeholder in --name=NAME in --help output */ N_("NAME") },
#ifndef G_OS_WIN32
{ "display", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &_gdk_display_name,
/* Description of --display=DISPLAY in --help output */ N_("X display to use"),
/* Placeholder in --display=DISPLAY in --help output */ N_("DISPLAY") },
#endif
#ifdef G_ENABLE_DEBUG
{ "gdk-debug", 0, 0, G_OPTION_ARG_CALLBACK, gdk_arg_debug_cb,
/* Description of --gdk-debug=FLAGS in --help output */ N_("GDK debugging flags to set"),
/* Placeholder in --gdk-debug=FLAGS in --help output */ N_("FLAGS") },
{ "gdk-no-debug", 0, 0, G_OPTION_ARG_CALLBACK, gdk_arg_no_debug_cb,
/* Description of --gdk-no-debug=FLAGS in --help output */ N_("GDK debugging flags to unset"),
/* Placeholder in --gdk-no-debug=FLAGS in --help output */ N_("FLAGS") },
#endif
{ NULL }
};
void
gdk_add_option_entries (GOptionGroup *group)
{
g_option_group_add_entries (group, gdk_args);
}
static gpointer
register_resources (gpointer dummy G_GNUC_UNUSED)
@@ -328,53 +242,6 @@ gdk_pre_parse (void)
}
}
/**
* gdk_parse_args:
* @argc: the number of command line arguments.
* @argv: (inout) (array length=argc): the array of command line arguments.
*
* Parse command line arguments, and store for future
* use by calls to gdk_display_open().
*
* Any arguments used by GDK are removed from the array and @argc and @argv are
* updated accordingly.
*
* You shouldnt call this function explicitly if you are using
* gtk_init(), gtk_init_check(), gdk_init(), or gdk_init_check().
*
* Since: 2.2
**/
void
gdk_parse_args (int *argc,
char ***argv)
{
GOptionContext *option_context;
GOptionGroup *option_group;
GError *error = NULL;
if (gdk_initialized)
return;
gdk_pre_parse ();
option_context = g_option_context_new (NULL);
g_option_context_set_ignore_unknown_options (option_context, TRUE);
g_option_context_set_help_enabled (option_context, FALSE);
option_group = g_option_group_new (NULL, NULL, NULL, NULL, NULL);
g_option_context_set_main_group (option_context, option_group);
g_option_group_add_entries (option_group, gdk_args);
if (!g_option_context_parse (option_context, argc, argv, &error))
{
g_warning ("%s", error->message);
g_error_free (error);
}
g_option_context_free (option_context);
GDK_NOTE (MISC, g_message ("progname: \"%s\"", g_get_prgname ()));
}
/**
* gdk_get_display_arg_name:
*
@@ -424,60 +291,6 @@ gdk_display_open_default (void)
return display;
}
/**
* gdk_init_check:
* @argc: (inout): the number of command line arguments.
* @argv: (array length=argc) (inout): the array of command line arguments.
*
* Initializes the GDK library and connects to the windowing system,
* returning %TRUE on success.
*
* Any arguments used by GDK are removed from the array and @argc and @argv
* are updated accordingly.
*
* GTK+ initializes GDK in gtk_init() and so this function is not usually
* needed by GTK+ applications.
*
* Returns: %TRUE if initialization succeeded.
*/
gboolean
gdk_init_check (int *argc,
char ***argv)
{
gdk_parse_args (argc, argv);
return gdk_display_open_default () != NULL;
}
/**
* gdk_init:
* @argc: (inout): the number of command line arguments.
* @argv: (array length=argc) (inout): the array of command line arguments.
*
* Initializes the GDK library and connects to the windowing system.
* If initialization fails, a warning message is output and the application
* terminates with a call to `exit(1)`.
*
* Any arguments used by GDK are removed from the array and @argc and @argv
* are updated accordingly.
*
* GTK+ initializes GDK in gtk_init() and so this function is not usually
* needed by GTK+ applications.
*/
void
gdk_init (int *argc, char ***argv)
{
if (!gdk_init_check (argc, argv))
{
const char *display_name = gdk_get_display_arg_name ();
g_warning ("cannot open display: %s", display_name ? display_name : "");
exit(1);
}
}
/**
* SECTION:threads
* @Short_description: Functions for using GDK in multi-threaded programs

View File

@@ -40,16 +40,6 @@ G_BEGIN_DECLS
#define GDK_PRIORITY_EVENTS (G_PRIORITY_DEFAULT)
GDK_AVAILABLE_IN_ALL
void gdk_parse_args (gint *argc,
gchar ***argv);
GDK_AVAILABLE_IN_ALL
void gdk_init (gint *argc,
gchar ***argv);
GDK_AVAILABLE_IN_ALL
gboolean gdk_init_check (gint *argc,
gchar ***argv);
GDK_AVAILABLE_IN_ALL
const gchar * gdk_get_program_class (void);
GDK_AVAILABLE_IN_ALL

View File

@@ -1071,7 +1071,7 @@ main (int argc, const char *argv[])
{
g_set_prgname ("gtk-builder-tool");
gtk_init (NULL, NULL);
gtk_init ();
gtk_test_register_all_types ();

View File

@@ -79,8 +79,6 @@ main (int argc, char *argv[])
"optionally passing one or more URIs as arguments.");
g_option_context_set_summary (context, summary);
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_add_group (context, gtk_get_option_group (FALSE));
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
@@ -116,7 +114,7 @@ main (int argc, char *argv[])
}
gtk_init (&argc, &argv);
gtk_init ();
app_name = *args;
#ifdef G_OS_UNIX

View File

@@ -30,7 +30,7 @@ main (int argc, char **argv)
int max_prop_name_length = 0;
gchar *pattern = NULL;
gtk_init (&argc, &argv);
gtk_init ();
if (argc > 1)
pattern = argv[1];

View File

@@ -290,7 +290,7 @@ gtk_application_startup (GApplication *g_application)
gtk_action_muxer_insert (application->priv->muxer, "app", G_ACTION_GROUP (application));
gtk_init (NULL, NULL);
gtk_init ();
application->priv->impl = gtk_application_impl_new (application, gdk_display_get_default ());
gtk_application_impl_startup (application->priv->impl, application->priv->register_session);
@@ -327,8 +327,6 @@ gtk_application_local_command_line (GApplication *application,
gchar ***arguments,
gint *exit_status)
{
g_application_add_option_group (application, gtk_get_option_group (FALSE));
return G_APPLICATION_CLASS (gtk_application_parent_class)->local_command_line (application, arguments, exit_status);
}

View File

@@ -396,62 +396,6 @@ gtk_disable_setlocale (void)
#endif
static GString *gtk_modules_string = NULL;
static gboolean g_fatal_warnings = FALSE;
#ifdef G_ENABLE_DEBUG
static gboolean
gtk_arg_debug_cb (const char *key, const char *value, gpointer user_data)
{
debug_flags[0].flags |= g_parse_debug_string (value,
gtk_debug_keys,
G_N_ELEMENTS (gtk_debug_keys));
return TRUE;
}
static gboolean
gtk_arg_no_debug_cb (const char *key, const char *value, gpointer user_data)
{
debug_flags[0].flags &= ~g_parse_debug_string (value,
gtk_debug_keys,
G_N_ELEMENTS (gtk_debug_keys));
return TRUE;
}
#endif /* G_ENABLE_DEBUG */
static gboolean
gtk_arg_module_cb (const char *key, const char *value, gpointer user_data)
{
if (value && *value)
{
if (gtk_modules_string)
g_string_append_c (gtk_modules_string, G_SEARCHPATH_SEPARATOR);
else
gtk_modules_string = g_string_new (NULL);
g_string_append (gtk_modules_string, value);
}
return TRUE;
}
static const GOptionEntry gtk_args[] = {
{ "gtk-module", 0, 0, G_OPTION_ARG_CALLBACK, gtk_arg_module_cb,
/* Description of --gtk-module=MODULES in --help output */ N_("Load additional GTK+ modules"),
/* Placeholder in --gtk-module=MODULES in --help output */ N_("MODULES") },
{ "g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &g_fatal_warnings,
/* Description of --g-fatal-warnings in --help output */ N_("Make all warnings fatal"), NULL },
#ifdef G_ENABLE_DEBUG
{ "gtk-debug", 0, 0, G_OPTION_ARG_CALLBACK, gtk_arg_debug_cb,
/* Description of --gtk-debug=FLAGS in --help output */ N_("GTK+ debugging flags to set"),
/* Placeholder in --gtk-debug=FLAGS in --help output */ N_("FLAGS") },
{ "gtk-no-debug", 0, 0, G_OPTION_ARG_CALLBACK, gtk_arg_no_debug_cb,
/* Description of --gtk-no-debug=FLAGS in --help output */ N_("GTK+ debugging flags to unset"),
/* Placeholder in --gtk-no-debug=FLAGS in --help output */ N_("FLAGS") },
#endif
{ NULL }
};
#ifdef G_OS_WIN32
@@ -617,12 +561,11 @@ setlocale_initialization (void)
}
static void
do_pre_parse_initialization (int *argc,
char ***argv)
do_pre_parse_initialization (void)
{
const gchar *env_string;
double slowdown;
if (pre_initialized)
return;
@@ -680,7 +623,7 @@ gettext_initialization (void)
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
bind_textdomain_codeset (GETTEXT_PACKAGE "-properties", "UTF-8");
# endif
#endif
#endif
}
static void
@@ -691,8 +634,7 @@ default_display_notify_cb (GdkDisplayManager *dm)
}
static void
do_post_parse_initialization (int *argc,
char ***argv)
do_post_parse_initialization (void)
{
GdkDisplayManager *display_manager;
@@ -705,15 +647,6 @@ do_post_parse_initialization (int *argc,
signal (SIGPIPE, SIG_IGN);
#endif
if (g_fatal_warnings)
{
GLogLevelFlags fatal_mask;
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
g_log_set_always_fatal (fatal_mask);
}
if (debug_flags[0].flags & GTK_DEBUG_UPDATES)
gtk_debug_updates_set_enabled (TRUE);
@@ -727,12 +660,12 @@ do_post_parse_initialization (int *argc,
if (gtk_modules_string)
{
_gtk_modules_init (argc, argv, gtk_modules_string->str);
_gtk_modules_init (NULL, NULL, gtk_modules_string->str);
g_string_free (gtk_modules_string, TRUE);
}
else
{
_gtk_modules_init (argc, argv, NULL);
_gtk_modules_init (NULL, NULL, NULL);
}
display_manager = gdk_display_manager_get ();
@@ -744,52 +677,6 @@ do_post_parse_initialization (int *argc,
NULL);
}
typedef struct
{
gboolean open_default_display;
} OptionGroupInfo;
static gboolean
pre_parse_hook (GOptionContext *context,
GOptionGroup *group,
gpointer data,
GError **error)
{
do_pre_parse_initialization (NULL, NULL);
return TRUE;
}
static gboolean
post_parse_hook (GOptionContext *context,
GOptionGroup *group,
gpointer data,
GError **error)
{
OptionGroupInfo *info = data;
do_post_parse_initialization (NULL, NULL);
if (info->open_default_display)
{
if (gdk_display_open_default () == NULL)
{
const char *display_name = gdk_get_display_arg_name ();
g_set_error (error,
G_OPTION_ERROR,
G_OPTION_ERROR_FAILED,
_("Cannot open display: %s"),
display_name ? display_name : "" );
return FALSE;
}
}
return TRUE;
}
guint
gtk_get_display_debug_flags (GdkDisplay *display)
{
@@ -861,179 +748,12 @@ gtk_simulate_touchscreen (void)
return test_touchscreen > 0 || (gtk_get_debug_flags () & GTK_DEBUG_TOUCHSCREEN) != 0;
}
/**
* gtk_get_option_group:
* @open_default_display: whether to open the default display
* when parsing the commandline arguments
*
* Returns a #GOptionGroup for the commandline arguments recognized
* by GTK+ and GDK.
*
* You should add this group to your #GOptionContext
* with g_option_context_add_group(), if you are using
* g_option_context_parse() to parse your commandline arguments.
*
* Returns: (transfer full): a #GOptionGroup for the commandline
* arguments recognized by GTK+
*
* Since: 2.6
*/
GOptionGroup *
gtk_get_option_group (gboolean open_default_display)
{
GOptionGroup *group;
OptionGroupInfo *info;
gettext_initialization ();
info = g_new0 (OptionGroupInfo, 1);
info->open_default_display = open_default_display;
group = g_option_group_new ("gtk", _("GTK+ Options"), _("Show GTK+ Options"), info, g_free);
g_option_group_set_parse_hooks (group, pre_parse_hook, post_parse_hook);
gdk_add_option_entries (group);
g_option_group_add_entries (group, gtk_args);
g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
return group;
}
/**
* gtk_init_with_args:
* @argc: (inout): Address of the `argc` parameter of
* your main() function (or 0 if @argv is %NULL). This will be changed if
* any arguments were handled.
* @argv: (array length=argc) (inout) (allow-none): Address of the
* `argv` parameter of main(), or %NULL. Any options
* understood by GTK+ are stripped before return.
* @parameter_string: (allow-none): a string which is displayed in
* the first line of `--help` output, after
* `programname [OPTION...]`
* @entries: (array zero-terminated=1): a %NULL-terminated array
* of #GOptionEntrys describing the options of your program
* @translation_domain: (nullable): a translation domain to use for translating
* the `--help` output for the options in @entries
* and the @parameter_string with gettext(), or %NULL
* @error: a return location for errors
*
* This function does the same work as gtk_init_check().
* Additionally, it allows you to add your own commandline options,
* and it automatically generates nicely formatted
* `--help` output. Note that your program will
* be terminated after writing out the help output.
*
* Returns: %TRUE if the windowing system has been successfully
* initialized, %FALSE otherwise
*
* Since: 2.6
*/
gboolean
gtk_init_with_args (gint *argc,
gchar ***argv,
const gchar *parameter_string,
const GOptionEntry *entries,
const gchar *translation_domain,
GError **error)
{
GOptionContext *context;
GOptionGroup *gtk_group;
gboolean retval;
if (gtk_initialized)
goto done;
gettext_initialization ();
if (!check_setugid ())
return FALSE;
gtk_group = gtk_get_option_group (FALSE);
context = g_option_context_new (parameter_string);
g_option_context_add_group (context, gtk_group);
g_option_context_set_translation_domain (context, translation_domain);
if (entries)
g_option_context_add_main_entries (context, entries, translation_domain);
retval = g_option_context_parse (context, argc, argv, error);
g_option_context_free (context);
if (!retval)
return FALSE;
done:
return gdk_display_open_default () != NULL;
}
/**
* gtk_parse_args:
* @argc: (inout): a pointer to the number of command line arguments
* @argv: (array length=argc) (inout): a pointer to the array of
* command line arguments
*
* Parses command line arguments, and initializes global
* attributes of GTK+, but does not actually open a connection
* to a display. (See gdk_display_open(), gdk_get_display_arg_name())
*
* Any arguments used by GTK+ or GDK are removed from the array and
* @argc and @argv are updated accordingly.
*
* There is no need to call this function explicitly if you are using
* gtk_init(), or gtk_init_check().
*
* Note that many aspects of GTK+ require a display connection to
* function, so this way of initializing GTK+ is really only useful
* for specialized use cases.
*
* Returns: %TRUE if initialization succeeded, otherwise %FALSE
*/
gboolean
gtk_parse_args (int *argc,
char ***argv)
{
GOptionContext *option_context;
GOptionGroup *gtk_group;
GError *error = NULL;
if (gtk_initialized)
return TRUE;
gettext_initialization ();
if (!check_setugid ())
return FALSE;
option_context = g_option_context_new (NULL);
g_option_context_set_ignore_unknown_options (option_context, TRUE);
g_option_context_set_help_enabled (option_context, FALSE);
gtk_group = gtk_get_option_group (FALSE);
g_option_context_set_main_group (option_context, gtk_group);
if (!g_option_context_parse (option_context, argc, argv, &error))
{
g_warning ("%s", error->message);
g_error_free (error);
}
g_option_context_free (option_context);
return TRUE;
}
#ifdef G_PLATFORM_WIN32
#undef gtk_init_check
#endif
/**
* gtk_init_check:
* @argc: (inout): Address of the `argc` parameter of
* your main() function (or 0 if @argv is %NULL). This will be changed if
* any arguments were handled.
* @argv: (array length=argc) (inout) (allow-none): Address of the
* `argv` parameter of main(), or %NULL. Any options
* understood by GTK+ are stripped before return.
*
* This function does the same work as gtk_init() with only a single
* change: It does not terminate the program if the windowing system
@@ -1047,14 +767,21 @@ gtk_parse_args (int *argc,
* initialized, %FALSE otherwise
*/
gboolean
gtk_init_check (int *argc,
char ***argv)
gtk_init_check (void)
{
gboolean ret;
if (!gtk_parse_args (argc, argv))
if (gtk_initialized)
return TRUE;
gettext_initialization ();
if (!check_setugid ())
return FALSE;
do_pre_parse_initialization ();
do_post_parse_initialization ();
ret = gdk_display_open_default () != NULL;
if (gtk_get_debug_flags () & GTK_DEBUG_INTERACTIVE)
@@ -1069,32 +796,13 @@ gtk_init_check (int *argc,
/**
* gtk_init:
* @argc: (inout): Address of the `argc` parameter of
* your main() function (or 0 if @argv is %NULL). This will be changed if
* any arguments were handled.
* @argv: (array length=argc) (inout) (allow-none): Address of the
* `argv` parameter of main(), or %NULL. Any options
* understood by GTK+ are stripped before return.
*
* Call this function before using any other GTK+ functions in your GUI
* applications. It will initialize everything needed to operate the
* toolkit and parses some standard command line options.
*
* Although you are expected to pass the @argc, @argv parameters from main() to
* this function, it is possible to pass %NULL if @argv is not available or
* commandline handling is not required.
*
* @argc and @argv are adjusted accordingly so your own code will
* never see those standard arguments.
*
* Note that there are some alternative ways to initialize GTK+:
* if you are calling gtk_parse_args(), gtk_init_check(),
* gtk_init_with_args() or g_option_context_parse() with
* the option group returned by gtk_get_option_group(),
* you dont have to call gtk_init().
*
* And if you are using #GtkApplication, you don't have to call any of the
* initialization functions either; the #GtkApplication::startup handler
* If you are using #GtkApplication, you don't have to call gtk_init()
* or gtk_init_check(); the #GtkApplication::startup handler
* does it for you.
*
* This function will terminate your program if it was unable to
@@ -1110,13 +818,13 @@ gtk_init_check (int *argc,
* similar things.
*/
void
gtk_init (int *argc, char ***argv)
gtk_init (void)
{
if (!gtk_init_check (argc, argv))
if (!gtk_init_check ())
{
const char *display_name_arg = gdk_get_display_arg_name ();
if (display_name_arg == NULL)
display_name_arg = getenv("DISPLAY");
display_name_arg = getenv ("DISPLAY");
g_warning ("cannot open display: %s", display_name_arg ? display_name_arg : "");
exit (1);
}

View File

@@ -73,27 +73,10 @@ const gchar* gtk_check_version (guint required_major,
*/
GDK_AVAILABLE_IN_ALL
gboolean gtk_parse_args (int *argc,
char ***argv);
void gtk_init (void);
GDK_AVAILABLE_IN_ALL
void gtk_init (int *argc,
char ***argv);
GDK_AVAILABLE_IN_ALL
gboolean gtk_init_check (int *argc,
char ***argv);
GDK_AVAILABLE_IN_ALL
gboolean gtk_init_with_args (gint *argc,
gchar ***argv,
const gchar *parameter_string,
const GOptionEntry *entries,
const gchar *translation_domain,
GError **error);
GDK_AVAILABLE_IN_ALL
GOptionGroup *gtk_get_option_group (gboolean open_default_display);
gboolean gtk_init_check (void);
#ifdef G_OS_WIN32

View File

@@ -96,7 +96,7 @@ gtk_test_init (int *argcp,
*/
gdk_disable_multidevice ();
gtk_init (argcp, argvp);
gtk_init ();
}
static GSList*

View File

@@ -173,8 +173,6 @@ main(int argc, char **argv)
GOptionContext *context = g_option_context_new (NULL);
g_option_context_add_main_entries (context, options, NULL);
frame_stats_add_options (g_option_context_get_main_group (context));
g_option_context_add_group (context,
gtk_get_option_group (TRUE));
if (!g_option_context_parse (context, &argc, &argv, &error))
{
@@ -182,6 +180,8 @@ main(int argc, char **argv)
return 1;
}
gtk_init ();
g_print ("# Load factor: %g\n",
load_factor);
g_print ("# Resizing?: %s\n",

View File

@@ -28,8 +28,6 @@ main(int argc, char **argv)
GOptionContext *context = g_option_context_new (NULL);
g_option_context_add_main_entries (context, options, NULL);
frame_stats_add_options (g_option_context_get_main_group (context));
g_option_context_add_group (context,
gtk_get_option_group (TRUE));
if (!g_option_context_parse (context, &argc, &argv, &error))
{
@@ -37,6 +35,8 @@ main(int argc, char **argv)
return 1;
}
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy", gtk_main_quit, NULL);
frame_stats_ensure (GTK_WINDOW (window));

View File

@@ -203,7 +203,7 @@ main (int argc, char *argv[])
{
GtkWidget *window1;
gtk_init (&argc, &argv);
gtk_init ();
window1 = create_flicker ();
gtk_widget_show (window1);

View File

@@ -112,7 +112,7 @@ main (int argc, char *argv[])
*revealer, *frame, *label, *scrolled, *popover;
int i;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_titlebar (GTK_WINDOW (window), g_object_new (GTK_TYPE_HEADER_BAR, "visible", TRUE, "title", "GdkGears", NULL));

View File

@@ -171,7 +171,7 @@ main (int argc, char *argv[])
GListStore *store;
gint i;
gtk_init (NULL, NULL);
gtk_init ();
store = g_list_store_new (my_object_get_type ());
for (i = 0; i < 100; i++)

View File

@@ -43,7 +43,7 @@ main (int argc, char **argv)
GtkWidget *scale;
GtkWidget *da;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);

View File

@@ -51,7 +51,7 @@ main (int argc, char *argv[])
GtkWidget *combo;
GtkAdjustment *adj;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);

View File

@@ -781,7 +781,7 @@ main (int argc, char **argv)
GtkApplication *app;
GError *error = NULL;
gtk_init (NULL, NULL);
gtk_init ();
settings = gtk_print_settings_new_from_file ("print-settings.ini", &error);
if (error) {

View File

@@ -323,7 +323,7 @@ main (int argc, char **argv)
char *pattern;
guint i, n;
gtk_init (&argc, &argv);
gtk_init ();
n = 100000;
pattern = "*";

View File

@@ -24,14 +24,18 @@ main(int argc, char **argv)
char *contents;
gsize len;
int run;
GOptionContext *context;
if (!gtk_init_with_args (&argc, &argv, "NODE-FILE PNG-FILE",
options, NULL, &error))
context = g_option_context_new ("NODE-FILE PNG-FILE");
g_option_context_add_main_entries (context, options, NULL);
if (!g_option_context_parse (context, &argc, &argv, &error))
{
g_printerr ("Option parsing failed: %s\n", error->message);
return 1;
}
gtk_init ();
if (runs < 1)
{
g_printerr ("Number of runs given with -r/--runs must be at least 1 and not %d.\n", runs);

View File

@@ -105,8 +105,6 @@ main (int argc, char **argv)
GOptionContext *context = g_option_context_new (NULL);
g_option_context_add_main_entries (context, options, NULL);
frame_stats_add_options (g_option_context_get_main_group (context));
g_option_context_add_group (context,
gtk_get_option_group (TRUE));
if (!g_option_context_parse (context, &argc, &argv, &error))
{
@@ -114,6 +112,8 @@ main (int argc, char **argv)
return 1;
}
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
frame_stats_ensure (GTK_WINDOW (window));
gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);

View File

@@ -30,7 +30,7 @@ main (int argc, char *argv[])
{
GtkWidget *window;
gtk_init (&argc, &argv);
gtk_init ();
window = g_object_connect (g_object_new (gtk_window_get_type (),
"type", GTK_WINDOW_TOPLEVEL,

View File

@@ -135,7 +135,7 @@ main (gint argc, gchar **argv)
{
Info info;
gtk_init (&argc, &argv);
gtk_init ();
info.toolbar = NULL;
info.counter = 0;

View File

@@ -20,7 +20,7 @@ main (int argc, char *argv[])
GtkWidget *win, *box, *tv, *sw, *sb;
GtkAdjustment *adj;
gtk_init (NULL, NULL);
gtk_init ();
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (win), 640, 480);

View File

@@ -121,7 +121,7 @@ main (gint argc, gchar **argv)
{
GtkWidget *dialog;
gtk_init (&argc, &argv);
gtk_init ();
dialog = key_test ();

View File

@@ -365,7 +365,7 @@ main (int argc, char *argv[])
{
GtkCssProvider *provider;
gtk_init (&argc, &argv);
gtk_init ();
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider,

View File

@@ -410,7 +410,7 @@ main (int argc,
{
gint i;
gtk_init (&argc, &argv);
gtk_init ();
i = 1;
while (i < argc)

View File

@@ -157,7 +157,7 @@ main (int argc, char **argv)
GtkWidget *w1;
gchar *path;
gtk_init (&argc, &argv);
gtk_init ();
toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
grid = gtk_grid_new ();

View File

@@ -68,7 +68,7 @@ main (int argc,
{
GtkWidget *w;
gtk_init (&argc, &argv);
gtk_init ();
toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);

View File

@@ -703,7 +703,7 @@ main (int argc, gchar *argv[])
GtkWidget *window, *box, *button;
gint i;
gtk_init (&argc, &argv);
gtk_init ();
if (g_getenv ("RTL"))
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);

View File

@@ -76,7 +76,7 @@ main (int argc,
int i, j;
GtkCssProvider *provider;
gtk_init (&argc, &argv);
gtk_init ();
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider,

View File

@@ -118,7 +118,7 @@ main (int argc,
GtkWidget *vbox, *hbox, *combo_styles, *combo_types, *option;
int i;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK (gtk_main_quit), NULL);

View File

@@ -132,7 +132,7 @@ main (int argc, char *argv[])
GtkWidget *label;
GtkWidget *spin;
gtk_init (NULL, NULL);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

View File

@@ -146,7 +146,7 @@ main (gint argc, gchar **argv)
GtkStyleProvider *provider;
GtkTextBuffer *css;
gtk_init (&argc, &argv);
gtk_init ();
css = gtk_text_buffer_new (NULL);
gtk_text_buffer_create_tag (css,

View File

@@ -27,7 +27,7 @@ int main (int argc, char *argv[])
gboolean use_underline;
GtkWidget *label;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

View File

@@ -189,7 +189,7 @@ main (int argc, char **argv)
{
GtkWidget *window, *darea;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

View File

@@ -701,7 +701,7 @@ create_calendar(void)
int main(int argc,
char *argv[] )
{
gtk_init (&argc, &argv);
gtk_init ();
if (g_getenv ("GTK_RTL"))
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);

View File

@@ -614,7 +614,7 @@ background_area (void)
int
main (int argc, char *argv[])
{
gtk_init (NULL, NULL);
gtk_init ();
if (g_getenv ("RTL"))
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);

View File

@@ -254,7 +254,7 @@ main (int argc, char **argv)
GtkWidget *label;
GtkWidget *tree;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy",

View File

@@ -109,7 +109,7 @@ main (int argc, char **argv)
{
GtkWidget *window;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_dialog_new_with_buttons ("Clipboard",
NULL,

View File

@@ -36,7 +36,7 @@ main (int argc, char *argv[])
GtkWidget *dialog;
gint i;
gtk_init (NULL, NULL);
gtk_init ();
dialog = gtk_color_chooser_dialog_new ("Select a color", NULL);

View File

@@ -41,7 +41,7 @@ int main (int argc, char *argv[])
GtkWidget *entry;
GtkBuilder *builder;
gtk_init (NULL, NULL);
gtk_init ();
builder = gtk_builder_new_from_file ("testcolorchooser2.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));

View File

@@ -1058,7 +1058,7 @@ main (int argc, char **argv)
gchar *text;
gint i;
gtk_init (&argc, &argv);
gtk_init ();
if (g_getenv ("RTL"))
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);

View File

@@ -234,7 +234,7 @@ main (int argc, char **argv)
test_init ();
gtk_init (&argc, &argv);
gtk_init ();
model = gtk_list_store_new (1, G_TYPE_STRING);
contents = g_array_new (FALSE, FALSE, sizeof (char));

View File

@@ -316,7 +316,7 @@ main (int argc, char *argv[])
GtkWidget *box;
GtkWidget *button;
gtk_init (NULL, NULL);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);

View File

@@ -590,7 +590,7 @@ main (int argc, char **argv)
test_init ();
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy",

View File

@@ -355,7 +355,7 @@ main (int argc, char *Argv[])
GtkWidget *grid;
GtkWidget *entry;
gtk_init (NULL, NULL);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Drag And Drop");

View File

@@ -127,7 +127,7 @@ main (int argc, char *argv[])
GtkWidget *window, *vbox, *label;
GtkWidget *combo, *scale, *overlay, *da;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);

View File

@@ -8,7 +8,7 @@ int main (int argc, char **argv)
GIcon *icon;
GIcon *icon2;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

View File

@@ -296,7 +296,7 @@ main (int argc, char *argv[])
GtkTreeModel *completion_model;
GtkCellRenderer *cell;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "delete_event", gtk_main_quit, NULL);

View File

@@ -108,7 +108,7 @@ main (int argc, char **argv)
GIcon *icon;
GtkTargetList *tlist;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Gtk Entry Icons Test");

View File

@@ -133,7 +133,7 @@ main (gint argc, gchar *argv[])
{
GdkDisplay *extra_display;
gtk_init (&argc, &argv);
gtk_init ();
test_error_trapping (gdk_display_get_default ());

View File

@@ -156,7 +156,7 @@ create_grid_window (void)
int
main (int argc, char *argv[])
{
gtk_init (&argc, &argv);
gtk_init ();
if (g_getenv ("RTL"))
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);

View File

@@ -30,7 +30,7 @@ main (int argc, char *argv[])
GtkWidget *tv;
GtkTextBuffer *buffer;
gtk_init (&argc, &argv);
gtk_init ();
dialog = gtk_message_dialog_new_with_markup (NULL,
0,

View File

@@ -540,13 +540,19 @@ main (int argc, char **argv)
{ "initial-folder", 'F', 0, G_OPTION_ARG_FILENAME, &initial_folder, "Initial folder to show", "FILENAME" },
{ NULL }
};
GOptionContext *context;
if (!gtk_init_with_args (&argc, &argv, "", options, NULL, &error))
context = g_option_context_new ("");
g_option_context_add_main_entries (context, options, NULL);
if (!g_option_context_parse (context, &argc, &argv, &error))
{
g_print ("Failed to parse args: %s\n", error->message);
g_error_free (error);
return 1;
}
g_option_context_free (context);
gtk_init ();
if (initial_filename && initial_folder)
{

View File

@@ -230,11 +230,10 @@ main (int argc,
context = g_option_context_new ("- test GtkFileChooserButton widget");
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_add_group (context, gtk_get_option_group (TRUE));
g_option_context_parse (context, &argc, &argv, NULL);
g_option_context_free (context);
gtk_init (&argc, &argv);
gtk_init ();
/* to test rtl layout, use "--right-to-left" */
if (rtl)

View File

@@ -666,7 +666,7 @@ main (int argc, char *argv[])
{
GtkWidget *window;
gtk_init (&argc, &argv);
gtk_init ();
window = create_window ();

View File

@@ -61,7 +61,7 @@ main (int argc, char *argv[])
GtkWidget *box;
GtkWidget *fontchooser;
gtk_init (NULL, NULL);
gtk_init ();
fontchooser = gtk_font_chooser_widget_new ();

View File

@@ -70,7 +70,7 @@ main (int argc, char *argv[])
GtkWidget *window;
GtkWidget *font_button;
gtk_init (&argc, &argv);
gtk_init ();
font_button = gtk_font_button_new ();

View File

@@ -32,7 +32,7 @@ main (int argc, char *argv[])
{
GtkWidget *window, *label, *grid, *demo;
gtk_init (NULL, NULL);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
grid = gtk_grid_new ();

View File

@@ -136,7 +136,7 @@ int main (int argc, char **argv)
GtkWidget *xalign_spin, *yalign_spin, *button, *grid, *label;
gfloat xalign, yalign;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);

View File

@@ -44,7 +44,7 @@ main (int argc, char *argv[])
{
GtkWidget *window, *vbox, *button;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

View File

@@ -97,7 +97,7 @@ static const char *menu_data =
int main (int argc, char **argv)
{
gtk_init (&argc, &argv);
gtk_init ();
GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
GtkWidget *menubutton = gtk_menu_button_new ();

View File

@@ -28,7 +28,7 @@ main (int argc,
GEmblem *emblem;
gchar *str;
gtk_init (&argc, &argv);
gtk_init ();
pixbuf = gdk_pixbuf_new_from_file ("apple-red.png", NULL);
toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);

View File

@@ -397,7 +397,7 @@ main (int argc, char *argv[])
GtkWidget *window, *box, *button, *controls;
int i;
gtk_init (&argc, &argv);
gtk_init ();
/* create a new pixel format; we use this to configure the
* GL context, and to check for features

View File

@@ -8,7 +8,7 @@ main (int argc, char *argv[])
{
GtkWidget *window, *fixed, *gears, *spinner;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Test GL/gtk inter-blending");

View File

@@ -625,8 +625,12 @@ main (int argc, char *argv[])
{ "import", 0, 0, G_OPTION_ARG_NONE, &do_import, "Use exported actions and menus", NULL },
{ NULL, }
};
GOptionContext *context;
gtk_init_with_args (&argc, &argv, NULL, entries, NULL, NULL);
context = g_option_context_new ("");
g_option_context_add_main_entries (context, entries, NULL);
g_option_context_parse (context, &argc, &argv, NULL);
gtk_init ();
if (do_export && do_import)
{

View File

@@ -453,7 +453,7 @@ spanning_grid (void)
int
main (int argc, char *argv[])
{
gtk_init (NULL, NULL);
gtk_init ();
if (g_getenv ("RTL"))
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);

View File

@@ -105,7 +105,7 @@ main (int argc, char **argv)
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
gtk_init (&argc, &argv);
gtk_init ();
model = create_model ();

View File

@@ -8894,7 +8894,7 @@ main (int argc, char *argv[])
g_set_application_name ("GTK+ Test Program");
gtk_init (&argc, &argv);
gtk_init ();
provider = gtk_css_provider_new ();

View File

@@ -133,7 +133,7 @@ main (int argc, char *argv[])
GtkWidget *content;
GtkCssProvider *provider;
gtk_init (NULL, NULL);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_style_context_add_class (gtk_widget_get_style_context (window), "main");

View File

@@ -967,7 +967,7 @@ main (int argc, char *argv[])
{
GtkWidget *window;
gtk_init (&argc, &argv);
gtk_init ();
window = create_window ();

View File

@@ -69,7 +69,7 @@ main (int argc, char *argv[])
int scale = 1;
GtkIconLookupFlags flags;
gtk_init (&argc, &argv);
gtk_init ();
if (argc < 3)
{

View File

@@ -235,7 +235,7 @@ main (int argc, char *argv[])
GtkWidget *vbox;
Views views;
gtk_init (&argc, &argv);
gtk_init ();
set_styles ();

View File

@@ -420,7 +420,7 @@ main (gint argc, gchar **argv)
GtkCellRenderer *cell;
GtkTreeViewColumn *tvc;
gtk_init (&argc, &argv);
gtk_init ();
/* to test rtl layout, set RTL=1 in the environment */
if (g_getenv ("RTL"))

View File

@@ -87,7 +87,7 @@ main (int argc, char **argv)
GIcon *icon;
GFile *file;
gtk_init (&argc, &argv);
gtk_init ();
if (argc > 1)
icon_name = argv[1];

View File

@@ -238,7 +238,7 @@ main (int argc, char *argv[])
GdkWindow *gdk_win;
GdkSeat *seat;
gtk_init (&argc, &argv);
gtk_init ();
seat = gdk_display_get_default_seat (gdk_display_get_default ());

View File

@@ -137,7 +137,7 @@ kinetic_scrolling (void)
int
main (int argc, char **argv)
{
gtk_init (NULL, NULL);
gtk_init ();
kinetic_scrolling ();

View File

@@ -82,7 +82,7 @@ main (int argc, char *argv[])
GtkWidget *box2;
GtkWidget *sw;
gtk_init (&argc, &argv);
gtk_init ();
add_custom_css ();

View File

@@ -255,7 +255,7 @@ main (int argc, char *argv[])
GtkWidget *window, *hbox, *vbox, *list, *row, *row3, *row_vbox, *row_hbox, *l;
GtkWidget *check, *button, *combo, *scrolled;
gtk_init (NULL, NULL);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

View File

@@ -102,7 +102,7 @@ int main (int argc, char *argv[])
gint i;
gchar *text;
gtk_init (NULL, NULL);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);

View File

@@ -51,7 +51,7 @@ main (int argc, char *argv[])
gint i;
gchar *text;
gtk_init (NULL, NULL);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), -1, 300);

View File

@@ -218,7 +218,7 @@ main (int argc, char *argv[])
GtkWidget *update;
GPermission *permission;
gtk_init (&argc, &argv);
gtk_init ();
permission = g_object_new (G_TYPE_TEST_PERMISSION, NULL);

View File

@@ -46,7 +46,7 @@ int main (int argc, char **argv)
guint row = 0;
GMenu *menu;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_resize (GTK_WINDOW (window), 400, 300);

View File

@@ -106,13 +106,19 @@ main (int argc, char *argv[])
{ "no-pw-save", 's', 0, G_OPTION_ARG_NONE, &dont_save_password, "Don't show password save options.", NULL },
{ NULL }
};
GOptionContext *context;
if (!gtk_init_with_args (&argc, &argv, "", options, NULL, &error))
context = g_option_context_new ("");
g_option_context_add_main_entries (context, options, NULL);
if (!g_option_context_parse (context, &argc, &argv, &error))
{
g_print ("Failed to parse args: %s\n", error->message);
g_error_free (error);
return 1;
}
g_option_context_free (context);
gtk_init ();
if (force_rtl)
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);

View File

@@ -105,7 +105,7 @@ main (int argc, char *argv[])
GdkScreen *scr2 = NULL; /* Quiet GCC */
gboolean correct_second_display = FALSE;
gtk_init (&argc, &argv);
gtk_init ();
if (argc == 2)
screen2_name = g_strdup (argv[1]);

View File

@@ -26,8 +26,12 @@ int main (int argc, char *argv[])
GtkWidget *window;
GtkWidget *button;
GdkDisplay *display;
gboolean has_display;
gtk_parse_args (&argc, &argv);
gdk_set_allowed_backends ("x11");
g_unsetenv ("DISPLAY");
has_display = gtk_init_check ();
g_assert (!has_display);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
button = gtk_button_new ();

View File

@@ -320,7 +320,7 @@ main (gint argc, gchar *argv[])
{
GtkWidget *window, *grid;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
grid = gtk_grid_new ();

View File

@@ -51,7 +51,7 @@ main (int argc, char **argv)
GtkWidget *box, *button;
GList *orientables = NULL;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
grid= gtk_grid_new ();

View File

@@ -549,7 +549,7 @@ main (int argc, char *argv[])
GtkWidget *win9;
GtkCssProvider *css_provider;
gtk_init (&argc, &argv);
gtk_init ();
if (g_getenv ("RTL"))
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);

View File

@@ -45,7 +45,7 @@ main (int argc, char *argv[])
GtkCssProvider *provider;
gchar *str;
gtk_init (&argc, &argv);
gtk_init ();
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider,

View File

@@ -67,7 +67,7 @@ main(int argc, char **argv)
const gchar *creator;
GError *error;
gtk_init (&argc, &argv);
gtk_init ();
if (argc != 2) {
fprintf (stderr, "Usage: testpixbuf-scale FILE\n");

View File

@@ -8,7 +8,7 @@ main (int argc, char *argv[])
GtkWidget *win;
GtkWidget *view;
gtk_init (&argc, &argv);
gtk_init ();
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (win), 400, 600);

View File

@@ -48,7 +48,7 @@ main (int argc, char *argv[])
GtkWidget *check;
GtkWidget *combo;
gtk_init (&argc, &argv);
gtk_init ();
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (win), 400, 600);

View File

@@ -53,7 +53,7 @@ main (int argc, char *argv[])
{
GtkWidget *window;
gtk_init (&argc, &argv);
gtk_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

View File

@@ -44,7 +44,7 @@ main (int argc,
GtkWidget *window;
GtkWidget *app_chooser_widget;
gtk_init (&argc, &argv);
gtk_init ();
builder = gtk_builder_new_from_file ("popupat.ui");

View File

@@ -98,7 +98,7 @@ main (int argc, char **argv)
GtkPrintOperation *print;
TestPrintFileOperation *print_file;
gtk_init (&argc, &argv);
gtk_init ();
/* Test some random drawing, with per-page paper settings */
print = gtk_print_operation_new ();

View File

@@ -52,7 +52,7 @@ main (int argc, char *argv[])
{
gint i;
gtk_init (&argc, &argv);
gtk_init ();
load_types ();
for (i = 0; tests[i].test; i++)

View File

@@ -111,7 +111,7 @@ main (int argc,
gint i;
gboolean multiple = FALSE;
gtk_init (&argc, &argv);
gtk_init ();
/* to test rtl layout, set RTL=1 in the environment */
if (g_getenv ("RTL"))

View File

@@ -150,7 +150,7 @@ main (int argc, char *argv[])
GtkWidget *button;
GtkAccelGroup *accel_group;
gtk_init (&argc, &argv);
gtk_init ();
manager = gtk_recent_manager_get_default ();

Some files were not shown because too many files have changed in this diff Show More