[nautilus] all: use nautilus_window_slot_get_window()
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] all: use nautilus_window_slot_get_window()
- Date: Mon, 9 Jan 2012 22:25:58 +0000 (UTC)
commit ed97a6ec6db1a618bc65705618e5b73748e4cd7e
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Jan 6 15:23:04 2012 +0100
all: use nautilus_window_slot_get_window()
src/nautilus-window-manage-views.c | 50 +++++++++++++++---------------------
src/nautilus-window-pane.c | 3 +-
src/nautilus-window-slot.c | 32 +++++++++-------------
src/nautilus-window.c | 5 +--
4 files changed, 38 insertions(+), 52 deletions(-)
---
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index b2d78ac..2197b58 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -296,12 +296,10 @@ viewed_file_changed_callback (NautilusFile *file,
GFile *new_location;
gboolean is_in_trash, was_in_trash;
- window = slot->pane->window;
+ window = nautilus_window_slot_get_window (slot);
g_assert (NAUTILUS_IS_FILE (file));
g_assert (NAUTILUS_IS_WINDOW_PANE (slot->pane));
- g_assert (NAUTILUS_IS_WINDOW (window));
-
g_assert (file == slot->viewed_file);
if (!nautilus_file_is_not_yet_confirmed (file)) {
@@ -459,7 +457,7 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
gboolean is_desktop;
NautilusApplication *app;
- window = slot->pane->window;
+ window = nautilus_window_slot_get_window (slot);
target_window = NULL;
target_slot = NULL;
@@ -603,7 +601,7 @@ report_current_content_view_failure_to_user (NautilusWindowSlot *slot)
NautilusWindow *window;
char *message;
- window = slot->pane->window;
+ window = nautilus_window_slot_get_window (slot);
message = nautilus_window_slot_get_view_startup_error_label (slot);
eel_show_error_dialog (message,
@@ -619,7 +617,7 @@ report_nascent_content_view_failure_to_user (NautilusWindowSlot *slot,
NautilusWindow *window;
char *message;
- window = slot->pane->window;
+ window = nautilus_window_slot_get_window (slot);
/* TODO? why are we using the current view's error label here, instead of the next view's?
* This behavior has already been present in pre-slot days.
@@ -656,7 +654,8 @@ report_callback (NautilusWindowSlot *slot,
GError *error)
{
if (slot->open_callback != NULL) {
- slot->open_callback (slot->pane->window, error, slot->open_callback_user_data);
+ slot->open_callback (nautilus_window_slot_get_window (slot),
+ error, slot->open_callback_user_data);
slot->open_callback = NULL;
slot->open_callback_user_data = NULL;
@@ -863,12 +862,9 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
NautilusApplication *app;
slot = callback_data;
- g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
- g_assert (slot->determine_view_file == file);
-
- window = slot->pane->window;
- g_assert (NAUTILUS_IS_WINDOW (window));
+ window = nautilus_window_slot_get_window (slot);
+ g_assert (slot->determine_view_file == file);
slot->determine_view_file = NULL;
if (slot->mount_error) {
@@ -1054,7 +1050,7 @@ create_content_view (NautilusWindowSlot *slot,
NautilusView *view;
GList *selection;
- window = slot->pane->window;
+ window = nautilus_window_slot_get_window (slot);
/* FIXME bugzilla.gnome.org 41243:
* We should use inheritance instead of these special cases
@@ -1124,11 +1120,8 @@ load_new_location (NautilusWindowSlot *slot,
g_assert (slot != NULL);
g_assert (location != NULL);
- window = slot->pane->window;
- g_assert (NAUTILUS_IS_WINDOW (window));
-
+ window = nautilus_window_slot_get_window (slot);
selection_copy = eel_g_object_list_copy (selection);
-
view = NULL;
/* Note, these may recurse into report_load_underway */
@@ -1222,7 +1215,7 @@ real_setup_loading_floating_bar (NautilusWindowSlot *slot)
{
gboolean disable_chrome;
- g_object_get (slot->pane->window,
+ g_object_get (nautilus_window_slot_get_window (slot),
"disable-chrome", &disable_chrome,
NULL);
@@ -1281,7 +1274,7 @@ location_has_really_changed (NautilusWindowSlot *slot)
GtkWidget *widget;
GFile *location_copy;
- window = slot->pane->window;
+ window = nautilus_window_slot_get_window (slot);
if (slot->new_content_view != NULL) {
widget = GTK_WIDGET (slot->new_content_view);
@@ -1322,15 +1315,17 @@ slot_add_extension_extra_widgets (NautilusWindowSlot *slot)
GList *providers, *l;
GtkWidget *widget;
char *uri;
+ NautilusWindow *window;
providers = nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_LOCATION_WIDGET_PROVIDER);
+ window = nautilus_window_slot_get_window (slot);
uri = g_file_get_uri (slot->location);
for (l = providers; l != NULL; l = l->next) {
NautilusLocationWidgetProvider *provider;
provider = NAUTILUS_LOCATION_WIDGET_PROVIDER (l->data);
- widget = nautilus_location_widget_provider_get_widget (provider, uri, GTK_WIDGET (slot->pane->window));
+ widget = nautilus_location_widget_provider_get_widget (provider, uri, GTK_WIDGET (window));
if (widget != NULL) {
nautilus_window_slot_add_extra_location_widget (slot, widget);
}
@@ -1458,8 +1453,7 @@ update_for_new_location (NautilusWindowSlot *slot)
gboolean location_really_changed;
FindMountData *data;
- window = slot->pane->window;
-
+ window = nautilus_window_slot_get_window (slot);
new_location = slot->pending_location;
slot->pending_location = NULL;
@@ -1617,8 +1611,7 @@ free_location_change (NautilusWindowSlot *slot)
{
NautilusWindow *window;
- window = slot->pane->window;
- g_assert (NAUTILUS_IS_WINDOW (window));
+ window = nautilus_window_slot_get_window (slot);
if (slot->pending_location) {
g_object_unref (slot->pending_location);
@@ -1841,8 +1834,7 @@ nautilus_window_slot_stop_loading (NautilusWindowSlot *slot)
{
NautilusWindow *window;
- window = NAUTILUS_WINDOW (slot->pane->window);
- g_assert (NAUTILUS_IS_WINDOW (window));
+ window = nautilus_window_slot_get_window (slot);
nautilus_view_stop_loading (slot->content_view);
@@ -1867,8 +1859,7 @@ nautilus_window_slot_set_content_view (NautilusWindowSlot *slot,
g_assert (slot->location != NULL);
g_assert (id != NULL);
- window = slot->pane->window;
- g_assert (NAUTILUS_IS_WINDOW (window));
+ window = nautilus_window_slot_get_window (slot);
uri = nautilus_window_slot_get_location_uri (slot);
DEBUG ("Change view of window %s to %s", uri, id);
@@ -1902,7 +1893,8 @@ nautilus_window_manage_views_close_slot (NautilusWindowPane *pane,
NautilusWindowSlot *slot)
{
if (slot->content_view != NULL) {
- nautilus_window_disconnect_content_view (slot->pane->window, slot->content_view);
+ nautilus_window_disconnect_content_view (nautilus_window_slot_get_window (slot),
+ slot->content_view);
}
free_location_change (slot);
diff --git a/src/nautilus-window-pane.c b/src/nautilus-window-pane.c
index 0c4543a..fb79484 100644
--- a/src/nautilus-window-pane.c
+++ b/src/nautilus-window-pane.c
@@ -591,7 +591,8 @@ notebook_switch_page_cb (GtkNotebook *notebook,
slot = nautilus_window_pane_get_slot_for_content_box (pane, widget);
g_assert (slot != NULL);
- nautilus_window_set_active_slot (slot->pane->window, slot);
+ nautilus_window_set_active_slot (nautilus_window_slot_get_window (slot),
+ slot);
return FALSE;
}
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index c030d6c..54dcb78 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -76,11 +76,11 @@ real_update_query_editor (NautilusWindowSlot *slot)
NautilusQuery *query;
GtkWidget *query_editor;
gboolean slot_is_active;
+ NautilusWindow *window;
- g_assert (slot->pane->window != NULL);
-
+ window = nautilus_window_slot_get_window (slot);
query_editor = NULL;
- slot_is_active = (slot == nautilus_window_get_active_slot (slot->pane->window));
+ slot_is_active = (slot == nautilus_window_get_active_slot (window));
directory = nautilus_directory_get (slot->location);
if (NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
@@ -127,8 +127,7 @@ real_active (NautilusWindowSlot *slot)
NautilusWindowPane *pane;
int page_num;
- window = slot->pane->window;
-
+ window = nautilus_window_slot_get_window (slot);
pane = slot->pane;
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (pane->notebook),
slot->content_box);
@@ -155,7 +154,7 @@ real_inactive (NautilusWindowSlot *slot)
{
NautilusWindow *window;
- window = NAUTILUS_WINDOW (slot->pane->window);
+ window = nautilus_window_slot_get_window (slot);
g_assert (slot == nautilus_window_get_active_slot (window));
}
@@ -303,7 +302,6 @@ GFile *
nautilus_window_slot_get_location (NautilusWindowSlot *slot)
{
g_assert (slot != NULL);
- g_assert (NAUTILUS_IS_WINDOW (slot->pane->window));
if (slot->location != NULL) {
return g_object_ref (slot->location);
@@ -325,10 +323,10 @@ nautilus_window_slot_get_location_uri (NautilusWindowSlot *slot)
void
nautilus_window_slot_make_hosting_pane_active (NautilusWindowSlot *slot)
{
- g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
g_assert (NAUTILUS_IS_WINDOW_PANE (slot->pane));
- nautilus_window_set_active_slot (slot->pane->window, slot);
+ nautilus_window_set_active_slot (nautilus_window_slot_get_window (slot),
+ slot);
}
NautilusWindow *
@@ -353,7 +351,7 @@ nautilus_window_slot_update_title (NautilusWindowSlot *slot)
gboolean do_sync = FALSE;
title = nautilus_compute_title_for_location (slot->location);
- window = NAUTILUS_WINDOW (slot->pane->window);
+ window = nautilus_window_slot_get_window (slot);
if (g_strcmp0 (title, slot->title) != 0) {
do_sync = TRUE;
@@ -391,10 +389,7 @@ nautilus_window_slot_update_icon (NautilusWindowSlot *slot)
const char *icon_name;
GdkPixbuf *pixbuf;
- window = slot->pane->window;
-
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
+ window = nautilus_window_slot_get_window (slot);
info = NAUTILUS_WINDOW_CLASS (G_OBJECT_GET_CLASS (window))->get_icon (window, slot);
icon_name = NULL;
@@ -428,8 +423,7 @@ nautilus_window_slot_set_content_view_widget (NautilusWindowSlot *slot,
NautilusWindow *window;
GtkWidget *widget;
- window = slot->pane->window;
- g_assert (NAUTILUS_IS_WINDOW (window));
+ window = nautilus_window_slot_get_window (slot);
if (slot->content_view != NULL) {
/* disconnect old view */
@@ -464,7 +458,7 @@ nautilus_window_slot_set_allow_stop (NautilusWindowSlot *slot,
slot->allow_stop = allow;
- window = NAUTILUS_WINDOW (slot->pane->window);
+ window = nautilus_window_slot_get_window (slot);
nautilus_window_sync_allow_stop (window, slot);
}
@@ -483,7 +477,7 @@ real_slot_set_short_status (NautilusWindowSlot *slot,
show_statusbar = g_settings_get_boolean (nautilus_window_state,
NAUTILUS_WINDOW_STATE_START_WITH_STATUS_BAR);
- g_object_get (slot->pane->window,
+ g_object_get (nautilus_window_slot_get_window (slot),
"disable-chrome", &disable_chrome,
NULL);
@@ -573,7 +567,7 @@ nautilus_window_slot_set_status (NautilusWindowSlot *slot,
set_floating_bar_status (slot, short_status);
}
- window = NAUTILUS_WINDOW (slot->pane->window);
+ window = nautilus_window_slot_get_window (slot);
if (slot == nautilus_window_get_active_slot (window)) {
nautilus_window_sync_status (window);
}
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 8d54e61..c31f9d1 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -898,9 +898,8 @@ nautilus_window_set_active_slot (NautilusWindow *window, NautilusWindowSlot *new
DEBUG ("Setting new slot %p as active", new_slot);
if (new_slot) {
- g_assert (NAUTILUS_IS_WINDOW_SLOT (new_slot));
+ g_assert ((window == nautilus_window_slot_get_window (new_slot)));
g_assert (NAUTILUS_IS_WINDOW_PANE (new_slot->pane));
- g_assert (window == new_slot->pane->window);
g_assert (g_list_find (new_slot->pane->slots, new_slot) != NULL);
}
@@ -1351,7 +1350,7 @@ load_view_as_menus_callback (NautilusFile *file,
NautilusWindowSlot *slot;
slot = callback_data;
- window = slot->pane->window;
+ window = nautilus_window_slot_get_window (slot);
if (slot == nautilus_window_get_active_slot (window)) {
load_view_as_menu (window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]