places sidebar: Add private api to get title
authorMatthias Clasen <mclasen@redhat.com>
Sat, 27 Jun 2015 01:13:00 +0000 (21:13 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 4 Jul 2015 04:29:24 +0000 (00:29 -0400)
The places sidebar already does all the work to determine the
right label to use for the current location of the filechooser.
We want to use the same label in the headerbar subtitle, so
add some private API to get it.

gtk/gtkplacessidebar.c
gtk/gtkplacessidebarprivate.h

index 0a19fa830f6a3025bf0e9a81c51d45239740ca82..860769b8f6f24feaf3897adc7bd75c1838cd8d77 100644 (file)
@@ -4416,6 +4416,23 @@ gtk_places_sidebar_get_location (GtkPlacesSidebar *sidebar)
   return file;
 }
 
+gchar *
+gtk_places_sidebar_get_location_title (GtkPlacesSidebar *sidebar)
+{
+  GtkListBoxRow *selected;
+  gchar *title;
+
+  g_return_val_if_fail (sidebar != NULL, NULL);
+
+  title = NULL;
+  selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (sidebar->list_box));
+
+  if (selected)
+    g_object_get (selected, "label", &title, NULL);
+
+  return title;
+}
+
 /**
  * gtk_places_sidebar_set_show_recent:
  * @sidebar: a places sidebar
index dd5f34b571199d7a8f0c6e01452987fa82f8ae3f..520141f41875a93728a4060a736e013b177c3f7e 100644 (file)
@@ -22,6 +22,7 @@
 #define __GTK_PLACES_SIDEBAR_PRIVATE_H__
 
 #include <glib.h>
+#include "gtkplacessidebar.h"
 
 G_BEGIN_DECLS
 
@@ -49,6 +50,8 @@ typedef enum {
   N_PLACES
 } GtkPlacesSidebarPlaceType;
 
+gchar *gtk_places_sidebar_get_location_title (GtkPlacesSidebar *sidebar);
+
 G_END_DECLS
 
 #endif /* __GTK_PLACES_SIDEBAR_PRIVATE_H__ */