[gtk+/places-sidebar] Turn gtk_places_sidebar_set_current_uri() into _set_current_location()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/places-sidebar] Turn gtk_places_sidebar_set_current_uri() into _set_current_location()
- Date: Sat, 24 Nov 2012 19:36:11 +0000 (UTC)
commit e0b30d013e559f26b1a7b42c037b620c561625a5
Author: Federico Mena Quintero <federico gnome org>
Date: Sat Nov 24 10:41:11 2012 -0600
Turn gtk_places_sidebar_set_current_uri() into _set_current_location()
To be consistent with the ::location-selected signal, which emits a GFile, we now also use a GFile
instead of a string URI in the inbound API.
Signed-off-by: Federico Mena Quintero <federico gnome org>
gtk/gtkplacessidebar.c | 19 ++++++++++++-------
gtk/gtkplacessidebar.h | 2 +-
2 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 6f0e7fe..2adcb1f 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -3921,27 +3921,28 @@ shortcuts_model_new (GtkPlacesSidebar *sidebar)
/* Public methods for GtkPlacesSidebar */
/**
- * gtk_places_sidebar_set_current_uri:
+ * gtk_places_sidebar_set_current_location:
* @sidebar: a places sidebar
- * @uri: URI to select, or #NULL for no current path
+ * @location: location to select, or #NULL for no current path
*
- * Sets the URI that is being shown in the widgets surrounding the @sidebar. In turn,
- * it will highlight that URI if it is being shown in the list of places, or it will
- * unhighlight everything if the URI is not among the places in the list.
+ * Sets the location that is being shown in the widgets surrounding the @sidebar. In turn,
+ * it will highlight that location if it is being shown in the list of places, or it will
+ * unhighlight everything if the location is not among the places in the list.
*/
void
-gtk_places_sidebar_set_current_uri (GtkPlacesSidebar *sidebar, const char *uri)
+gtk_places_sidebar_set_current_location (GtkPlacesSidebar *sidebar, GFile *location)
{
GtkTreeSelection *selection;
GtkTreeIter iter;
gboolean valid;
char *iter_uri;
+ char *uri;
g_return_if_fail (GTK_IS_PLACES_SIDEBAR (sidebar));
selection = gtk_tree_view_get_selection (sidebar->tree_view);
- if (uri == NULL) {
+ if (location == NULL) {
g_free (sidebar->uri);
sidebar->uri = NULL;
@@ -3949,6 +3950,8 @@ gtk_places_sidebar_set_current_uri (GtkPlacesSidebar *sidebar, const char *uri)
return;
}
+ uri = g_file_get_uri (location);
+
if (sidebar->uri == NULL || strcmp (sidebar->uri, uri) != 0) {
g_free (sidebar->uri);
sidebar->uri = g_strdup (uri);
@@ -3972,6 +3975,8 @@ gtk_places_sidebar_set_current_uri (GtkPlacesSidebar *sidebar, const char *uri)
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (sidebar->store), &iter);
}
}
+
+ g_free (uri);
}
/**
diff --git a/gtk/gtkplacessidebar.h b/gtk/gtkplacessidebar.h
index 98bac73..093357c 100644
--- a/gtk/gtkplacessidebar.h
+++ b/gtk/gtkplacessidebar.h
@@ -55,7 +55,7 @@ GtkWidget *gtk_places_sidebar_new (void);
/* FIXME: add GObject properties for the following things */
-void gtk_places_sidebar_set_current_uri (GtkPlacesSidebar *sidebar, const char *uri);
+void gtk_places_sidebar_set_current_location (GtkPlacesSidebar *sidebar, GFile *location);
void gtk_places_sidebar_set_multiple_tabs_supported (GtkPlacesSidebar *sidebar, gboolean supported);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]