summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2014-04-10 12:19:39 -0700
committerCosimo Cecchi <cosimoc@gnome.org>2014-04-10 12:22:34 -0700
commit955b902388838d49322f312374374be3804a8f33 (patch)
tree7848abad62b9cece33acedace5f0d2e7ce0fcac7
parent12558828114f3e3daf47c9244fb789c94c263ad9 (diff)
downloadnautilus-955b902388838d49322f312374374be3804a8f33.tar.gz
window-slot: split a function
We're going to use this code later.
-rw-r--r--src/nautilus-window-slot.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index a66d4b032..4a6baa8f3 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -317,6 +317,20 @@ hide_query_editor (NautilusWindowSlot *slot)
nautilus_query_editor_set_query (slot->details->query_editor, NULL);
}
+static GFile *
+nautilus_window_slot_get_current_location (NautilusWindowSlot *slot)
+{
+ if (slot->details->pending_location != NULL) {
+ return slot->details->pending_location;
+ }
+
+ if (slot->details->location != NULL) {
+ return slot->details->location;
+ }
+
+ return NULL;
+}
+
static void
show_query_editor (NautilusWindowSlot *slot)
{
@@ -324,12 +338,7 @@ show_query_editor (NautilusWindowSlot *slot)
NautilusSearchDirectory *search_directory;
GFile *location;
- if (slot->details->location) {
- location = slot->details->location;
- } else {
- location = slot->details->pending_location;
- }
-
+ location = nautilus_window_slot_get_current_location (slot);
directory = nautilus_directory_get (location);
if (NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
@@ -2752,12 +2761,11 @@ nautilus_window_slot_set_status (NautilusWindowSlot *slot,
char *
nautilus_window_slot_get_current_uri (NautilusWindowSlot *slot)
{
- if (slot->details->pending_location != NULL) {
- return g_file_get_uri (slot->details->pending_location);
- }
+ GFile *location;
- if (slot->details->location != NULL) {
- return g_file_get_uri (slot->details->location);
+ location = nautilus_window_slot_get_current_location (slot);
+ if (location != NULL) {
+ return g_file_get_uri (location);
}
return NULL;