X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=inline;f=shell%2Fev-window.c;h=528226b3ba1325903312e01846626f76d289c85f;hb=5f554d8e362a35e05840068e1b3ea935be5d3c47;hp=042b4f93ba81988b881d3a85e37dc19287c6feec;hpb=0f1c723ad2fe48a0f22e32619985f93ebb2e02ef;p=evince.git diff --git a/shell/ev-window.c b/shell/ev-window.c index 042b4f93..528226b3 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -2075,7 +2075,7 @@ file_open_dialog_response_cb (GtkWidget *chooser, ev_application_open_uri_list (EV_APP, uris, gtk_window_get_screen (GTK_WINDOW (ev_window)), - GDK_CURRENT_TIME); + gtk_get_current_event_time ()); g_slist_foreach (uris, (GFunc)g_free, NULL); g_slist_free (uris); @@ -2177,7 +2177,7 @@ ev_window_cmd_recent_file_activate (GtkAction *action, ev_application_open_uri_at_dest (EV_APP, uri, gtk_window_get_screen (GTK_WINDOW (window)), - NULL, 0, NULL, GDK_CURRENT_TIME); + NULL, 0, NULL, gtk_get_current_event_time ()); } static void @@ -2187,7 +2187,7 @@ ev_window_open_recent_action_item_activated (EvOpenRecentAction *action, { ev_application_open_uri_at_dest (EV_APP, uri, gtk_window_get_screen (GTK_WINDOW (window)), - NULL, 0, NULL, GDK_CURRENT_TIME); + NULL, 0, NULL, gtk_get_current_event_time ()); } static void @@ -2617,24 +2617,25 @@ get_print_settings_file (void) { GKeyFile *print_settings_file; gchar *filename; + GError *error = NULL; print_settings_file = g_key_file_new (); - filename = g_build_filename (ev_application_get_dot_dir (EV_APP), - EV_PRINT_SETTINGS_FILE, NULL); - if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) { - GError *error = NULL; - - g_key_file_load_from_file (print_settings_file, - filename, - G_KEY_FILE_KEEP_COMMENTS | - G_KEY_FILE_KEEP_TRANSLATIONS, - &error); - if (error) { + filename = g_build_filename (ev_application_get_dot_dir (EV_APP, FALSE), + EV_PRINT_SETTINGS_FILE, NULL); + if (!g_key_file_load_from_file (print_settings_file, + filename, + G_KEY_FILE_KEEP_COMMENTS | + G_KEY_FILE_KEEP_TRANSLATIONS, + &error)) { + + /* Don't warn if the file simply doesn't exist */ + if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) g_warning ("%s", error->message); - g_error_free (error); - } + + g_error_free (error); } + g_free (filename); return print_settings_file; @@ -2645,15 +2646,15 @@ save_print_setting_file (GKeyFile *key_file) { gchar *filename; gchar *data; - gssize data_length; + gsize data_length; GError *error = NULL; - filename = g_build_filename (ev_application_get_dot_dir (EV_APP), + filename = g_build_filename (ev_application_get_dot_dir (EV_APP, TRUE), EV_PRINT_SETTINGS_FILE, NULL); - data = g_key_file_to_data (key_file, (gsize *)&data_length, NULL); + data = g_key_file_to_data (key_file, &data_length, NULL); g_file_set_contents (filename, data, data_length, &error); if (error) { - g_warning ("%s", error->message); + g_warning ("Failed to save print settings: %s", error->message); g_error_free (error); } g_free (data); @@ -3801,7 +3802,7 @@ ev_window_cmd_edit_toolbar_cb (GtkDialog *dialog, toolbar = EGG_EDITABLE_TOOLBAR (ev_window->priv->toolbar); egg_editable_toolbar_set_edit_mode (toolbar, FALSE); - toolbars_file = g_build_filename (ev_application_get_dot_dir (EV_APP), + toolbars_file = g_build_filename (ev_application_get_dot_dir (EV_APP, TRUE), "evince_toolbar.xml", NULL); egg_toolbars_model_save_toolbars (egg_editable_toolbar_get_model (toolbar), toolbars_file, "1.0"); @@ -3945,7 +3946,7 @@ ev_window_cmd_help_contents (GtkAction *action, EvWindow *ev_window) gtk_show_uri (gtk_window_get_screen (GTK_WINDOW (ev_window)), "ghelp:evince", - GDK_CURRENT_TIME, + gtk_get_current_event_time (), &error); if (error) { ev_window_error_message (ev_window, error, @@ -5406,7 +5407,8 @@ launch_action (EvWindow *window, EvLinkAction *action) context = G_APP_LAUNCH_CONTEXT (gdk_app_launch_context_new ()); gdk_app_launch_context_set_screen (GDK_APP_LAUNCH_CONTEXT (context), gtk_window_get_screen (GTK_WINDOW (window))); - gdk_app_launch_context_set_timestamp (GDK_APP_LAUNCH_CONTEXT (context), GDK_CURRENT_TIME); + gdk_app_launch_context_set_timestamp (GDK_APP_LAUNCH_CONTEXT (context), + gtk_get_current_event_time ()); file_list.data = file; if (!g_app_info_launch (app_info, &file_list, context, &error)) { @@ -5418,6 +5420,7 @@ launch_action (EvWindow *window, EvLinkAction *action) g_object_unref (app_info); g_object_unref (file); + /* FIXMEchpe: unref launch context? */ /* According to the PDF spec filename can be an executable. I'm not sure allowing to launch executables is a good idea though. -- marco */ @@ -5435,7 +5438,7 @@ launch_external_uri (EvWindow *window, EvLinkAction *action) gdk_app_launch_context_set_screen (GDK_APP_LAUNCH_CONTEXT (context), gtk_window_get_screen (GTK_WINDOW (window))); gdk_app_launch_context_set_timestamp (GDK_APP_LAUNCH_CONTEXT (context), - GDK_CURRENT_TIME); + gtk_get_current_event_time ()); if (!g_strstr_len (uri, strlen (uri), "://") && !g_str_has_prefix (uri, "mailto:")) { @@ -5443,10 +5446,10 @@ launch_external_uri (EvWindow *window, EvLinkAction *action) /* Not a valid uri, assuming it's http */ http = g_strdup_printf ("http://%s", uri); - ret = g_app_info_launch_default_for_uri (http, NULL, &error); + ret = g_app_info_launch_default_for_uri (http, context, &error); g_free (http); } else { - ret = g_app_info_launch_default_for_uri (uri, NULL, &error); + ret = g_app_info_launch_default_for_uri (uri, context, &error); } if (ret == FALSE) { @@ -5454,6 +5457,8 @@ launch_external_uri (EvWindow *window, EvLinkAction *action) "%s", _("Unable to open external link")); g_error_free (error); } + + /* FIXMEchpe: unref launch context? */ } static void @@ -5473,7 +5478,7 @@ open_remote_link (EvWindow *window, EvLinkAction *action) ev_link_action_get_dest (action), 0, NULL, - GDK_CURRENT_TIME); + gtk_get_current_event_time ()); g_free (uri); } @@ -5753,7 +5758,7 @@ ev_attachment_popup_cmd_open_attachment (GtkAction *action, EvWindow *window) attachment = (EvAttachment *) l->data; - ev_attachment_open (attachment, screen, GDK_CURRENT_TIME, &error); + ev_attachment_open (attachment, screen, gtk_get_current_event_time (), &error); if (error) { ev_window_error_message (window, error, @@ -5922,7 +5927,7 @@ get_toolbars_model (void) toolbars_model = egg_toolbars_model_new (); - toolbars_file = g_build_filename (ev_application_get_dot_dir (EV_APP), + toolbars_file = g_build_filename (ev_application_get_dot_dir (EV_APP, FALSE), "evince_toolbar.xml", NULL); toolbars_path = g_build_filename (ev_application_get_data_dir (EV_APP), "evince-toolbar.xml", NULL); @@ -5930,8 +5935,8 @@ get_toolbars_model (void) if (!egg_toolbars_model_load_toolbars (toolbars_model, toolbars_file)) { egg_toolbars_model_load_toolbars (toolbars_model, toolbars_path); + goto skip_conversion; } - g_free (toolbars_path); /* Open item doesn't exist anymore, * convert it to OpenRecent for compatibility @@ -5948,7 +5953,10 @@ get_toolbars_model (void) break; } } + + skip_conversion: g_free (toolbars_file); + g_free (toolbars_path); egg_toolbars_model_set_flags (toolbars_model, 0, EGG_TB_MODEL_NOT_REMOVABLE);