[nautilus/wip/gbsneto/actionbar-final: 20/24] view: add ::get_action_bar() vfunc



commit 2ef39ae812275d6633c81c59eafee2f08ae5d989
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 a9168dd..0dff075 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-error-reporting.h"
 #include "nautilus-floating-bar.h"
@@ -271,6 +272,9 @@ struct NautilusFilesViewDetails
         GtkAdjustment *zoom_adjustment;
         GtkWidget *zoom_level_scale;
 
+        /* Action bar */
+        GtkWidget *actionbar;
+
         gulong stop_signal_handler;
         gulong reload_signal_handler;
 };
@@ -7891,6 +7895,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)
 {
@@ -7993,6 +8003,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;
@@ -8206,6 +8217,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 96d290e..b0094d5 100644
--- a/src/nautilus-places-view.c
+++ b/src/nautilus-places-view.c
@@ -246,6 +246,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)
 {
@@ -318,6 +324,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 2bc9a13..6bfa921 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]