static void
real_update_query_editor (NautilusWindowSlot *slot)
{
	GtkWidget *query_editor;
	NautilusQuery *query;
	NautilusDirectory *directory;
	NautilusSearchDirectory *search_directory;

	directory = nautilus_directory_get (slot->location);

	if (NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
		search_directory = NAUTILUS_SEARCH_DIRECTORY (directory);

		query_editor = nautilus_query_editor_new (nautilus_search_directory_is_saved_search (search_directory),
							  nautilus_search_directory_is_indexed (search_directory));

		slot->query_editor = NAUTILUS_QUERY_EDITOR (query_editor);

		nautilus_window_slot_add_extra_location_widget (slot, query_editor);
		gtk_widget_show (query_editor);
		g_signal_connect_object (query_editor, "changed",
					 G_CALLBACK (query_editor_changed_callback), slot, 0);
		
		query = nautilus_search_directory_get_query (search_directory);
		if (query != NULL) {
			nautilus_query_editor_set_query (NAUTILUS_QUERY_EDITOR (query_editor),
							 query);
			g_object_unref (query);
		} else {
			nautilus_query_editor_set_default_query (NAUTILUS_QUERY_EDITOR (query_editor));
		}
	} 

	nautilus_directory_unref (directory);
}
static void
real_update_query_editor (NautilusWindowSlot *slot)
{
    NautilusDirectory *directory;
    NautilusSearchDirectory *search_directory;
    NautilusQuery *query;
    GtkWidget *query_editor;

    g_assert (slot->pane->window != NULL);

    query_editor = NULL;

    directory = nautilus_directory_get (slot->location);
    if (NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
        search_directory = NAUTILUS_SEARCH_DIRECTORY (directory);

        if (nautilus_search_directory_is_saved_search (search_directory)) {
            query_editor = nautilus_query_editor_new (TRUE,
                           nautilus_search_directory_is_indexed (search_directory));
        } else {
            query_editor = nautilus_query_editor_new_with_bar (FALSE,
                           nautilus_search_directory_is_indexed (search_directory),
                           slot->pane->window->details->active_pane->active_slot == slot,
                           NAUTILUS_SEARCH_BAR (slot->pane->search_bar),
                           slot);
        }
    }

    slot->query_editor = NAUTILUS_QUERY_EDITOR (query_editor);

    if (query_editor != NULL) {
        g_signal_connect_object (query_editor, "changed",
                                 G_CALLBACK (query_editor_changed_callback), slot, 0);

        query = nautilus_search_directory_get_query (search_directory);
        if (query != NULL) {
            nautilus_query_editor_set_query (NAUTILUS_QUERY_EDITOR (query_editor),
                                             query);
            g_object_unref (query);
        } else {
            nautilus_query_editor_set_default_query (NAUTILUS_QUERY_EDITOR (query_editor));
        }

        nautilus_window_slot_add_extra_location_widget (slot, query_editor);
        gtk_widget_show (query_editor);
        nautilus_query_editor_grab_focus (NAUTILUS_QUERY_EDITOR (query_editor));
    }

    nautilus_directory_unref (directory);
}
static void
nautilus_query_editor_set_property (GObject      *object,
                                    guint         prop_id,
                                    const GValue *value,
                                    GParamSpec   *pspec)
{
    NautilusQueryEditor *self;

    self = NAUTILUS_QUERY_EDITOR (object);

    switch (prop_id)
    {
        case PROP_LOCATION:
        {
            nautilus_query_editor_set_location (self, g_value_get_object (value));
        }
        break;

        case PROP_QUERY:
        {
            nautilus_query_editor_set_query (self, g_value_get_object (value));
        }
        break;

        default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
    }
}
static void
nautilus_query_editor_get_property (GObject    *object,
                                    guint       prop_id,
                                    GValue     *value,
                                    GParamSpec *pspec)
{
    NautilusQueryEditorPrivate *priv;

    priv = nautilus_query_editor_get_instance_private (NAUTILUS_QUERY_EDITOR (object));

    switch (prop_id)
    {
        case PROP_LOCATION:
        {
            g_value_set_object (value, priv->location);
        }
        break;

        case PROP_QUERY:
        {
            g_value_set_object (value, priv->query);
        }
        break;

        default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
    }
}
Example #5
0
static void
nautilus_query_editor_dispose (GObject *object)
{
	NautilusQueryEditor *editor;

	editor = NAUTILUS_QUERY_EDITOR (object);

	if (editor->details->typing_timeout_id) {
		g_source_remove (editor->details->typing_timeout_id);
		editor->details->typing_timeout_id = 0;
	}

	if (editor->details->bar != NULL) {
		g_signal_handlers_disconnect_by_func (editor->details->entry,
						      entry_activate_cb,
						      editor);
		g_signal_handlers_disconnect_by_func (editor->details->entry,
						      entry_changed_cb,
						      editor);
		
		nautilus_search_bar_return_entry (editor->details->bar);

		g_object_remove_weak_pointer (G_OBJECT (editor->details->bar),
					      (gpointer *) &editor->details->bar);
		editor->details->bar = NULL;
	}

	G_OBJECT_CLASS (nautilus_query_editor_parent_class)->dispose (object);
}
static void
nautilus_query_editor_finalize (GObject *object)
{
    NautilusQueryEditorPrivate *priv;

    priv = nautilus_query_editor_get_instance_private (NAUTILUS_QUERY_EDITOR (object));

    g_clear_object (&priv->date_range_tag);
    g_clear_object (&priv->mime_types_tag);

    G_OBJECT_CLASS (nautilus_query_editor_parent_class)->finalize (object);
}
static void
nautilus_query_editor_grab_focus (GtkWidget *widget)
{
    NautilusQueryEditorPrivate *priv;

    priv = nautilus_query_editor_get_instance_private (NAUTILUS_QUERY_EDITOR (widget));

    if (gtk_widget_get_visible (widget) && !gtk_widget_is_focus (priv->entry))
    {
        /* avoid selecting the entry text */
        gtk_widget_grab_focus (priv->entry);
        gtk_editable_set_position (GTK_EDITABLE (priv->entry), -1);
    }
}
static void
nautilus_query_editor_dispose (GObject *object)
{
    NautilusQueryEditorPrivate *priv;

    priv = nautilus_query_editor_get_instance_private (NAUTILUS_QUERY_EDITOR (object));

    g_clear_object (&priv->location);
    g_clear_object (&priv->query);

    g_signal_handlers_disconnect_by_func (nautilus_preferences,
                                          recursive_search_preferences_changed,
                                          object);

    G_OBJECT_CLASS (nautilus_query_editor_parent_class)->dispose (object);
}
Example #9
0
static void
nautilus_window_slot_constructed (GObject *object)
{
	NautilusWindowSlot *slot = NAUTILUS_WINDOW_SLOT (object);
	GtkWidget *extras_vbox;

	G_OBJECT_CLASS (nautilus_window_slot_parent_class)->constructed (object);

	gtk_orientable_set_orientation (GTK_ORIENTABLE (slot),
					GTK_ORIENTATION_VERTICAL);
	gtk_widget_show (GTK_WIDGET (slot));

	extras_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
	slot->extra_location_widgets = extras_vbox;
	gtk_box_pack_start (GTK_BOX (slot), extras_vbox, FALSE, FALSE, 0);
	gtk_widget_show (extras_vbox);

	slot->query_editor = NAUTILUS_QUERY_EDITOR (nautilus_query_editor_new ());
	nautilus_window_slot_add_extra_location_widget (slot, GTK_WIDGET (slot->query_editor));
	g_object_add_weak_pointer (G_OBJECT (slot->query_editor),
				   (gpointer *) &slot->query_editor);

	slot->view_overlay = gtk_overlay_new ();
	gtk_widget_add_events (slot->view_overlay,
			       GDK_ENTER_NOTIFY_MASK |
			       GDK_LEAVE_NOTIFY_MASK);
	gtk_box_pack_start (GTK_BOX (slot), slot->view_overlay, TRUE, TRUE, 0);
	gtk_widget_show (slot->view_overlay);

	slot->floating_bar = nautilus_floating_bar_new (NULL, NULL, FALSE);
	gtk_widget_set_halign (slot->floating_bar, GTK_ALIGN_END);
	gtk_widget_set_valign (slot->floating_bar, GTK_ALIGN_END);
	gtk_overlay_add_overlay (GTK_OVERLAY (slot->view_overlay),
				 slot->floating_bar);

	g_signal_connect (slot->floating_bar, "action",
			  G_CALLBACK (floating_bar_action_cb), slot);

	slot->title = g_strdup (_("Loading..."));
}