Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve search system #532

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions libview/ev-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -7509,6 +7509,14 @@ ev_view_find_previous (EvView *view)
}
}

void
ev_view_find_set_result (EvView *view, gint page, gint result)
{
ev_document_model_set_page (view->model, page);
view->find_result = result;
jump_to_find_result (view);
}

void
ev_view_find_search_changed (EvView *view)
{
Expand Down
3 changes: 3 additions & 0 deletions libview/ev-view.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ void ev_view_zoom (EvView *view,
/* Find */
void ev_view_find_next (EvView *view);
void ev_view_find_previous (EvView *view);
void ev_view_find_set_result (EvView *view,
gint page,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indents

gint result);
void ev_view_find_search_changed (EvView *view);
void ev_view_find_set_highlight_search (EvView *view,
gboolean value);
Expand Down
2 changes: 2 additions & 0 deletions shell/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ atril_SOURCES= \
ev-bookmark-action.c \
ev-application.c \
ev-application.h \
ev-find-sidebar.h \
ev-find-sidebar.c \
ev-file-monitor.h \
ev-file-monitor.c \
ev-history.c \
Expand Down
65 changes: 0 additions & 65 deletions shell/eggfindbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ struct _EggFindBarPrivate
GtkWidget *find_entry;
GtkWidget *status_label;

gulong set_focus_handler;
guint case_sensitive : 1;
};

Expand Down Expand Up @@ -91,9 +90,6 @@ egg_find_bar_class_init (EggFindBarClass *klass)

object_class->finalize = egg_find_bar_finalize;

widget_class->show = egg_find_bar_show;
widget_class->hide = egg_find_bar_hide;

widget_class->grab_focus = egg_find_bar_grab_focus;

find_bar_signals[NEXT] =
Expand Down Expand Up @@ -256,27 +252,6 @@ entry_changed_callback (GtkEntry *entry,
g_free (text);
}

static void
set_focus_cb (GtkWidget *window,
GtkWidget *widget,
EggFindBar *bar)
{
GtkWidget *wbar = GTK_WIDGET (bar);

while (widget != NULL && widget != wbar)
{
widget = gtk_widget_get_parent (widget);
}

/* if widget == bar, the new focus widget is in the bar, so we
* don't deactivate.
*/
if (widget != wbar)
{
g_signal_emit (bar, find_bar_signals[CLOSE], 0);
}
}

static void
egg_find_bar_init (EggFindBar *find_bar)
{
Expand Down Expand Up @@ -443,46 +418,6 @@ egg_find_bar_get_property (GObject *object,
}
}

static void
egg_find_bar_show (GtkWidget *widget)
{
EggFindBar *bar = EGG_FIND_BAR (widget);
EggFindBarPrivate *priv = bar->priv;

GTK_WIDGET_CLASS (egg_find_bar_parent_class)->show (widget);

if (priv->set_focus_handler == 0)
{
GtkWidget *toplevel;

toplevel = gtk_widget_get_toplevel (widget);

priv->set_focus_handler =
g_signal_connect (toplevel, "set-focus",
G_CALLBACK (set_focus_cb), bar);
}
}

static void
egg_find_bar_hide (GtkWidget *widget)
{
EggFindBar *bar = EGG_FIND_BAR (widget);
EggFindBarPrivate *priv = bar->priv;

if (priv->set_focus_handler != 0)
{
GtkWidget *toplevel;

toplevel = gtk_widget_get_toplevel (widget);

g_signal_handlers_disconnect_by_func
(toplevel, (void (*)) G_CALLBACK (set_focus_cb), bar);
priv->set_focus_handler = 0;
}

GTK_WIDGET_CLASS (egg_find_bar_parent_class)->hide (widget);
}

void
egg_find_bar_grab_focus (GtkWidget *widget)
{
Expand Down
Loading