Merge gtk_init into midori_app_setup
gtk_init must come before stock items but we need to copy the arguments before. Fixes: https://bugs.launchpad.net/midori/+bug/1033043
This commit is contained in:
parent
b925dbca33
commit
9fb173ba69
8 changed files with 24 additions and 22 deletions
|
@ -2004,8 +2004,6 @@ main (int argc,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
midori_app_setup (argv);
|
|
||||||
|
|
||||||
/* Parse cli options */
|
/* Parse cli options */
|
||||||
webapp = NULL;
|
webapp = NULL;
|
||||||
config = NULL;
|
config = NULL;
|
||||||
|
@ -2022,8 +2020,7 @@ main (int argc,
|
||||||
block_uris = NULL;
|
block_uris = NULL;
|
||||||
inactivity_reset = 0;
|
inactivity_reset = 0;
|
||||||
error = NULL;
|
error = NULL;
|
||||||
if (!gtk_init_with_args (&argc, &argv, _("[Addresses]"), entries,
|
if (!midori_app_setup (&argc, &argv, entries, &error))
|
||||||
GETTEXT_PACKAGE, &error))
|
|
||||||
{
|
{
|
||||||
g_print ("%s - %s\n", _("Midori"), error->message);
|
g_print ("%s - %s\n", _("Midori"), error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
|
|
|
@ -1434,14 +1434,18 @@ midori_app_get_lib_path (const gchar* package)
|
||||||
*
|
*
|
||||||
* Since: 0.4.2
|
* Since: 0.4.2
|
||||||
**/
|
**/
|
||||||
void
|
gboolean
|
||||||
midori_app_setup (gchar** argument_vector)
|
midori_app_setup (gint *argc,
|
||||||
|
gchar** *argument_vector,
|
||||||
|
const GOptionEntry *entries,
|
||||||
|
GError* *error)
|
||||||
{
|
{
|
||||||
GtkIconSource* icon_source;
|
GtkIconSource* icon_source;
|
||||||
GtkIconSet* icon_set;
|
GtkIconSet* icon_set;
|
||||||
GtkIconFactory* factory;
|
GtkIconFactory* factory;
|
||||||
gsize i;
|
gsize i;
|
||||||
gchar* executable;
|
gchar* executable;
|
||||||
|
gboolean success;
|
||||||
|
|
||||||
static GtkStockItem items[] =
|
static GtkStockItem items[] =
|
||||||
{
|
{
|
||||||
|
@ -1488,7 +1492,11 @@ midori_app_setup (gchar** argument_vector)
|
||||||
textdomain (GETTEXT_PACKAGE);
|
textdomain (GETTEXT_PACKAGE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_type_init ();
|
/* Preserve argument vector */
|
||||||
|
command_line = g_strdupv (*argument_vector);
|
||||||
|
success = gtk_init_with_args (argc, argument_vector, _("[Addresses]"),
|
||||||
|
entries, GETTEXT_PACKAGE, error);
|
||||||
|
|
||||||
factory = gtk_icon_factory_new ();
|
factory = gtk_icon_factory_new ();
|
||||||
for (i = 0; i < G_N_ELEMENTS (items); i++)
|
for (i = 0; i < G_N_ELEMENTS (items); i++)
|
||||||
{
|
{
|
||||||
|
@ -1504,8 +1512,6 @@ midori_app_setup (gchar** argument_vector)
|
||||||
gtk_icon_factory_add_default (factory);
|
gtk_icon_factory_add_default (factory);
|
||||||
g_object_unref (factory);
|
g_object_unref (factory);
|
||||||
|
|
||||||
/* Preserve argument vector */
|
|
||||||
command_line = g_strdupv (argument_vector);
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
exec_path = g_win32_get_package_installation_directory_of_module (NULL);
|
exec_path = g_win32_get_package_installation_directory_of_module (NULL);
|
||||||
#else
|
#else
|
||||||
|
@ -1550,6 +1556,8 @@ midori_app_setup (gchar** argument_vector)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
|
|
@ -82,8 +82,11 @@ midori_app_send_notification (MidoriApp* app,
|
||||||
const gchar* title,
|
const gchar* title,
|
||||||
const gchar* message);
|
const gchar* message);
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
midori_app_setup (gchar** argument_vector);
|
midori_app_setup (gint *argc,
|
||||||
|
gchar** *argument_vector,
|
||||||
|
const GOptionEntry *entries,
|
||||||
|
GError* *error);
|
||||||
|
|
||||||
gchar**
|
gchar**
|
||||||
midori_app_get_command_line (void);
|
midori_app_get_command_line (void);
|
||||||
|
|
|
@ -195,9 +195,7 @@ main (int argc,
|
||||||
//TestParameters default_params = {":memory:", TRUE, NULL, NULL};
|
//TestParameters default_params = {":memory:", TRUE, NULL, NULL};
|
||||||
TestParameters default_params = {":memory:", FALSE, NULL, NULL};
|
TestParameters default_params = {":memory:", FALSE, NULL, NULL};
|
||||||
|
|
||||||
midori_app_setup (argv);
|
midori_app_setup (&argc, &argv, NULL, NULL);
|
||||||
g_test_init (&argc, &argv, NULL);
|
|
||||||
gtk_init_check (&argc, &argv);
|
|
||||||
|
|
||||||
g_test_add ("/bookmarks/simple test",
|
g_test_add ("/bookmarks/simple test",
|
||||||
BookmarksFixture, &default_params,
|
BookmarksFixture, &default_params,
|
||||||
|
|
|
@ -130,11 +130,10 @@ int
|
||||||
main (int argc,
|
main (int argc,
|
||||||
char** argv)
|
char** argv)
|
||||||
{
|
{
|
||||||
midori_app_setup (argv);
|
|
||||||
g_object_set_data (G_OBJECT (webkit_get_default_session ()),
|
g_object_set_data (G_OBJECT (webkit_get_default_session ()),
|
||||||
"midori-session-initialized", (void*)1);
|
"midori-session-initialized", (void*)1);
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
gtk_init_check (&argc, &argv);
|
midori_app_setup (&argc, &argv, NULL, NULL);
|
||||||
|
|
||||||
g_test_add_func ("/browser/create", browser_create);
|
g_test_add_func ("/browser/create", browser_create);
|
||||||
g_test_add_func ("/browser/tooltips", browser_tooltips);
|
g_test_add_func ("/browser/tooltips", browser_tooltips);
|
||||||
|
|
|
@ -245,9 +245,8 @@ int
|
||||||
main (int argc,
|
main (int argc,
|
||||||
char** argv)
|
char** argv)
|
||||||
{
|
{
|
||||||
midori_app_setup (argv);
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
gtk_init_check (&argc, &argv);
|
midori_app_setup (&argc, &argv, NULL, NULL);
|
||||||
soup_session_add_feature_by_type (webkit_get_default_session (),
|
soup_session_add_feature_by_type (webkit_get_default_session (),
|
||||||
SOUP_TYPE_COOKIE_JAR);
|
SOUP_TYPE_COOKIE_JAR);
|
||||||
|
|
||||||
|
|
|
@ -334,9 +334,8 @@ int
|
||||||
main (int argc,
|
main (int argc,
|
||||||
char** argv)
|
char** argv)
|
||||||
{
|
{
|
||||||
midori_app_setup (argv);
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
gtk_init_check (&argc, &argv);
|
midori_app_setup (&argc, &argv, NULL, NULL);
|
||||||
|
|
||||||
g_test_add_func ("/magic-uri/uri", magic_uri_uri);
|
g_test_add_func ("/magic-uri/uri", magic_uri_uri);
|
||||||
g_test_add_func ("/magic-uri/idn", magic_uri_idn);
|
g_test_add_func ("/magic-uri/idn", magic_uri_idn);
|
||||||
|
|
|
@ -187,11 +187,10 @@ int
|
||||||
main (int argc,
|
main (int argc,
|
||||||
char** argv)
|
char** argv)
|
||||||
{
|
{
|
||||||
midori_app_setup (argv);
|
|
||||||
g_object_set_data (G_OBJECT (webkit_get_default_session ()),
|
g_object_set_data (G_OBJECT (webkit_get_default_session ()),
|
||||||
"midori-session-initialized", (void*)1);
|
"midori-session-initialized", (void*)1);
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
gtk_init_check (&argc, &argv);
|
midori_app_setup (&argc, &argv, NULL, NULL);
|
||||||
|
|
||||||
g_test_add_data_func ("/properties/app",
|
g_test_add_data_func ("/properties/app",
|
||||||
(gconstpointer)MIDORI_TYPE_APP, properties_type_test);
|
(gconstpointer)MIDORI_TYPE_APP, properties_type_test);
|
||||||
|
|
Loading…
Reference in a new issue