-/**
- * 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;
-}
-
-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;
-}
-
-static void
-value_free (GValue *value)
-{
- g_value_unset (value);
- g_free (value);
-}
-
-static GHashTable *
-build_args (GdkScreen *screen,
- EvLinkDest *dest,
- EvWindowRunMode mode,
- const gchar *search_string)
-{
- GHashTable *args;
- GValue *value;
- GdkDisplay *display;
- const gchar *display_name;
- gint screen_number;
-
- args = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- (GDestroyNotify)g_free,
- (GDestroyNotify)value_free);
-
- /* Display */
- display = gdk_screen_get_display (screen);
- display_name = gdk_display_get_name (display);
- value = g_new0 (GValue, 1);
- g_value_init (value, G_TYPE_STRING);
- g_value_set_string (value, display_name);
- g_hash_table_insert (args, g_strdup ("display"), value);
-
- /* Screen */
- screen_number = gdk_screen_get_number (screen);
- value = g_new0 (GValue, 1);
- g_value_init (value, G_TYPE_INT);
- g_value_set_int (value, screen_number);
- g_hash_table_insert (args, g_strdup ("screen"), value);
-
- /* Page label */
- if (dest) {
- value = g_new0 (GValue, 1);
- g_value_init (value, G_TYPE_STRING);
- g_value_set_string (value, ev_link_dest_get_page_label (dest));
-
- g_hash_table_insert (args, g_strdup ("page-label"), value);
- }
-
- /* Find string */
- if (search_string) {
- value = g_new0 (GValue, 1);
- g_value_init (value, G_TYPE_STRING);
- g_value_set_string (value, search_string);
-
- g_hash_table_insert (args, g_strdup ("find-string"), value);
- }
-
- /* Mode */
- if (mode != EV_WINDOW_MODE_NORMAL) {
- value = g_new0 (GValue, 1);
- g_value_init (value, G_TYPE_UINT);
- g_value_set_uint (value, mode);
-
- g_hash_table_insert (args, g_strdup ("mode"), value);
- }
-
- return args;
-}
-