[Xfce4-commits] <midori:master> Move main loop quit out of frontend into main
Christian Dywan
noreply at xfce.org
Fri Dec 14 01:44:01 CET 2012
Updating branch refs/heads/master
to e1db75dcd9427a7992336d14622540f69111aa6b (commit)
from f0bced2d081d110871d8b7a6062537f218230d1d (commit)
commit e1db75dcd9427a7992336d14622540f69111aa6b
Author: Christian Dywan <christian at twotoasts.de>
Date: Fri Dec 14 00:58:32 2012 +0100
Move main loop quit out of frontend into main
midori/main.c | 9 +++++++--
midori/midori-app.c | 1 -
midori/midori-frontend.c | 12 ++++--------
midori/midori-frontend.h | 4 ++--
midori/midori.vapi | 8 ++++----
tests/app.vala | 5 +++--
6 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/midori/main.c b/midori/main.c
index 433bf3d..92077ad 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -309,16 +309,20 @@ main (int argc,
if (private)
{
- midori_private_app_new (config, webapp,
+ MidoriBrowser* browser = midori_private_app_new (config, webapp,
execute ? NULL : uris, execute ? uris : NULL, inactivity_reset, block_uris);
+ g_signal_connect (browser, "destroy", G_CALLBACK (gtk_main_quit), NULL);
+ g_signal_connect (browser, "quit", G_CALLBACK (gtk_main_quit), NULL);
gtk_main ();
return 0;
}
if (webapp)
{
- midori_web_app_new (config, webapp,
+ MidoriBrowser* browser = midori_web_app_new (config, webapp,
execute ? NULL : uris, execute ? uris : NULL, inactivity_reset, block_uris);
+ g_signal_connect (browser, "destroy", G_CALLBACK (gtk_main_quit), NULL);
+ g_signal_connect (browser, "quit", G_CALLBACK (gtk_main_quit), NULL);
gtk_main ();
return 0;
}
@@ -331,6 +335,7 @@ main (int argc,
if (app == (void*)0xdeadbeef)
return 1;
+ g_signal_connect (app, "quit", G_CALLBACK (gtk_main_quit), NULL);
gtk_main ();
midori_normal_app_on_quit (app);
return 0;
diff --git a/midori/midori-app.c b/midori/midori-app.c
index b661c64..91e9f62 100644
--- a/midori/midori-app.c
+++ b/midori/midori-app.c
@@ -280,7 +280,6 @@ _midori_app_quit (MidoriApp* app)
g_unlink (config_file);
g_free (config_file);
}
- gtk_main_quit ();
}
static void
diff --git a/midori/midori-frontend.c b/midori/midori-frontend.c
index bbbf82c..4e3998b 100644
--- a/midori/midori-frontend.c
+++ b/midori/midori-frontend.c
@@ -37,7 +37,7 @@ midori_frontend_browser_new_window_cb (MidoriBrowser* browser,
return new_browser;
}
-void
+MidoriBrowser*
midori_web_app_new (const gchar* config,
const gchar* webapp,
gchar** open_uris,
@@ -84,9 +84,6 @@ midori_web_app_new (const gchar* config,
}
else if (open_uris == NULL)
midori_browser_add_uri (browser, "about:blank");
-
- g_signal_connect (browser, "quit", G_CALLBACK (gtk_main_quit), NULL);
- g_signal_connect (browser, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show (GTK_WIDGET (browser));
guint i;
@@ -101,6 +98,7 @@ midori_web_app_new (const gchar* config,
if (execute_commands != NULL)
for (i = 0; execute_commands[i] != NULL; i++)
midori_browser_activate_action (browser, execute_commands[i]);
+ return browser;
}
static void
@@ -137,7 +135,7 @@ midori_trash_add_item_cb (KatzeArray* trash,
midori_trash_remove_item_cb (trash, item);
}
-void
+MidoriBrowser*
midori_private_app_new (const gchar* config,
const gchar* webapp,
gchar** open_uris,
@@ -211,9 +209,6 @@ midori_private_app_new (const gchar* config,
}
else if (open_uris == NULL)
midori_browser_add_uri (browser, "about:private");
-
- g_signal_connect (browser, "quit", G_CALLBACK (gtk_main_quit), NULL);
- g_signal_connect (browser, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show (GTK_WIDGET (browser));
guint i;
@@ -228,6 +223,7 @@ midori_private_app_new (const gchar* config,
if (execute_commands != NULL)
for (i = 0; execute_commands[i] != NULL; i++)
midori_browser_activate_action (browser, execute_commands[i]);
+ return browser;
}
static void
diff --git a/midori/midori-frontend.h b/midori/midori-frontend.h
index 32a2233..05c90bd 100644
--- a/midori/midori-frontend.h
+++ b/midori/midori-frontend.h
@@ -14,7 +14,7 @@
#include "midori/midori-app.h"
-void
+MidoriBrowser*
midori_web_app_new (const gchar* config,
const gchar* webapp,
gchar** open_uris,
@@ -22,7 +22,7 @@ midori_web_app_new (const gchar* config,
gint inactivity_reset,
const gchar* block_uris);
-void
+MidoriBrowser*
midori_private_app_new (const gchar* config,
const gchar* webapp,
gchar** open_uris,
diff --git a/midori/midori.vapi b/midori/midori.vapi
index 5f7c9b5..61faeee 100644
--- a/midori/midori.vapi
+++ b/midori/midori.vapi
@@ -9,11 +9,11 @@ namespace Midori {
}
[CCode (cheader_filename = "midori/midori.h")]
- public static void web_app_new (string? config,
+ public static unowned Midori.Browser web_app_new (string? config,
string? webapp, [CCode (array_length = false)] string[]? uris, [CCode (array_length = false)] string[]? commands, int reset, string? block);
- public static void private_app_new (string? config,
+ public static unowned Midori.Browser private_app_new (string? config,
string? webapp, [CCode (array_length = false)] string[]? uris, [CCode (array_length = false)] string[]? commands, int reset, string? block);
- public static App normal_app_new (string? config, string nickname, bool diagnostic,
+ public static unowned App normal_app_new (string? config, string nickname, bool diagnostic,
string? webapp, [CCode (array_length = false)] string[]? uris, [CCode (array_length = false)] string[]? commands, int reset, string? block);
public static void normal_app_on_quit (App app);
@@ -81,7 +81,7 @@ namespace Midori {
[NoAccessorMethod]
public string statusbar_text { owned get; set; }
[NoAccessorMethod]
- public Midori.WebSettings settings { get; set; }
+ public Midori.WebSettings settings { owned get; set; }
[NoAccessorMethod]
public Katze.Array? bookmarks { owned get; set; }
[NoAccessorMethod]
diff --git a/tests/app.vala b/tests/app.vala
index 15c521a..f3ad9ea 100644
--- a/tests/app.vala
+++ b/tests/app.vala
@@ -43,17 +43,18 @@ void app_custom_config () {
do { loop.iteration (true); } while (loop.pending ());
Midori.normal_app_on_quit (app);
}
+
void app_private () {
Midori.Test.log_set_fatal_handler_for_icons ();
Midori.Paths.Test.reset_runtime_mode ();
- Midori.private_app_new (null, null, null, null, -1, null);
+ var browser = Midori.private_app_new (null, null, null, null, -1, null);
var loop = MainContext.default ();
do { loop.iteration (true); } while (loop.pending ());
}
void app_web () {
Midori.Paths.Test.reset_runtime_mode ();
- Midori.web_app_new (null, null, null, null, -1, null);
+ var browser = Midori.web_app_new (null, null, null, null, -1, null);
var loop = MainContext.default ();
do { loop.iteration (true); } while (loop.pending ());
}
More information about the Xfce4-commits
mailing list