Commit 7eb1012b authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte

GladeEditorPropertyTextClass: use relative paths for resources

From now one Glade will use relative paths for filename properties
like image resources.
parent e221282d
......@@ -2181,12 +2181,14 @@ glade_editor_property_show_resource_dialog (GladeProject *project,
GtkWidget *parent,
gchar **filename)
GFile *resource_folder;
GtkWidget *dialog;
gchar *folder;
g_return_val_if_fail (filename != NULL, FALSE);
*filename = NULL;
dialog =
gtk_file_chooser_dialog_new (_
("Select a file from the project resource directory"),
......@@ -2204,26 +2206,22 @@ glade_editor_property_show_resource_dialog (GladeProject *project,
_glade_util_dialog_set_hig (GTK_DIALOG (dialog));
folder = glade_project_resource_fullpath (project, ".");
folder = glade_project_resource_fullpath (project, "");
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), folder);
resource_folder = g_file_new_for_path (folder);
g_free (folder);
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
gchar *name;
name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
*filename = name ? g_path_get_basename (name) : NULL;
g_free (name);
gtk_widget_destroy (dialog);
return TRUE;
GFile *file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
*filename = _glade_util_file_get_relative_path (resource_folder, file);
g_object_unref (file);
gtk_widget_destroy (dialog);
g_object_unref (resource_folder);
return FALSE;
return *filename != NULL;
static void
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment