+#endif
+
+/**
+ * ev_display_open_if_needed:
+ * @name: the name of the display to be open if it's needed.
+ *
+ * Search among all the open displays if any of them have the same name as the
+ * passed name. If the display isn't found it tries the open it.
+ *
+ * Returns: a #GdkDisplay of the display with the passed name.
+ */
+static GdkDisplay *
+ev_display_open_if_needed (const gchar *name)
+{
+ GSList *displays;
+ GSList *l;
+ GdkDisplay *display = NULL;
+
+ displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
+
+ for (l = displays; l != NULL; l = l->next) {
+ const gchar *display_name = gdk_display_get_name ((GdkDisplay *) l->data);
+
+ if (g_ascii_strcasecmp (display_name, name) == 0) {
+ display = l->data;
+ break;
+ }
+ }
+
+ g_slist_free (displays);
+
+ return display != NULL ? display : gdk_display_open (name);
+}
+
+/**
+ * get_screen_from_args:
+ * @args: a #GHashTable with data passed to the application.
+ *
+ * Looks for the screen in the display available in the hash table passed to the
+ * application. If the display isn't opened, it's opened and the #GdkScreen
+ * assigned to the screen in that display returned.
+ *
+ * Returns: the #GdkScreen assigned to the screen on the display indicated by
+ * the data on the #GHashTable.
+ */
+static GdkScreen *
+get_screen_from_args (GHashTable *args)
+{
+ GValue *value = NULL;
+ GdkDisplay *display = NULL;
+ GdkScreen *screen = NULL;
+
+ g_assert (args != NULL);
+
+ value = g_hash_table_lookup (args, "display");
+ if (value) {
+ const gchar *display_name;
+
+ display_name = g_value_get_string (value);
+ display = ev_display_open_if_needed (display_name);
+ }
+
+ value = g_hash_table_lookup (args, "screen");
+ if (value) {
+ gint screen_number;
+
+ screen_number = g_value_get_int (value);
+ screen = gdk_display_get_screen (display, screen_number);
+ }
+
+ return screen;
+}
+
+/**
+ * get_window_run_mode_from_args:
+ * @args: a #GHashTable with data passed to the application.
+ *
+ * It does look if the mode option has been passed from command line, using it
+ * as the window run mode, otherwise the run mode will be the normal mode.
+ *
+ * Returns: The window run mode passed from command line or
+ * EV_WINDOW_MODE_NORMAL in other case.
+ */
+static EvWindowRunMode
+get_window_run_mode_from_args (GHashTable *args)
+{
+ EvWindowRunMode mode = EV_WINDOW_MODE_NORMAL;
+ GValue *value = NULL;
+
+ g_assert (args != NULL);
+
+ value = g_hash_table_lookup (args, "mode");
+ if (value) {
+ mode = g_value_get_uint (value);
+ }
+
+ return mode;
+}
+
+/**
+ * get_destination_from_args:
+ * @args: a #GHashTable with data passed to the application.
+ *
+ * It does look for the page-label argument parsed from the command line and
+ * if it does exist, it returns an #EvLinkDest.
+ *
+ * Returns: An #EvLinkDest to page-label if it has been passed from the command
+ * line, NULL in other case.
+ */
+static EvLinkDest *
+get_destination_from_args (GHashTable *args)
+{
+ EvLinkDest *dest = NULL;
+ GValue *value = NULL;
+
+ g_assert (args != NULL);
+
+ value = g_hash_table_lookup (args, "page-label");
+ if (value) {
+ const gchar *page_label;
+
+ page_label = g_value_get_string (value);
+ dest = ev_link_dest_new_page_label (page_label);
+ }
+
+ return dest;
+}
+
+/**
+ * get_unlink_temp_file_from_args:
+ * @args: a #GHashTable with data passed to the application.
+ *
+ * It does look if the unlink-temp-file option has been passed from the command
+ * line returning it's boolean representation, otherwise it does return %FALSE.
+ *
+ * Returns: the boolean representation of the unlink-temp-file value or %FALSE
+ * in other case.
+ */
+static gboolean
+get_unlink_temp_file_from_args (GHashTable *args)
+{
+ gboolean unlink_temp_file = FALSE;
+ GValue *value = NULL;
+
+ g_assert (args != NULL);
+
+ value = g_hash_table_lookup (args, "unlink-temp-file");
+ if (value) {
+ unlink_temp_file = g_value_get_boolean (value);
+ }
+
+ return unlink_temp_file;
+}