[nautilus/gtk3-breakage] [src] use new GtkApplication API to handle windows



commit bc3b89a5a6042312285ab18e167c246ae756bfe6
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Oct 27 13:19:14 2010 +0200

    [src] use new GtkApplication API to handle windows
    
    Instead of old nautilus-main/NautilusApplication functions to register
    windows within the mainloop.

 src/nautilus-application-smclient.c    |    4 ++--
 src/nautilus-navigation-window-menus.c |    7 ++++++-
 src/nautilus-window-manage-views.c     |    9 +++++++--
 src/nautilus-window.c                  |   14 +++++++-------
 4 files changed, 22 insertions(+), 12 deletions(-)
---
diff --git a/src/nautilus-application-smclient.c b/src/nautilus-application-smclient.c
index 924361c..af2abba 100644
--- a/src/nautilus-application-smclient.c
+++ b/src/nautilus-application-smclient.c
@@ -84,7 +84,7 @@ nautilus_application_get_session_data (NautilusApplication *self)
 		}
 	}
 
-	window_list = nautilus_application_get_window_list ();
+	window_list = gtk_application_get_windows (GTK_APPLICATION (self));
 
 	for (l = window_list; l != NULL; l = l->next) {
 		xmlNodePtr win_node, slot_node;
@@ -395,7 +395,7 @@ static void
 smclient_quit_cb (EggSMClient   *client,
 		  NautilusApplication *application)
 {
-	nautilus_main_event_loop_quit (TRUE);
+	g_application_release (G_APPLICATION (application));
 }
 
 void
diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c
index 6f3fa0e..f7d8051 100644
--- a/src/nautilus-navigation-window-menus.c
+++ b/src/nautilus-navigation-window-menus.c
@@ -67,7 +67,12 @@ static void
 action_close_all_windows_callback (GtkAction *action, 
 				   gpointer user_data)
 {
-	nautilus_application_close_all_navigation_windows ();
+	NautilusApplication *app;
+
+	app = nautilus_application_dup_singleton ();
+	nautilus_application_close_all_navigation_windows (app);
+
+	g_object_unref (app);
 }
 
 static gboolean
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 66013ef..a294e54 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -1181,9 +1181,12 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
 			 * happens when a new window cannot display its initial URI. 
 			 */
 			/* if this is the only window, we don't want to quit, so we redirect it to home */
-			if (nautilus_application_get_n_windows () <= 1) {
-				g_assert (nautilus_application_get_n_windows () == 1);
 
+			NautilusApplication *app;
+
+			app = nautilus_application_dup_singleton ();
+			
+			if (nautilus_application_get_n_windows (app) == 1) {
 				/* the user could have typed in a home directory that doesn't exist,
 				   in which case going home would cause an infinite loop, so we
 				   better test for that */
@@ -1206,6 +1209,8 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
 				/* Since this is a window, destroying it will also unref it. */
 				gtk_widget_destroy (GTK_WIDGET (window));
 			}
+
+			g_object_unref (app);
 		} else {
 			/* Clean up state of already-showing window */
 			end_location_change (slot);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index e861c1b..5cd59c8 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -184,11 +184,6 @@ nautilus_window_init (NautilusWindow *window)
 	/* Register to menu provider extension signal managing menu updates */
 	g_signal_connect_object (nautilus_signaller_get_current (), "popup_menu_changed",
 			 G_CALLBACK (nautilus_window_load_extension_menus), window, G_CONNECT_SWAPPED);
-
-	gtk_quit_add_destroy (1, GTK_WIDGET (window));
-
-	/* Keep the main event loop alive as long as the window exists */
-	nautilus_main_event_loop_register (GTK_WIDGET (window));
 }
 
 /* Unconditionally synchronize the GtkUIManager of WINDOW. */
@@ -1755,12 +1750,15 @@ nautilus_forget_history (void)
 	NautilusWindowSlot *slot;
 	NautilusNavigationWindowSlot *navigation_slot;
 	GList *window_node, *l, *walk;
+	NautilusApplication *app;
+
+	app = nautilus_application_dup_singleton ();
 
 	/* Clear out each window's back & forward lists. Also, remove 
 	 * each window's current location bookmark from history list 
 	 * so it doesn't get clobbered.
 	 */
-	for (window_node = nautilus_application_get_window_list ();
+	for (window_node = gtk_application_get_windows (GTK_APPLICATION (app));
 	     window_node != NULL;
 	     window_node = window_node->next) {
 
@@ -1797,7 +1795,7 @@ nautilus_forget_history (void)
 	free_history_list ();
 
 	/* Re-add each window's current location to history list. */
-	for (window_node = nautilus_application_get_window_list ();
+	for (window_node = gtk_application_get_windows (GTK_APPLICATION (app));
 	     window_node != NULL;
 	     window_node = window_node->next) {
 		NautilusWindow *window;
@@ -1813,6 +1811,8 @@ nautilus_forget_history (void)
 			}
 		}
 	}
+
+	g_object_unref (app);
 }
 
 GList *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]