[Xfce4-commits] [xfce/xfdesktop] 01/05: Don't hard code URI path in gtk_file_chooser_add_shortcut_folder_uri () function.
noreply at xfce.org
noreply at xfce.org
Thu Mar 26 04:30:11 CET 2015
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository xfce/xfdesktop.
commit b9e8ae884a15a4386076553d9ea0e5b32513ee85
Author: Olivier Duchateau <duchateau.olivier at gmail.com>
Date: Wed Mar 25 16:21:56 2015 +0000
Don't hard code URI path in gtk_file_chooser_add_shortcut_folder_uri () function.
Signed-off-by: Eric Koegel <eric.koegel at gmail.com>
---
settings/main.c | 43 ++++++++++++++++++++++++++++++++++++++++---
1 file changed, 40 insertions(+), 3 deletions(-)
diff --git a/settings/main.c b/settings/main.c
index 7d6f0b4..1c435b9 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -44,6 +44,10 @@
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+#include <gio/gio.h>
+
#include <libxfce4util/libxfce4util.h>
#include <xfconf/xfconf.h>
#include <libxfce4ui/libxfce4ui.h>
@@ -172,6 +176,26 @@ static gchar *xfdesktop_settings_get_backdrop_image(AppearancePanel *panel);
+const gchar *
+system_data_lookup (void)
+{
+ const gchar * const * dirs;
+ const gchar *path;
+ guint i;
+
+ dirs = g_get_system_data_dirs ();
+ for (i = 0; path == NULL && dirs[i] != NULL; ++i) {
+ path = g_build_path (G_DIR_SEPARATOR_S, dirs[i], "backdrops", NULL);
+ if (g_path_is_absolute (path) && g_file_test (path, G_FILE_TEST_IS_DIR))
+ return path;
+
+ g_free (path);
+ path = NULL;
+ }
+
+ return path;
+}
+
static void
xfdesktop_settings_free_pdata(gpointer data)
{
@@ -1702,6 +1726,9 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder *main_gxml,
WnckScreen *wnck_screen;
XfconfChannel *channel = panel->channel;
GdkColor color;
+ const gchar *path;
+ GFile *file;
+ gchar *uri_path;
TRACE("entering");
@@ -1840,9 +1867,19 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder *main_gxml,
gtk_file_filter_add_pixbuf_formats(filter);
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(panel->btn_folder), filter);
- gtk_file_chooser_add_shortcut_folder_uri(GTK_FILE_CHOOSER(panel->btn_folder),
- "file:///usr/share/backgrounds",
- NULL);
+ /* Get default wallpaper folder */
+ path = system_data_lookup ();
+
+ if (path != NULL) {
+ file = g_file_new_for_path (path);
+ uri_path = g_file_get_uri (file);
+
+ gtk_file_chooser_add_shortcut_folder_uri (GTK_FILE_CHOOSER(panel->btn_folder),
+ uri_path, NULL);
+
+ g_free (uri_path);
+ g_object_unref (file);
+ }
/* Image and color style options */
panel->image_style_combo = GTK_WIDGET(gtk_builder_get_object(appearance_gxml, "combo_style"));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list