+2007-11-25 Carlos Garcia Campos <carlosgc@gnome.org>
+
+ * shell/ev-application.[ch]: (get_find_string_from_args),
+ (ev_application_open_uri_at_dest), (ev_application_open_uri),
+ (ev_application_open_uri_list):
+ * shell/ev-jobs.[ch]: (ev_job_load_dispose), (ev_job_load_new):
+ * shell/ev-window.[ch]: (ev_window_load_job_cb),
+ (ev_window_open_uri), (ev_window_cmd_file_open_copy_at_dest),
+ (ev_window_cmd_recent_file_activate),
+ (ev_window_open_recent_action_item_activated),
+ (ev_window_print_send), (open_remote_link):
+ * shell/main.c: (arguments_parse):
+
+ Add a command line option for search. Fixes bug #497710.
+
2007-11-20 Darren Kenny <darren.kenny@sun.com>
* shell/ev-jobs.c: (ev_job_print_new):
return dest;
}
+static const gchar *
+get_find_string_from_args (GHashTable *args)
+{
+ GValue *value = NULL;
+
+ g_assert (args != NULL);
+
+ value = g_hash_table_lookup (args, "find-string");
+
+ return value ? g_value_get_string (value) : NULL;
+}
+
/**
* get_unlink_temp_file_from_args:
* @args: a #GHashTable with data passed to the application.
GdkScreen *screen,
EvLinkDest *dest,
EvWindowRunMode mode,
+ const gchar *search_string,
gboolean unlink_temp_file,
const gchar *print_settings,
guint timestamp)
/* We need to load uri before showing the window, so
we can restore window size without flickering */
- ev_window_open_uri (new_window, uri, dest, mode,
+ ev_window_open_uri (new_window, uri, dest, mode, search_string,
unlink_temp_file, print_settings);
ev_document_fc_mutex_lock ();
{
EvLinkDest *dest = NULL;
EvWindowRunMode mode = EV_WINDOW_MODE_NORMAL;
+ const gchar *search_string = NULL;
gboolean unlink_temp_file = FALSE;
const gchar *print_settings = NULL;
GdkScreen *screen = NULL;
screen = get_screen_from_args (args);
dest = get_destination_from_args (args);
mode = get_window_run_mode_from_args (args);
+ search_string = get_find_string_from_args (args);
unlink_temp_file = (mode == EV_WINDOW_MODE_PREVIEW &&
get_unlink_temp_file_from_args (args));
print_settings = get_print_settings_from_args (args);
}
ev_application_open_uri_at_dest (application, uri, screen,
- dest, mode, unlink_temp_file,
+ dest, mode, search_string,
+ unlink_temp_file,
print_settings, timestamp);
if (dest)
for (l = uri_list; l != NULL; l = l->next) {
ev_application_open_uri_at_dest (application, (char *)l->data,
- screen, NULL, 0, FALSE,
- NULL, timestamp);
+ screen, NULL, 0, NULL,
+ FALSE, NULL, timestamp);
}
}
GdkScreen *screen,
EvLinkDest *dest,
EvWindowRunMode mode,
+ const gchar *search_string,
gboolean unlink_temp_file,
const gchar *print_settings,
guint32 timestamp);
job->dest = NULL;
}
+ if (job->search_string) {
+ g_free (job->search_string);
+ job->search_string = NULL;
+ }
+
(* G_OBJECT_CLASS (ev_job_load_parent_class)->dispose) (object);
}
EvJob *
-ev_job_load_new (const gchar *uri, EvLinkDest *dest, EvWindowRunMode mode)
+ev_job_load_new (const gchar *uri,
+ EvLinkDest *dest,
+ EvWindowRunMode mode,
+ const gchar *search_string)
{
EvJobLoad *job;
job->dest = g_object_ref (dest);
job->mode = mode;
+ if (search_string)
+ job->search_string = g_strdup (search_string);
return EV_JOB (job);
}
EvLinkDest *dest;
EvWindowRunMode mode;
+ gchar *search_string;
GError *error;
gchar *uri;
};
GType ev_job_load_get_type (void) G_GNUC_CONST;
EvJob *ev_job_load_new (const gchar *uri,
EvLinkDest *dest,
- EvWindowRunMode mode);
+ EvWindowRunMode mode,
+ const gchar *search_string);
void ev_job_load_set_uri (EvJobLoad *load,
const gchar *uri);
void ev_job_load_run (EvJobLoad *load);
static void view_handle_link_cb (EvView *view,
EvLink *link,
EvWindow *window);
+static void ev_window_cmd_edit_find (GtkAction *action,
+ EvWindow *ev_window);
static void find_bar_search_changed_cb (EggFindBar *find_bar,
GParamSpec *param,
EvWindow *ev_window);
find_bar_search_changed_cb (EGG_FIND_BAR (ev_window->priv->find_bar),
NULL, ev_window);
}
+ } else if (job->search_string && EV_IS_DOCUMENT_FIND (document)) {
+ ev_window_cmd_edit_find (NULL, ev_window);
+ egg_find_bar_set_search_string (EGG_FIND_BAR (ev_window->priv->find_bar),
+ job->search_string);
}
ev_window_clear_load_job (ev_window);
const char *uri,
EvLinkDest *dest,
EvWindowRunMode mode,
+ const gchar *search_string,
gboolean unlink_temp_file,
const gchar *print_settings)
{
setup_size_from_metadata (ev_window);
- ev_window->priv->load_job = ev_job_load_new (uri, dest, mode);
+ ev_window->priv->load_job = ev_job_load_new (uri, dest, mode, search_string);
g_signal_connect (ev_window->priv->load_job,
"finished",
G_CALLBACK (ev_window_load_job_cb),
gtk_window_get_screen (GTK_WINDOW (window)),
dest,
0,
+ NULL,
TRUE,
NULL,
GDK_CURRENT_TIME);
ev_application_open_uri_at_dest (EV_APP, uri,
gtk_window_get_screen (GTK_WINDOW (window)),
- NULL, 0, FALSE, NULL,
+ NULL, 0, NULL, FALSE, NULL,
GDK_CURRENT_TIME);
}
{
ev_application_open_uri_at_dest (EV_APP, uri,
gtk_window_get_screen (GTK_WINDOW (window)),
- NULL, 0, FALSE, NULL,
+ NULL, 0, NULL, FALSE, NULL,
GDK_CURRENT_TIME);
}
gtk_window_get_screen (GTK_WINDOW (window)),
NULL,
EV_WINDOW_MODE_PREVIEW,
+ NULL,
TRUE,
print_settings_file,
GDK_CURRENT_TIME);
gchar *uri;
uri = g_strdup (ev_window->priv->uri);
- ev_window_open_uri (ev_window, uri, NULL, 0, FALSE, NULL);
+ ev_window_open_uri (ev_window, uri, NULL, 0, NULL, FALSE, NULL);
g_free (uri);
}
gtk_window_get_screen (GTK_WINDOW (window)),
ev_link_action_get_dest (action),
0,
+ NULL,
FALSE,
NULL,
GDK_CURRENT_TIME);
const char *uri,
EvLinkDest *dest,
EvWindowRunMode mode,
+ const gchar *search_string,
gboolean unlink_temp_file,
const gchar *print_settings);
gboolean ev_window_is_empty (const EvWindow *ev_window);
+
#ifdef WITH_PRINT
void ev_window_print_range (EvWindow *ev_window,
int first_page,
#include "ev-file-helpers.h"
static gchar *ev_page_label;
+static gchar *ev_find_string;
static gboolean preview_mode = FALSE;
static gboolean fullscren_mode = FALSE;
static gboolean presentation_mode = FALSE;
{ "fullscreen", 'f', 0, G_OPTION_ARG_NONE, &fullscren_mode, N_("Run evince in fullscreen mode"), NULL },
{ "presentation", 's', 0, G_OPTION_ARG_NONE, &presentation_mode, N_("Run evince in presentation mode"), NULL },
{ "preview", 'w', 0, G_OPTION_ARG_NONE, &preview_mode, N_("Run evince as a previewer"), NULL },
+ { "find", 'l', 0, G_OPTION_ARG_STRING, &ev_find_string, N_("The word or phrase to find in the document"), N_("STRING")},
{ "unlink-tempfile", 'u', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &unlink_temp_file, NULL, NULL },
{ "print-settings", 't', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_FILENAME, &print_settings, NULL, NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &file_arguments, NULL, N_("[FILE...]") },
ev_page_label = NULL;
}
+ if (ev_find_string) {
+ value = g_new0 (GValue, 1);
+ g_value_init (value, G_TYPE_STRING);
+ g_value_set_string (value, ev_find_string);
+
+ g_hash_table_insert (args, g_strdup ("find-string"), value);
+
+ g_free (ev_find_string);
+ ev_page_label = NULL;
+ }
+
if (fullscren_mode)
mode = EV_WINDOW_MODE_FULLSCREEN;
else if (presentation_mode)