[gnome-builder] beautifier plugin: better naming of config file storage
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] beautifier plugin: better naming of config file storage
- Date: Thu, 12 Jan 2017 22:25:18 +0000 (UTC)
commit 278fb5909b195d85ea96680a2b5cd0a947835207
Author: Sebastien Lafargue <slafargue gnome org>
Date: Sun Dec 4 20:29:34 2016 +0100
beautifier plugin: better naming of config file storage
plugins/beautifier/gb-beautifier-config.c | 12 ++++++------
plugins/beautifier/gb-beautifier-config.h | 2 +-
plugins/beautifier/gb-beautifier-process.c | 4 +++-
3 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/plugins/beautifier/gb-beautifier-config.c b/plugins/beautifier/gb-beautifier-config.c
index 0e614aa..182a536 100644
--- a/plugins/beautifier/gb-beautifier-config.c
+++ b/plugins/beautifier/gb-beautifier-config.c
@@ -29,7 +29,7 @@ config_entry_clear_func (gpointer data)
g_assert (entry != NULL);
- g_object_unref (entry->file);
+ g_object_unref (entry->config_file);
g_free (entry->name);
g_free (entry->lang_id);
@@ -65,7 +65,7 @@ gb_beautifier_config_check_duplicates (GbBeautifierWorkbenchAddin *self,
GbBeautifierConfigEntry *entry = &g_array_index (entries, GbBeautifierConfigEntry, i);
/* Check for a NULL element at the array end */
- if (entry->file == NULL)
+ if (entry->config_file == NULL)
break;
if (0 == g_strcmp0 (entry->lang_id, lang_id) &&
@@ -138,7 +138,7 @@ add_entries_from_config_ini_file (GbBeautifierWorkbenchAddin *self,
g_autofree gchar *display_name = NULL;
g_autofree gchar *command = NULL;
g_autofree gchar *command_pattern = NULL;
- g_autoptr(GFile) file = NULL;
+ g_autoptr(GFile) config_file = NULL;
g_autofree gchar *config_path = NULL;
g_auto(GStrv) strv = NULL;
gint argc;
@@ -201,11 +201,11 @@ add_entries_from_config_ini_file (GbBeautifierWorkbenchAddin *self,
}
config_path = g_build_filename (base_path, real_lang_id, profile, NULL);
- file = g_file_new_for_path (config_path);
- if (g_file_query_exists (file, NULL))
+ config_file = g_file_new_for_path (config_path);
+ if (g_file_query_exists (config_file, NULL))
{
entry.name = g_steal_pointer (&display_name);
- entry.file = g_steal_pointer (&file);
+ entry.config_file = g_steal_pointer (&config_file);
entry.lang_id = g_strdup (lang_id);
if (0 == g_strcmp0 (default_profile, profile))
diff --git a/plugins/beautifier/gb-beautifier-config.h b/plugins/beautifier/gb-beautifier-config.h
index f0f284a..4d01c67 100644
--- a/plugins/beautifier/gb-beautifier-config.h
+++ b/plugins/beautifier/gb-beautifier-config.h
@@ -34,7 +34,7 @@ typedef enum
typedef struct
{
gchar *lang_id;
- GFile *file;
+ GFile *config_file;
gchar *name;
GbBeautifierConfigCommand command;
GPtrArray *command_args;
diff --git a/plugins/beautifier/gb-beautifier-process.c b/plugins/beautifier/gb-beautifier-process.c
index 3d95ce3..68a2687 100644
--- a/plugins/beautifier/gb-beautifier-process.c
+++ b/plugins/beautifier/gb-beautifier-process.c
@@ -403,9 +403,11 @@ gb_beautifier_process_launch_async (GbBeautifierWorkbenchAddin *self,
state->begin_mark = gtk_text_buffer_create_mark (buffer, NULL, begin, TRUE);
state->end_mark = gtk_text_buffer_create_mark (buffer, NULL, end, FALSE);
state->command = entry->command;
- state->config_file = g_file_dup (entry->file);
state->lang_id = g_strdup (lang_id);
+ if (G_IS_FILE (entry->config_file))
+ state->config_file = g_file_dup (entry->config_file);
+
if (entry->command_args != NULL)
state->command_args = command_args_copy (entry->command_args);
task = g_task_new (self, cancellable, callback, user_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]