summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-07-04 13:27:22 +0200
committerraveit65 <[email protected]>2016-07-11 22:28:14 +0200
commitc75269f5b317ffa20142d640108ab64b85835e09 (patch)
tree8cc7176bcb1fe618de8d51c5e8df51d3ef82f431
parent5968f6bb40c334a797175ebeeb946d76163ce288 (diff)
downloadcaja-c75269f5b317ffa20142d640108ab64b85835e09.tar.bz2
caja-c75269f5b317ffa20142d640108ab64b85835e09.tar.xz
navigation-bar: remove useless abstract class
Merge the useful pieces into CajaLocationBar itself, which is the only implementor anyway. taken from: https://git.gnome.org/browse/nautilus/commit/?h=gnome-3-6&id=ca1fa0c https://git.gnome.org/browse/nautilus/commit/?h=gnome-3-0&id=66c46dd
-rw-r--r--src/Makefile.am2
-rw-r--r--src/caja-location-bar.c282
-rw-r--r--src/caja-location-bar.h12
-rw-r--r--src/caja-navigation-bar.c167
-rw-r--r--src/caja-navigation-bar.h77
-rw-r--r--src/caja-navigation-window-pane.c9
-rw-r--r--src/caja-navigation-window.c6
7 files changed, 152 insertions, 403 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 37bf1f54..45817454 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -108,8 +108,6 @@ caja_SOURCES = \
caja-main.h \
caja-navigation-action.c \
caja-navigation-action.h \
- caja-navigation-bar.c \
- caja-navigation-bar.h \
caja-navigation-window-menus.c \
caja-navigation-window.c \
caja-navigation-window.h \
diff --git a/src/caja-location-bar.c b/src/caja-location-bar.c
index e72924e5..64ccc87e 100644
--- a/src/caja-location-bar.c
+++ b/src/caja-location-bar.c
@@ -43,6 +43,7 @@
#include <eel/eel-stock-dialogs.h>
#include <eel/eel-string.h>
#include <eel/eel-vfs-extensions.h>
+#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <libcaja-private/caja-icon-dnd.h>
@@ -80,6 +81,14 @@ enum
CAJA_DND_NTARGETS
};
+enum {
+ CANCEL,
+ LOCATION_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
static const GtkTargetEntry drag_types [] =
{
{ CAJA_DND_URI_LIST_TYPE, 0, CAJA_DND_URI_LIST },
@@ -92,16 +101,7 @@ static const GtkTargetEntry drop_types [] =
{ CAJA_DND_TEXT_PLAIN_TYPE, 0, CAJA_DND_TEXT_PLAIN },
};
-static char *caja_location_bar_get_location (CajaNavigationBar *navigation_bar);
-static void caja_location_bar_set_location (CajaNavigationBar *navigation_bar,
- const char *location);
-static void caja_location_bar_class_init (CajaLocationBarClass *class);
-static void caja_location_bar_init (CajaLocationBar *bar);
-static void caja_location_bar_update_label (CajaLocationBar *bar);
-
-EEL_CLASS_BOILERPLATE (CajaLocationBar,
- caja_location_bar,
- CAJA_TYPE_NAVIGATION_BAR)
+G_DEFINE_TYPE (CajaLocationBar, caja_location_bar, GTK_TYPE_HBOX);
static CajaNavigationWindow *
caja_location_bar_get_window (GtkWidget *bar)
@@ -109,6 +109,44 @@ caja_location_bar_get_window (GtkWidget *bar)
return CAJA_NAVIGATION_WINDOW (gtk_widget_get_ancestor (bar, CAJA_TYPE_WINDOW));
}
+/**
+ * caja_location_bar_get_location
+ *
+ * Get the "URI" represented by the text in the location bar.
+ *
+ * @bar: A CajaLocationBar.
+ *
+ * returns a newly allocated "string" containing the mangled
+ * (by g_file_parse_name) text that the user typed in...maybe a URI
+ * but not guaranteed.
+ *
+ **/
+static char *
+caja_location_bar_get_location (CajaLocationBar *bar)
+{
+ char *user_location, *uri;
+ GFile *location;
+
+ user_location = gtk_editable_get_chars (GTK_EDITABLE (bar->details->entry), 0, -1);
+ location = g_file_parse_name (user_location);
+ g_free (user_location);
+ uri = g_file_get_uri (location);
+ g_object_unref (location);
+ return uri;
+}
+
+static void
+emit_location_changed (CajaLocationBar *bar)
+{
+ char *location;
+
+ location = caja_location_bar_get_location (bar);
+ g_signal_emit (bar,
+ signals[LOCATION_CHANGED], 0,
+ location);
+ g_free (location);
+}
+
static void
drag_data_received_callback (GtkWidget *widget,
GdkDragContext *context,
@@ -129,8 +167,8 @@ drag_data_received_callback (GtkWidget *widget,
char *prompt;
char *detail;
GFile *location;
+ CajaLocationBar *self = CAJA_LOCATION_BAR (widget);
- g_assert (CAJA_IS_LOCATION_BAR (widget));
g_assert (data != NULL);
g_assert (callback_data == NULL);
@@ -183,9 +221,8 @@ drag_data_received_callback (GtkWidget *widget,
}
}
- caja_navigation_bar_set_location (CAJA_NAVIGATION_BAR (widget),
- names[0]);
- caja_navigation_bar_location_changed (CAJA_NAVIGATION_BAR (widget));
+ caja_location_bar_set_location (self, names[0]);
+ emit_location_changed (self);
if (new_windows_for_extras)
{
@@ -216,13 +253,13 @@ drag_data_get_callback (GtkWidget *widget,
guint32 time,
gpointer callback_data)
{
- CajaNavigationBar *bar;
+ CajaLocationBar *self;
char *entry_text;
g_assert (selection_data != NULL);
- bar = CAJA_NAVIGATION_BAR (callback_data);
+ self = callback_data;
- entry_text = caja_navigation_bar_get_location (bar);
+ entry_text = caja_location_bar_get_location (self);
switch (info)
{
@@ -320,16 +357,52 @@ static void
editable_activate_callback (GtkEntry *entry,
gpointer user_data)
{
- CajaNavigationBar *bar;
+ CajaLocationBar *self = user_data;
const char *entry_text;
- bar = CAJA_NAVIGATION_BAR (user_data);
-
entry_text = gtk_entry_get_text (entry);
if (entry_text != NULL && *entry_text != '\0')
{
- caja_navigation_bar_location_changed (bar);
+ emit_location_changed (self);
+ }
+}
+
+/**
+ * caja_location_bar_update_label
+ *
+ * if the text in the entry matches the uri, set the label to "location", otherwise use "goto"
+ *
+ **/
+static void
+caja_location_bar_update_label (CajaLocationBar *bar)
+{
+ const char *current_text;
+ GFile *location;
+ GFile *last_location;
+
+ if (bar->details->last_location == NULL){
+ gtk_label_set_text (GTK_LABEL (bar->details->label), GO_TO_LABEL);
+ caja_location_entry_set_secondary_action (CAJA_LOCATION_ENTRY (bar->details->entry),
+ CAJA_LOCATION_ENTRY_ACTION_GOTO);
+ return;
}
+
+ current_text = gtk_entry_get_text (GTK_ENTRY (bar->details->entry));
+ location = g_file_parse_name (current_text);
+ last_location = g_file_parse_name (bar->details->last_location);
+
+ if (g_file_equal (last_location, location)) {
+ gtk_label_set_text (GTK_LABEL (bar->details->label), LOCATION_LABEL);
+ caja_location_entry_set_secondary_action (CAJA_LOCATION_ENTRY (bar->details->entry),
+ CAJA_LOCATION_ENTRY_ACTION_CLEAR);
+ } else {
+ gtk_label_set_text (GTK_LABEL (bar->details->label), GO_TO_LABEL);
+ caja_location_entry_set_secondary_action (CAJA_LOCATION_ENTRY (bar->details->entry),
+ CAJA_LOCATION_ENTRY_ACTION_GOTO);
+ }
+
+ g_object_unref (location);
+ g_object_unref (last_location);
}
static void
@@ -339,13 +412,9 @@ editable_changed_callback (GtkEntry *entry,
caja_location_bar_update_label (CAJA_LOCATION_BAR (user_data));
}
-static void
-real_activate (CajaNavigationBar *navigation_bar)
+void
+caja_location_bar_activate (CajaLocationBar *bar)
{
- CajaLocationBar *bar;
-
- bar = CAJA_LOCATION_BAR (navigation_bar);
-
/* Put the keyboard focus in the text field when switching to this mode,
* and select all text for easy overtyping
*/
@@ -354,12 +423,12 @@ real_activate (CajaNavigationBar *navigation_bar)
}
static void
-real_cancel (CajaNavigationBar *navigation_bar)
+caja_location_bar_cancel (CajaLocationBar *bar)
{
char *last_location;
- last_location = CAJA_LOCATION_BAR (navigation_bar)->details->last_location;
- caja_navigation_bar_set_location (navigation_bar, last_location);
+ last_location = bar->details->last_location;
+ caja_location_bar_set_location (bar, last_location);
}
static void
@@ -369,22 +438,6 @@ finalize (GObject *object)
bar = CAJA_LOCATION_BAR (object);
- g_free (bar->details);
-
- EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
-}
-
-static void
-#if GTK_CHECK_VERSION (3, 0, 0)
-destroy (GtkWidget *object)
-#else
-destroy (GtkObject *object)
-#endif
-{
- CajaLocationBar *bar;
-
- bar = CAJA_LOCATION_BAR (object);
-
/* cancel the pending idle call, if any */
if (bar->details->idle_id != 0)
{
@@ -395,32 +448,42 @@ destroy (GtkObject *object)
g_free (bar->details->last_location);
bar->details->last_location = NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
- EEL_CALL_PARENT (GTK_WIDGET_CLASS, destroy, (object));
-#else
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
-#endif
+ G_OBJECT_CLASS (caja_location_bar_parent_class)->finalize (object);
}
static void
-caja_location_bar_class_init (CajaLocationBarClass *class)
-{
- CajaNavigationBarClass *navigation_bar_class;
-
- G_OBJECT_CLASS (class)->finalize = finalize;
-
-#if GTK_CHECK_VERSION (3, 0, 0)
- GTK_WIDGET_CLASS (class)->destroy = destroy;
-#else
- GTK_OBJECT_CLASS (class)->destroy = destroy;
-#endif
-
- navigation_bar_class = CAJA_NAVIGATION_BAR_CLASS (class);
-
- navigation_bar_class->activate = real_activate;
- navigation_bar_class->cancel = real_cancel;
- navigation_bar_class->get_location = caja_location_bar_get_location;
- navigation_bar_class->set_location = caja_location_bar_set_location;
+caja_location_bar_class_init (CajaLocationBarClass *klass)
+ {
+ GObjectClass *gobject_class;
+ GtkBindingSet *binding_set;
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = finalize;
+
+ klass->cancel = caja_location_bar_cancel;
+
+ signals[CANCEL] = g_signal_new
+ ("cancel",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (CajaLocationBarClass,
+ cancel),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[LOCATION_CHANGED] = g_signal_new
+ ("location-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
+
+ binding_set = gtk_binding_set_by_class (klass);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "cancel", 0);
+
+ g_type_class_add_private (klass, sizeof (CajaLocationBarDetails));
}
static void
@@ -431,7 +494,8 @@ caja_location_bar_init (CajaLocationBar *bar)
GtkWidget *event_box;
GtkWidget *hbox;
- bar->details = g_new0 (CajaLocationBarDetails, 1);
+ bar->details = G_TYPE_INSTANCE_GET_PRIVATE (bar, CAJA_TYPE_LOCATION_BAR,
+ CajaLocationBarDetails);
hbox = gtk_hbox_new (0, FALSE);
@@ -511,18 +575,15 @@ caja_location_bar_new (CajaNavigationWindowPane *pane)
return bar;
}
-static void
-caja_location_bar_set_location (CajaNavigationBar *navigation_bar,
+void
+caja_location_bar_set_location (CajaLocationBar *bar,
const char *location)
{
- CajaLocationBar *bar;
char *formatted_location;
GFile *file;
g_assert (location != NULL);
- bar = CAJA_LOCATION_BAR (navigation_bar);
-
/* Note: This is called in reaction to external changes, and
* thus should not emit the LOCATION_CHANGED signal. */
@@ -552,77 +613,6 @@ caja_location_bar_set_location (CajaNavigationBar *navigation_bar,
caja_location_bar_update_label (bar);
}
-/**
- * caja_location_bar_get_location
- *
- * Get the "URI" represented by the text in the location bar.
- *
- * @bar: A CajaLocationBar.
- *
- * returns a newly allocated "string" containing the mangled
- * (by g_file_parse_name) text that the user typed in...maybe a URI
- * but not guaranteed.
- *
- **/
-static char *
-caja_location_bar_get_location (CajaNavigationBar *navigation_bar)
-{
- CajaLocationBar *bar;
- char *user_location, *uri;
- GFile *location;
-
- bar = CAJA_LOCATION_BAR (navigation_bar);
-
- user_location = gtk_editable_get_chars (GTK_EDITABLE (bar->details->entry), 0, -1);
- location = g_file_parse_name (user_location);
- g_free (user_location);
- uri = g_file_get_uri (location);
- g_object_unref (location);
- return uri;
-}
-
-/**
- * caja_location_bar_update_label
- *
- * if the text in the entry matches the uri, set the label to "location", otherwise use "goto"
- *
- **/
-static void
-caja_location_bar_update_label (CajaLocationBar *bar)
-{
- const char *current_text;
- GFile *location;
- GFile *last_location;
-
- if (bar->details->last_location == NULL)
- {
- gtk_label_set_text (GTK_LABEL (bar->details->label), GO_TO_LABEL);
- caja_location_entry_set_secondary_action (CAJA_LOCATION_ENTRY (bar->details->entry),
- CAJA_LOCATION_ENTRY_ACTION_GOTO);
- return;
- }
-
- current_text = gtk_entry_get_text (GTK_ENTRY (bar->details->entry));
- location = g_file_parse_name (current_text);
- last_location = g_file_parse_name (bar->details->last_location);
-
- if (g_file_equal (last_location, location))
- {
- gtk_label_set_text (GTK_LABEL (bar->details->label), LOCATION_LABEL);
- caja_location_entry_set_secondary_action (CAJA_LOCATION_ENTRY (bar->details->entry),
- CAJA_LOCATION_ENTRY_ACTION_CLEAR);
- }
- else
- {
- gtk_label_set_text (GTK_LABEL (bar->details->label), GO_TO_LABEL);
- caja_location_entry_set_secondary_action (CAJA_LOCATION_ENTRY (bar->details->entry),
- CAJA_LOCATION_ENTRY_ACTION_GOTO);
- }
-
- g_object_unref (location);
- g_object_unref (last_location);
-}
-
/* change background color based on activity state */
void
caja_location_bar_set_active(CajaLocationBar *location_bar, gboolean is_active)
diff --git a/src/caja-location-bar.h b/src/caja-location-bar.h
index 4f29373b..aa2a9521 100644
--- a/src/caja-location-bar.h
+++ b/src/caja-location-bar.h
@@ -30,7 +30,6 @@
#ifndef CAJA_LOCATION_BAR_H
#define CAJA_LOCATION_BAR_H
-#include "caja-navigation-bar.h"
#include "caja-navigation-window.h"
#include "caja-navigation-window-pane.h"
#include <libcaja-private/caja-entry.h>
@@ -52,13 +51,16 @@ typedef struct CajaLocationBarDetails CajaLocationBarDetails;
typedef struct CajaLocationBar
{
- CajaNavigationBar parent;
+ GtkHBox parent;
CajaLocationBarDetails *details;
} CajaLocationBar;
typedef struct
{
- CajaNavigationBarClass parent_class;
+ GtkHBoxClass parent_class;
+
+ /* for GtkBindingSet */
+ void (* cancel) (CajaLocationBar *bar);
} CajaLocationBarClass;
GType caja_location_bar_get_type (void);
@@ -67,4 +69,8 @@ void caja_location_bar_set_active (CajaLocationBar *location_bar,
gboolean is_active);
CajaEntry * caja_location_bar_get_entry (CajaLocationBar *location_bar);
+void caja_location_bar_activate (CajaLocationBar *bar);
+void caja_location_bar_set_location (CajaLocationBar *bar,
+ const char *location);
+
#endif /* CAJA_LOCATION_BAR_H */
diff --git a/src/caja-navigation-bar.c b/src/caja-navigation-bar.c
deleted file mode 100644
index 0c766bbd..00000000
--- a/src/caja-navigation-bar.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Caja
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Caja is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * Caja is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * Author: Maciej Stachowiak <[email protected]>
- */
-
-/* caja-navigation-bar.c - Abstract navigation bar class
- */
-
-#include <config.h>
-#include "caja-navigation-bar.h"
-
-#include <eel/eel-gtk-macros.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-#include <string.h>
-
-enum
-{
- ACTIVATE,
- CANCEL,
- LOCATION_CHANGED,
- LAST_SIGNAL
-};
-static guint signals[LAST_SIGNAL] = { 0 };
-
-static void caja_navigation_bar_class_init (CajaNavigationBarClass *class);
-static void caja_navigation_bar_init (CajaNavigationBar *bar);
-
-EEL_CLASS_BOILERPLATE (CajaNavigationBar, caja_navigation_bar, GTK_TYPE_HBOX)
-
-EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (caja_navigation_bar, get_location)
-EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (caja_navigation_bar, set_location)
-
-static void
-caja_navigation_bar_class_init (CajaNavigationBarClass *klass)
-{
- GtkBindingSet *binding_set;
-
- signals[ACTIVATE] = g_signal_new
- ("activate",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CajaNavigationBarClass,
- activate),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- signals[CANCEL] = g_signal_new
- ("cancel",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (CajaNavigationBarClass,
- cancel),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- signals[LOCATION_CHANGED] = g_signal_new
- ("location_changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (CajaNavigationBarClass,
- location_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
-
- klass->activate = NULL;
- klass->cancel = NULL;
-
- binding_set = gtk_binding_set_by_class (klass);
- gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "cancel", 0);
-
- EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, caja_navigation_bar, get_location);
- EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, caja_navigation_bar, set_location);
-}
-
-static void
-caja_navigation_bar_init (CajaNavigationBar *bar)
-{
-}
-
-/**
- * caja_navigation_bar_activate
- *
- * Change the navigation bar to an active state.
- *
- * @bar: A CajaNavigationBar.
- */
-void
-caja_navigation_bar_activate (CajaNavigationBar *bar)
-{
- g_return_if_fail (CAJA_IS_NAVIGATION_BAR (bar));
-
- g_signal_emit (bar, signals[ACTIVATE], 0);
-}
-
-/**
- * caja_navigation_bar_get_location
- *
- * Return the location displayed in the navigation bar.
- *
- * @bar: A CajaNavigationBar.
- * @location: The uri that should be displayed.
- */
-char *
-caja_navigation_bar_get_location (CajaNavigationBar *bar)
-{
- g_return_val_if_fail (CAJA_IS_NAVIGATION_BAR (bar), NULL);
-
- return EEL_CALL_METHOD_WITH_RETURN_VALUE
- (CAJA_NAVIGATION_BAR_CLASS, bar,
- get_location, (bar));
-}
-
-/**
- * caja_navigation_bar_set_location
- *
- * Change the location displayed in the navigation bar.
- *
- * @bar: A CajaNavigationBar.
- * @location: The uri that should be displayed.
- */
-void
-caja_navigation_bar_set_location (CajaNavigationBar *bar,
- const char *location)
-{
- g_return_if_fail (CAJA_IS_NAVIGATION_BAR (bar));
-
- EEL_CALL_METHOD (CAJA_NAVIGATION_BAR_CLASS, bar,
- set_location, (bar, location));
-}
-
-void
-caja_navigation_bar_location_changed (CajaNavigationBar *bar)
-{
- char *location;
-
- g_return_if_fail (CAJA_IS_NAVIGATION_BAR (bar));
-
- location = caja_navigation_bar_get_location (bar);
- g_signal_emit (bar,
- signals[LOCATION_CHANGED], 0,
- location);
- g_free (location);
-}
diff --git a/src/caja-navigation-bar.h b/src/caja-navigation-bar.h
deleted file mode 100644
index 8616a974..00000000
--- a/src/caja-navigation-bar.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Caja
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Caja is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * Caja is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * Author: Maciej Stachowiak <[email protected]>
- */
-
-/* caja-navigation-bar.h - Abstract navigation bar class
- */
-
-#ifndef CAJA_NAVIGATION_BAR_H
-#define CAJA_NAVIGATION_BAR_H
-
-#include <gtk/gtk.h>
-
-#define CAJA_TYPE_NAVIGATION_BAR caja_navigation_bar_get_type()
-#define CAJA_NAVIGATION_BAR(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_NAVIGATION_BAR, CajaNavigationBar))
-#define CAJA_NAVIGATION_BAR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), CAJA_TYPE_NAVIGATION_BAR, CajaNavigationBarClass))
-#define CAJA_IS_NAVIGATION_BAR(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_NAVIGATION_BAR))
-#define CAJA_IS_NAVIGATION_BAR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), CAJA_TYPE_NAVIGATION_BAR))
-#define CAJA_NAVIGATION_BAR_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_NAVIGATION_BAR, CajaNavigationBarClass))
-
-typedef struct
-{
- GtkHBox parent;
-} CajaNavigationBar;
-
-typedef struct
-{
- GtkHBoxClass parent_class;
-
- /* signals */
- void (* location_changed) (CajaNavigationBar *bar,
- const char *location);
- void (* cancel) (CajaNavigationBar *bar);
-
- /* virtual methods */
- void (* activate) (CajaNavigationBar *bar);
- char * (* get_location) (CajaNavigationBar *bar);
- void (* set_location) (CajaNavigationBar *bar,
- const char *location);
-
-} CajaNavigationBarClass;
-
-GType caja_navigation_bar_get_type (void);
-void caja_navigation_bar_activate (CajaNavigationBar *bar);
-char * caja_navigation_bar_get_location (CajaNavigationBar *bar);
-void caja_navigation_bar_set_location (CajaNavigationBar *bar,
- const char *location);
-
-/* `protected' function meant to be used by subclasses to emit the `location_changed' signal */
-void caja_navigation_bar_location_changed (CajaNavigationBar *bar);
-
-#endif /* CAJA_NAVIGATION_BAR_H */
diff --git a/src/caja-navigation-window-pane.c b/src/caja-navigation-window-pane.c
index 5620ce5a..cde3d520 100644
--- a/src/caja-navigation-window-pane.c
+++ b/src/caja-navigation-window-pane.c
@@ -25,7 +25,6 @@
#include "caja-navigation-window-pane.h"
#include "caja-window-private.h"
#include "caja-window-manage-views.h"
-#include "caja-navigation-bar.h"
#include "caja-pathbar.h"
#include "caja-location-bar.h"
#include "caja-notebook.h"
@@ -234,7 +233,7 @@ location_button_toggled_cb (GtkToggleButton *toggle,
g_settings_set_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY, is_active);
if (is_active) {
- caja_navigation_bar_activate (CAJA_NAVIGATION_BAR (pane->navigation_bar));
+ caja_location_bar_activate (CAJA_LOCATION_BAR (pane->navigation_bar));
}
caja_window_set_active_pane (CAJA_WINDOW_PANE (pane)->window, CAJA_WINDOW_PANE (pane));
@@ -636,7 +635,7 @@ real_sync_location_widgets (CajaWindowPane *pane)
/* this may be NULL if we just created the slot */
uri = caja_window_slot_get_location_uri (slot);
- caja_navigation_bar_set_location (CAJA_NAVIGATION_BAR (navigation_pane->navigation_bar), uri);
+ caja_location_bar_set_location (CAJA_LOCATION_BAR (navigation_pane->navigation_bar), uri);
g_free (uri);
caja_path_bar_set_path (CAJA_PATH_BAR (navigation_pane->path_bar), slot->location);
}
@@ -849,8 +848,8 @@ caja_navigation_window_pane_show_navigation_bar_temporarily (CajaNavigationWindo
caja_navigation_window_pane_set_bar_mode (pane, CAJA_BAR_NAVIGATION);
pane->temporary_navigation_bar = TRUE;
}
- caja_navigation_bar_activate
- (CAJA_NAVIGATION_BAR (pane->navigation_bar));
+ caja_location_bar_activate
+ (CAJA_LOCATION_BAR (pane->navigation_bar));
}
gboolean
diff --git a/src/caja-navigation-window.c b/src/caja-navigation-window.c
index bd79d774..fbaaf5a4 100644
--- a/src/caja-navigation-window.c
+++ b/src/caja-navigation-window.c
@@ -318,7 +318,7 @@ caja_navigation_window_is_in_temporary_navigation_bar (GtkWidget *widget,
for (walk = CAJA_WINDOW(window)->details->panes; walk; walk = walk->next)
{
CajaNavigationWindowPane *pane = walk->data;
- if(gtk_widget_get_ancestor (widget, CAJA_TYPE_NAVIGATION_BAR) != NULL &&
+ if(gtk_widget_get_ancestor (widget, CAJA_TYPE_LOCATION_BAR) != NULL &&
pane->temporary_navigation_bar)
is_in_any = TRUE;
}
@@ -833,8 +833,8 @@ real_prompt_for_location (CajaWindow *window, const char *initial)
if (initial)
{
- caja_navigation_bar_set_location (CAJA_NAVIGATION_BAR (pane->navigation_bar),
- initial);
+ caja_location_bar_set_location (CAJA_LOCATION_BAR (pane->navigation_bar),
+ initial);
}
}