Commit 75fcef36 authored by Cosimo Cecchi's avatar Cosimo Cecchi

window: remove unused code for temporary search/location bars

Since we always have a toolbar, we don't need this logic anymore.
parent 9ed2b3b2
......@@ -48,7 +48,6 @@ struct _NautilusToolbarPriv {
GtkToolItem *back_forward;
gboolean show_main_bar;
gboolean show_location_entry;
};
......@@ -56,7 +55,6 @@ enum {
PROP_ACTION_GROUP = 1,
PROP_UI_MANAGER,
PROP_SHOW_LOCATION_ENTRY,
PROP_SHOW_MAIN_BAR,
NUM_PROPERTIES
};
......@@ -72,9 +70,6 @@ toolbar_update_appearance (NautilusToolbar *self)
show_location_entry = self->priv->show_location_entry ||
g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY);
gtk_widget_set_visible (self->priv->toolbar,
self->priv->show_main_bar);
gtk_widget_set_visible (self->priv->location_bar,
show_location_entry);
gtk_widget_set_visible (self->priv->path_bar,
......@@ -227,7 +222,6 @@ nautilus_toolbar_init (NautilusToolbar *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NAUTILUS_TYPE_TOOLBAR,
NautilusToolbarPriv);
self->priv->show_main_bar = TRUE;
}
static void
......@@ -242,9 +236,6 @@ nautilus_toolbar_get_property (GObject *object,
case PROP_SHOW_LOCATION_ENTRY:
g_value_set_boolean (value, self->priv->show_location_entry);
break;
case PROP_SHOW_MAIN_BAR:
g_value_set_boolean (value, self->priv->show_main_bar);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -269,9 +260,6 @@ nautilus_toolbar_set_property (GObject *object,
case PROP_SHOW_LOCATION_ENTRY:
nautilus_toolbar_set_show_location_entry (self, g_value_get_boolean (value));
break;
case PROP_SHOW_MAIN_BAR:
nautilus_toolbar_set_show_main_bar (self, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -321,12 +309,6 @@ nautilus_toolbar_class_init (NautilusToolbarClass *klass)
"Whether to show the location entry instead of the pathbar",
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
properties[PROP_SHOW_MAIN_BAR] =
g_param_spec_boolean ("show-main-bar",
"Whether to show the main bar",
"Whether to show the main toolbar",
TRUE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_type_class_add_private (klass, sizeof (NautilusToolbarClass));
g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
......@@ -355,18 +337,6 @@ nautilus_toolbar_get_location_bar (NautilusToolbar *self)
return self->priv->location_bar;
}
void
nautilus_toolbar_set_show_main_bar (NautilusToolbar *self,
gboolean show_main_bar)
{
if (show_main_bar != self->priv->show_main_bar) {
self->priv->show_main_bar = show_main_bar;
toolbar_update_appearance (self);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SHOW_MAIN_BAR]);
}
}
void
nautilus_toolbar_set_show_location_entry (NautilusToolbar *self,
gboolean show_location_entry)
......
......@@ -87,7 +87,6 @@ struct NautilusWindowDetails
GtkWidget *toolbar;
GtkActionGroup *toolbar_action_group;
gboolean temporary_navigation_bar;
gboolean temporary_search_bar;
/* focus widget before the location bar has been shown temporarily */
GtkWidget *last_focus_widget;
......
......@@ -196,32 +196,6 @@ bookmark_list_get_uri_index (GList *list, GFile *location)
return -1;
}
static void
nautilus_window_hide_temporary_bars (NautilusWindow *window)
{
NautilusWindowSlot *slot;
NautilusDirectory *directory;
slot = window->details->active_slot;
if (window->details->temporary_navigation_bar) {
directory = nautilus_directory_get (slot->location);
window->details->temporary_navigation_bar = FALSE;
/* if we're in a search directory, hide the main bar, and show the search
* bar again; otherwise, just hide the whole toolbar.
*/
if (NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
nautilus_toolbar_set_show_main_bar (NAUTILUS_TOOLBAR (window->details->toolbar), FALSE);
} else {
gtk_widget_hide (window->details->toolbar);
}
nautilus_directory_unref (directory);
}
}
static void
unset_focus_widget (NautilusWindow *window)
{
......@@ -232,27 +206,13 @@ unset_focus_widget (NautilusWindow *window)
}
}
static gboolean
widget_is_in_temporary_bars (GtkWidget *widget,
NautilusWindow *window)
{
gboolean res = FALSE;
if ((gtk_widget_get_ancestor (widget, NAUTILUS_TYPE_LOCATION_BAR) != NULL &&
window->details->temporary_navigation_bar))
res = TRUE;
return res;
}
static void
remember_focus_widget (NautilusWindow *window)
{
GtkWidget *focus_widget;
focus_widget = gtk_window_get_focus (GTK_WINDOW (window));
if (focus_widget != NULL &&
!widget_is_in_temporary_bars (focus_widget, window)) {
if (focus_widget != NULL) {
unset_focus_widget (window);
window->details->last_focus_widget = focus_widget;
......@@ -289,7 +249,6 @@ navigation_bar_cancel_callback (GtkWidget *widget,
{
nautilus_toolbar_set_show_location_entry (NAUTILUS_TOOLBAR (window->details->toolbar), FALSE);
nautilus_window_hide_temporary_bars (window);
restore_focus_widget (window);
}
......@@ -299,7 +258,6 @@ navigation_bar_location_changed_callback (GtkWidget *widget,
NautilusWindow *window)
{
nautilus_toolbar_set_show_location_entry (NAUTILUS_TOOLBAR (window->details->toolbar), FALSE);
nautilus_window_hide_temporary_bars (window);
restore_focus_widget (window);
......@@ -780,8 +738,6 @@ nautilus_window_sync_location_widgets (NautilusWindow *window)
slot = window->details->active_slot;
nautilus_window_hide_temporary_bars (window);
/* Change the location bar and path bar to match the current location. */
if (slot->location != NULL) {
char *uri;
......@@ -819,7 +775,6 @@ nautilus_window_ensure_location_bar (NautilusWindow *window)
remember_focus_widget (window);
nautilus_toolbar_set_show_main_bar (NAUTILUS_TOOLBAR (window->details->toolbar), TRUE);
nautilus_toolbar_set_show_location_entry (NAUTILUS_TOOLBAR (window->details->toolbar), TRUE);
location_bar = nautilus_toolbar_get_location_bar (NAUTILUS_TOOLBAR (window->details->toolbar));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment