From: Carlos Garcia Campos Date: Sat, 11 Aug 2007 08:46:49 +0000 (+0000) Subject: Use g_get_user_special_dir when available instead of xdg_user_dir_lookup. X-Git-Tag: EVINCE_2_19_4~29 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=78f315088376c895f9e27524a998a4114fd76c2c;p=evince.git Use g_get_user_special_dir when available instead of xdg_user_dir_lookup. 2007-08-11 Carlos Garcia Campos * shell/ev-window.c: (ev_window_cmd_file_open), (ev_window_cmd_save_as): Use g_get_user_special_dir when available instead of xdg_user_dir_lookup. svn path=/trunk/; revision=2616 --- diff --git a/ChangeLog b/ChangeLog index 057e0b49..2f5c5b39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-08-11 Carlos Garcia Campos + + * shell/ev-window.c: (ev_window_cmd_file_open), + (ev_window_cmd_save_as): + + Use g_get_user_special_dir when available instead of + xdg_user_dir_lookup. + 2007-08-10 Nickolay V. Shmyrev * MAINTAINERS: diff --git a/shell/ev-window.c b/shell/ev-window.c index d3787180..1032d518 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -97,7 +97,9 @@ #include #include +#if !GLIB_CHECK_VERSION (2, 13, 3) char *xdg_user_dir_lookup (char *type); +#endif typedef enum { PAGE_MODE_DOCUMENT, @@ -1551,12 +1553,20 @@ ev_window_cmd_file_open (GtkAction *action, EvWindow *window) gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (chooser), window->priv->uri); } else { +#if GLIB_CHECK_VERSION (2, 13, 3) + const gchar *folder; + + folder = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS); + gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (chooser), + folder ? folder : g_get_home_dir ()); +#else char *folder; folder = xdg_user_dir_lookup ("DOCUMENTS"); gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (chooser), folder); free (folder); +#endif } g_signal_connect (chooser, "response", @@ -2090,7 +2100,11 @@ ev_window_cmd_save_as (GtkAction *action, EvWindow *ev_window) GtkWidget *fc; gchar *base_name; gchar *file_name; +#if GLIB_CHECK_VERSION (2, 13, 3) + const gchar *folder; +#else gchar *folder; +#endif fc = gtk_file_chooser_dialog_new ( _("Save a Copy"), @@ -2106,12 +2120,20 @@ ev_window_cmd_save_as (GtkAction *action, EvWindow *ev_window) gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fc), TRUE); file_name = gnome_vfs_format_uri_for_display (ev_window->priv->uri); base_name = g_path_get_basename (file_name); - folder = xdg_user_dir_lookup ("DOCUMENTS"); gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (fc), base_name); + +#if GLIB_CHECK_VERSION (2, 13, 3) + folder = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS); + gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (fc), + folder ? folder : g_get_home_dir ()); +#else + folder = xdg_user_dir_lookup ("DOCUMENTS"); gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (fc), folder); + free (folder); +#endif + g_free (file_name); g_free (base_name); - free (folder); g_signal_connect (fc, "response", G_CALLBACK (file_save_dialog_response_cb),