[nautilus] all: use g_application_get_default()



commit 011cae05122b8ff32c919826597bfbadbca9e7fa
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Apr 25 13:23:32 2012 -0400

    all: use g_application_get_default()
    
    Instead of nautilus_application_get_singleton()

 src/nautilus-connect-server-dialog-nonmain.c |    2 +-
 src/nautilus-location-bar.c                  |    2 +-
 src/nautilus-places-sidebar.c                |    4 ++--
 src/nautilus-progress-ui-handler.c           |    9 ++-------
 src/nautilus-window-manage-views.c           |   12 +++++-------
 src/nautilus-window-menus.c                  |   12 ++----------
 6 files changed, 13 insertions(+), 28 deletions(-)
---
diff --git a/src/nautilus-connect-server-dialog-nonmain.c b/src/nautilus-connect-server-dialog-nonmain.c
index bcf29a4..4d0a8ed 100644
--- a/src/nautilus-connect-server-dialog-nonmain.c
+++ b/src/nautilus-connect-server-dialog-nonmain.c
@@ -76,7 +76,7 @@ nautilus_connect_server_dialog_display_location_async (NautilusConnectServerDial
 					   callback, user_data,
 					   nautilus_connect_server_dialog_display_location_async);
 
-	window = nautilus_application_create_window (nautilus_application_get_singleton (),
+	window = nautilus_application_create_window (NAUTILUS_APPLICATION (g_application_get_default ()),
 						     gtk_widget_get_screen (widget));
 
 	nautilus_window_go_to_full (window, location,
diff --git a/src/nautilus-location-bar.c b/src/nautilus-location-bar.c
index 18a6882..336e966 100644
--- a/src/nautilus-location-bar.c
+++ b/src/nautilus-location-bar.c
@@ -200,7 +200,7 @@ drag_data_received_callback (GtkWidget *widget,
 	if (new_windows_for_extras) {
 		int i;
 
-		application = nautilus_application_get_singleton ();
+		application = NAUTILUS_APPLICATION (g_application_get_default ());
 		screen = gtk_window_get_screen (GTK_WINDOW (window));
 
 		for (i = 1; names[i] != NULL; ++i) {
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index 5816768..a5b366e 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -1802,7 +1802,7 @@ volume_mounted_cb (GVolume *volume,
 				NautilusWindow *new, *cur;
 
 				cur = NAUTILUS_WINDOW (sidebar->window);
-				new = nautilus_application_create_window (nautilus_application_get_singleton (),
+				new = nautilus_application_create_window (NAUTILUS_APPLICATION (g_application_get_default ()),
 									  gtk_window_get_screen (GTK_WINDOW (cur)));
 				nautilus_window_go_to (new, location);
 			}
@@ -1870,7 +1870,7 @@ open_selected_bookmark (NautilusPlacesSidebar *sidebar,
 			NautilusWindow *cur, *new;
 			
 			cur = NAUTILUS_WINDOW (sidebar->window);
-			new = nautilus_application_create_window (nautilus_application_get_singleton (),
+			new = nautilus_application_create_window (NAUTILUS_APPLICATION (g_application_get_default ()),
 								  gtk_window_get_screen (GTK_WINDOW (cur)));
 			nautilus_window_go_to (new, location);
 		}
diff --git a/src/nautilus-progress-ui-handler.c b/src/nautilus-progress-ui-handler.c
index 803ccfe..5598cf5 100644
--- a/src/nautilus-progress-ui-handler.c
+++ b/src/nautilus-progress-ui-handler.c
@@ -382,23 +382,18 @@ static void
 release_application (NautilusProgressInfo *info,
 		     NautilusProgressUIHandler *self)
 {
-	NautilusApplication *app;
-
 	/* release the GApplication hold we acquired */
-	app = nautilus_application_get_singleton ();
-	g_application_release (G_APPLICATION (app));
+	g_application_release (g_application_get_default ());
 }
 
 static void
 progress_info_started_cb (NautilusProgressInfo *info,
 			  NautilusProgressUIHandler *self)
 {
-	NautilusApplication *app;
 	TimeoutData *data;
 
 	/* hold GApplication so we never quit while there's an operation pending */
-	app = nautilus_application_get_singleton ();
-	g_application_hold (G_APPLICATION (app));
+	g_application_hold (g_application_get_default ());
 
 	g_signal_connect (info, "finished",
 			  G_CALLBACK (release_application), self);
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 83f1bc5..7e42f46 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -417,7 +417,6 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
 	GList *l;
 	gboolean use_same;
 	gboolean is_desktop;
-	NautilusApplication *app;
 
 	window = nautilus_window_slot_get_window (slot);
 
@@ -468,9 +467,8 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
 	if (use_same) {
 		target_window = window;
 	} else {
-		app = nautilus_application_get_singleton ();
 		target_window = nautilus_application_create_window
-			(app,
+			(NAUTILUS_APPLICATION (g_application_get_default ()),
 			 gtk_window_get_screen (GTK_WINDOW (window)));
 	}
 
@@ -772,7 +770,7 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
 	GFile *location;
 	GMountOperation *mount_op;
 	MountNotMountedData *data;
-	NautilusApplication *app;
+	GtkApplication *app;
 
 	slot = callback_data;
 	window = nautilus_window_slot_get_window (slot);
@@ -887,9 +885,9 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
 			 */
 			/* if this is the only window, we don't want to quit, so we redirect it to home */
 
-			app = nautilus_application_get_singleton ();
-			
-			if (g_list_length (gtk_application_get_windows (GTK_APPLICATION (app))) == 1) {
+			app = GTK_APPLICATION (g_application_get_default ());
+
+			if (g_list_length (gtk_application_get_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 */
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index 4fd0217..924785b 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -683,16 +683,8 @@ static void
 action_new_window_callback (GtkAction *action,
 			    gpointer user_data)
 {
-	NautilusApplication *application;
-	NautilusWindow *current_window, *new_window;
-
-	current_window = NAUTILUS_WINDOW (user_data);
-	application = nautilus_application_get_singleton ();
-
-	new_window = nautilus_application_create_window (
-				application,
-				gtk_window_get_screen (GTK_WINDOW (current_window)));
-	nautilus_window_slot_go_home (nautilus_window_get_active_slot (new_window), 0);
+	g_action_group_activate_action (G_ACTION_GROUP (g_application_get_default ()),
+					"new-window", NULL);
 }
 
 static void



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