[nautilus] view: hook up the overlay in the view
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] view: hook up the overlay in the view
- Date: Thu, 17 Feb 2011 16:28:57 +0000 (UTC)
commit fec9449efc444e1dc25eeebf474a59f3aa16b75d
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Feb 14 13:42:25 2011 -0500
view: hook up the overlay in the view
src/nautilus-icon-view.c | 11 +++++--
src/nautilus-list-view.c | 7 ++++-
src/nautilus-view.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++
src/nautilus-view.h | 2 +
4 files changed, 81 insertions(+), 4 deletions(-)
---
diff --git a/src/nautilus-icon-view.c b/src/nautilus-icon-view.c
index cad581e..42dadda 100644
--- a/src/nautilus-icon-view.c
+++ b/src/nautilus-icon-view.c
@@ -26,6 +26,7 @@
#include "nautilus-icon-view.h"
+#include "gedit-overlay.h"
#include "nautilus-actions.h"
#include "nautilus-icon-view-container.h"
#include "nautilus-desktop-icon-view.h"
@@ -2684,9 +2685,11 @@ static NautilusIconContainer *
create_icon_container (NautilusIconView *icon_view)
{
NautilusIconContainer *icon_container;
+ GtkWidget *overlay;
icon_container = nautilus_icon_view_container_new (icon_view);
-
+ icon_view->details->icon_container = GTK_WIDGET (icon_container);
+
gtk_widget_set_can_focus (GTK_WIDGET (icon_container), TRUE);
g_signal_connect_object (icon_container, "focus_in_event",
@@ -2740,8 +2743,10 @@ create_icon_container (NautilusIconView *icon_view)
g_signal_connect_object (icon_container, "store_layout_timestamp",
G_CALLBACK (store_layout_timestamp), icon_view, 0);
- gtk_container_add (GTK_CONTAINER (icon_view),
- GTK_WIDGET (icon_container));
+ overlay = gedit_overlay_new (GTK_WIDGET (icon_container));
+ gtk_widget_show (overlay);
+
+ nautilus_view_setup_overlay (NAUTILUS_VIEW (icon_view), overlay);
nautilus_icon_view_update_click_mode (icon_view);
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 6e43230..f6b4fb4 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -28,6 +28,7 @@
#include <config.h>
#include "nautilus-list-view.h"
+#include "gedit-overlay.h"
#include "nautilus-list-model.h"
#include "nautilus-error-reporting.h"
#include "nautilus-view-dnd.h"
@@ -1530,6 +1531,7 @@ create_and_set_up_tree_view (NautilusListView *view)
{
GtkCellRenderer *cell;
GtkTreeViewColumn *column;
+ GtkWidget *overlay;
GtkBindingSet *binding_set;
AtkObject *atk_obj;
GList *nautilus_columns;
@@ -1712,8 +1714,11 @@ create_and_set_up_tree_view (NautilusListView *view)
default_visible_columns);
gtk_widget_show (GTK_WIDGET (view->details->tree_view));
- gtk_container_add (GTK_CONTAINER (view), GTK_WIDGET (view->details->tree_view));
+ overlay = gedit_overlay_new (GTK_WIDGET (view->details->tree_view));
+ gtk_widget_show (overlay);
+
+ nautilus_view_setup_overlay (NAUTILUS_VIEW (view), overlay);
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (view->details->tree_view));
atk_object_set_name (atk_obj, _("List View"));
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 3455668..306a6b1 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -31,9 +31,11 @@
#include "nautilus-view.h"
+#include "gedit-overlay.h"
#include "nautilus-actions.h"
#include "nautilus-desktop-icon-view.h"
#include "nautilus-error-reporting.h"
+#include "nautilus-floating-bar.h"
#include "nautilus-list-view.h"
#include "nautilus-mime-actions.h"
#include "nautilus-properties-window.h"
@@ -164,6 +166,8 @@ struct NautilusViewDetails
GdkEventButton *location_popup_event;
GtkActionGroup *dir_action_group;
guint dir_merge_id;
+ GtkWidget *overlay;
+ GtkWidget *floating_bar;
GList *scripts_directory_list;
GtkActionGroup *scripts_action_group;
@@ -2980,6 +2984,15 @@ reveal_selection_idle_callback (gpointer data)
}
static void
+nautilus_view_remove_floating_bar (NautilusView *view)
+{
+ if (view->details->floating_bar != NULL) {
+ gtk_widget_destroy (view->details->floating_bar);
+ view->details->floating_bar = NULL;
+ }
+}
+
+static void
done_loading (NautilusView *view,
gboolean all_files_seen)
{
@@ -3032,6 +3045,8 @@ done_loading (NautilusView *view,
g_signal_emit (view, signals[END_LOADING], 0, all_files_seen);
+ nautilus_view_remove_floating_bar (view);
+
view->details->loading = FALSE;
}
@@ -9109,6 +9124,40 @@ load_directory (NautilusView *view,
G_CALLBACK (file_changed_callback), view);
}
+#define ACTION_ID_STOP 1
+
+static void
+floating_bar_action_cb (NautilusFloatingBar *floating_bar,
+ gint action,
+ NautilusView *view)
+{
+ if (ACTION_ID_STOP != 1) {
+ g_warning ("Unknown action clicked on the floating bar, ignoring.");
+ return;
+ }
+
+ nautilus_view_stop_loading (view);
+}
+
+static void
+nautilus_view_setup_floating_bar (NautilusView *view)
+{
+ /* setup loading overlay */
+ view->details->floating_bar = nautilus_floating_bar_new (_("Loading..."), TRUE);
+ nautilus_floating_bar_add_action (NAUTILUS_FLOATING_BAR (view->details->floating_bar),
+ GTK_STOCK_STOP,
+ ACTION_ID_STOP);
+ gtk_widget_show (view->details->floating_bar);
+
+ gedit_overlay_add (GEDIT_OVERLAY (view->details->overlay),
+ view->details->floating_bar,
+ GEDIT_OVERLAY_CHILD_POSITION_SOUTH_EAST,
+ 0);
+
+ g_signal_connect (view->details->floating_bar, "action",
+ G_CALLBACK (floating_bar_action_cb), view);
+}
+
static void
finish_loading (NautilusView *view)
{
@@ -9122,6 +9171,8 @@ finish_loading (NautilusView *view)
*/
g_signal_emit (view, signals[BEGIN_LOADING], 0);
+ nautilus_view_setup_floating_bar (view);
+
/* Assume we have now all information to show window */
nautilus_window_view_visible (view->details->window, NAUTILUS_VIEW (view));
@@ -9529,6 +9580,20 @@ real_get_selected_icon_locations (NautilusView *view)
return g_array_new (FALSE, TRUE, sizeof (GdkPoint));
}
+void
+nautilus_view_setup_overlay (NautilusView *view,
+ GtkWidget *overlay)
+{
+ if (view->details->overlay != NULL) {
+ g_warning ("Trying to add a view overlay two times, ignoring.");
+ return;
+ }
+
+ gtk_container_add (GTK_CONTAINER (view), overlay);
+
+ view->details->overlay = overlay;
+}
+
static void
nautilus_view_set_property (GObject *object,
guint prop_id,
diff --git a/src/nautilus-view.h b/src/nautilus-view.h
index 5d94a72..361a893 100644
--- a/src/nautilus-view.h
+++ b/src/nautilus-view.h
@@ -410,5 +410,7 @@ void nautilus_view_update_menus (NautilusView *v
void nautilus_view_set_is_active (NautilusView *view,
gboolean is_active);
+void nautilus_view_setup_overlay (NautilusView *view,
+ GtkWidget *overlay);
#endif /* NAUTILUS_VIEW_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]