[gtk+/wip/matthiasc/filechooser: 2/24] places sidebar: Add private api to get title



commit b0d48219a68e9893b3a4cffecd4fe4546b4931dd
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 26 21:13:00 2015 -0400

    places sidebar: Add private api to get title
    
    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        |   17 +++++++++++++++++
 gtk/gtkplacessidebarprivate.h |    3 +++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 1344e42..6c3d2cc 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -4418,6 +4418,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
diff --git a/gtk/gtkplacessidebarprivate.h b/gtk/gtkplacessidebarprivate.h
index dd5f34b..520141f 100644
--- a/gtk/gtkplacessidebarprivate.h
+++ b/gtk/gtkplacessidebarprivate.h
@@ -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__ */


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