[nautilus/wip/gbsneto/actionbar: 6/7] view: add ::get_action_bar() vfunc



commit 880bf8308c7c4b7e3cdddb9450c14b2d3e369ba9
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Mar 2 01:02:33 2016 -0300

    view: add ::get_action_bar() vfunc
    
    This will be used in the next patch so we can
    access the actionbar of the view.

 src/nautilus-files-view.c  |   14 ++++++++++++++
 src/nautilus-places-view.c |    7 +++++++
 src/nautilus-view.c        |   16 ++++++++++++++++
 src/nautilus-view.h        |    5 +++++
 4 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index d6dd73a..7bea40e 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -27,6 +27,7 @@
 
 #include "nautilus-files-view.h"
 
+#include "nautilus-action-bar.h"
 #include "nautilus-application.h"
 #include "nautilus-desktop-canvas-view.h"
 #include "nautilus-error-reporting.h"
@@ -274,6 +275,9 @@ struct NautilusFilesViewDetails
         GtkAdjustment *zoom_adjustment;
         GtkWidget *zoom_level_scale;
 
+        /* Action bar */
+        GtkWidget *actionbar;
+
         gulong stop_signal_handler;
         gulong reload_signal_handler;
 };
@@ -7843,6 +7847,12 @@ nautilus_files_view_key_press_event (GtkWidget   *widget,
         return GDK_EVENT_PROPAGATE;
 }
 
+static GtkWidget*
+nautilus_files_view_get_action_bar (NautilusView *view)
+{
+        return NAUTILUS_FILES_VIEW (view)->details->actionbar;
+}
+
 static NautilusQuery*
 nautilus_files_view_get_search_query (NautilusView *view)
 {
@@ -7945,6 +7955,7 @@ nautilus_files_view_is_loading (NautilusView *view)
 static void
 nautilus_files_view_iface_init (NautilusViewInterface *iface)
 {
+        iface->get_action_bar = nautilus_files_view_get_action_bar;
         iface->get_icon = nautilus_files_view_get_icon;
         iface->get_location = nautilus_files_view_get_location;
         iface->set_location = nautilus_files_view_set_location;
@@ -8150,6 +8161,9 @@ nautilus_files_view_init (NautilusFilesView *view)
 
         gtk_container_add (GTK_CONTAINER (view->details->overlay), view->details->scrolled_window);
 
+        /* Actionbar */
+        view->details->actionbar = nautilus_action_bar_new (NAUTILUS_VIEW (view));
+
         /* Empty states */
         builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-no-search-results.ui");
         view->details->no_search_results_widget = GTK_WIDGET (gtk_builder_get_object (builder, 
"no_search_results"));
diff --git a/src/nautilus-places-view.c b/src/nautilus-places-view.c
index d54a23d..5545f33 100644
--- a/src/nautilus-places-view.c
+++ b/src/nautilus-places-view.c
@@ -222,6 +222,12 @@ nautilus_places_view_set_location (NautilusView *view,
         }
 }
 
+static GtkWidget*
+nautilus_places_view_get_action_bar (NautilusView *view)
+{
+        return NULL;
+}
+
 static GList*
 nautilus_places_view_get_selection (NautilusView *view)
 {
@@ -294,6 +300,7 @@ nautilus_places_view_is_searching (NautilusView *view)
 static void
 nautilus_places_view_iface_init (NautilusViewInterface *iface)
 {
+        iface->get_action_bar = nautilus_places_view_get_action_bar;
         iface->get_icon = nautilus_places_view_get_icon;
         iface->get_location = nautilus_places_view_get_location;
         iface->set_location = nautilus_places_view_set_location;
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 30f72f9..8094330 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -110,6 +110,22 @@ nautilus_view_default_init (NautilusViewInterface *iface)
 }
 
 /**
+ * nautilus_view_get_action_bar:
+ * @view: a #NautilusView
+ *
+ * Retrieves the action bar of @view.
+ *
+ * Returns: (transfer none): a #GtkWidget or %NULL.
+ */
+GtkWidget*
+nautilus_view_get_action_bar (NautilusView *view)
+{
+        g_return_val_if_fail (NAUTILUS_VIEW_GET_IFACE (view)->get_action_bar, NULL);
+
+        return NAUTILUS_VIEW_GET_IFACE (view)->get_action_bar (view);
+}
+
+/**
  * nautilus_view_get_icon:
  * @view: a #NautilusView
  *
diff --git a/src/nautilus-view.h b/src/nautilus-view.h
index 5dd0716..7d193f3 100644
--- a/src/nautilus-view.h
+++ b/src/nautilus-view.h
@@ -35,6 +35,9 @@ struct _NautilusViewInterface
 {
         GTypeInterface parent;
 
+        /* Action bar of the view */
+        GtkWidget*           (*get_action_bar)             (NautilusView         *view);
+
         /* The icon that represents the view */
         GIcon*               (*get_icon)                   (NautilusView         *view);
 
@@ -66,6 +69,8 @@ struct _NautilusViewInterface
         gboolean             (*is_searching)               (NautilusView         *view);
 };
 
+GtkWidget*         nautilus_view_get_action_bar            (NautilusView         *view);
+
 GIcon*             nautilus_view_get_icon                  (NautilusView         *view);
 
 GtkWidget*         nautilus_view_get_view_widget           (NautilusView         *view);


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