Branch: refs/heads/master Author: Nick Treleaven nick.treleaven@btinternet.com Committer: Nick Treleaven nick.treleaven@btinternet.com Date: Mon, 06 Feb 2012 16:41:18 Commit: 9426104f0b18dcca295c7615abd99dc3f207463f https://github.com/geany/geany/commit/9426104f0b18dcca295c7615abd99dc3f20746...
Log Message: ----------- Remove utils_build_path() - use g_build_filename instead
Modified Paths: -------------- src/editor.c src/filetypes.c src/highlighting.c src/keyfile.c src/symbols.c src/templates.c src/toolbar.c src/utils.c src/utils.h
Modified: src/editor.c 4 files changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -4734,7 +4734,7 @@ void editor_destroy(GeanyEditor *editor)
static void on_document_save(GObject *obj, GeanyDocument *doc) { - gchar *f = utils_build_path(app->configdir, "snippets.conf", NULL); + gchar *f = g_build_filename(app->configdir, "snippets.conf", NULL);
g_return_if_fail(NZV(doc->real_path));
@@ -4781,7 +4781,7 @@ void editor_init(void) * handler (on_editor_notify) is called */ g_signal_connect_after(geany_object, "editor-notify", G_CALLBACK(on_editor_notify), NULL);
- f = utils_build_path(app->configdir, "snippets.conf", NULL); + f = g_build_filename(app->configdir, "snippets.conf", NULL); ui_add_config_file_menu_item(f, NULL, NULL); g_free(f); g_signal_connect(geany_object, "document-save", G_CALLBACK(on_document_save), NULL);
Modified: src/filetypes.c 14 files changed, 7 insertions(+), 7 deletions(-) =================================================================== @@ -644,7 +644,7 @@ void filetypes_init_types() filetype_add(filetypes[ft_id]); } init_custom_filetypes(app->datadir); - f = utils_build_path(app->configdir, GEANY_FILEDEFS_SUBDIR, NULL); + f = g_build_filename(app->configdir, GEANY_FILEDEFS_SUBDIR, NULL); init_custom_filetypes(f); g_free(f);
@@ -662,12 +662,12 @@ static void on_document_save(G_GNUC_UNUSED GObject *object, GeanyDocument *doc)
g_return_if_fail(NZV(doc->real_path));
- f = utils_build_path(app->configdir, "filetype_extensions.conf", NULL); + f = g_build_filename(app->configdir, "filetype_extensions.conf", NULL); if (utils_str_equal(doc->real_path, f)) filetypes_reload_extensions();
g_free(f); - f = utils_build_path(app->configdir, GEANY_FILEDEFS_SUBDIR, "filetypes.common", NULL); + f = g_build_filename(app->configdir, GEANY_FILEDEFS_SUBDIR, "filetypes.common", NULL); if (utils_str_equal(doc->real_path, f)) { guint i; @@ -687,9 +687,9 @@ static void setup_config_file_menus(void) { gchar *f;
- f = utils_build_path(app->configdir, "filetype_extensions.conf", NULL); + f = g_build_filename(app->configdir, "filetype_extensions.conf", NULL); ui_add_config_file_menu_item(f, NULL, NULL); - SETPTR(f, utils_build_path(app->configdir, GEANY_FILEDEFS_SUBDIR, "filetypes.common", NULL)); + SETPTR(f, g_build_filename(app->configdir, GEANY_FILEDEFS_SUBDIR, "filetypes.common", NULL)); ui_add_config_file_menu_item(f, NULL, NULL); g_free(f);
@@ -808,11 +808,11 @@ static gboolean match_basename(gconstpointer pft, gconstpointer user_data) #endif SETPTR(lfn, utils_get_locale_from_utf8(lfn));
- path = utils_build_path(app->configdir, GEANY_FILEDEFS_SUBDIR, "filetypes.", NULL); + path = g_build_filename(app->configdir, GEANY_FILEDEFS_SUBDIR, "filetypes.", NULL); if (g_str_has_prefix(lfn, path)) found = TRUE;
- SETPTR(path, utils_build_path(app->datadir, "filetypes.", NULL)); + SETPTR(path, g_build_filename(app->datadir, "filetypes.", NULL)); if (g_str_has_prefix(lfn, path)) found = TRUE;
Modified: src/highlighting.c 4 files changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -1230,9 +1230,9 @@ static void add_color_scheme_item(GtkWidget *menu, const gchar *fname) gchar *path, *theme_name, *tooltip; gchar *theme_fn = utils_get_utf8_from_locale(fname);
- path = utils_build_path(app->configdir, GEANY_COLORSCHEMES_SUBDIR, fname, NULL); + path = g_build_filename(app->configdir, GEANY_COLORSCHEMES_SUBDIR, fname, NULL); hkeyfile = utils_key_file_new(path); - SETPTR(path, utils_build_path(app->datadir, GEANY_COLORSCHEMES_SUBDIR, fname, NULL)); + SETPTR(path, g_build_filename(app->datadir, GEANY_COLORSCHEMES_SUBDIR, fname, NULL)); skeyfile = utils_key_file_new(path);
theme_name = utils_get_setting(locale_string, hkeyfile, skeyfile, "theme_info", "name", theme_fn);
Modified: src/keyfile.c 6 files changed, 3 insertions(+), 3 deletions(-) =================================================================== @@ -978,7 +978,7 @@ void configuration_save_default_session(void) */ void configuration_reload_default_session(void) { - const gchar *configfile = utils_build_path(app->configdir, "geany.conf", NULL); + const gchar *configfile = g_build_filename(app->configdir, "geany.conf", NULL); GKeyFile *config = g_key_file_new();
g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, NULL); @@ -991,14 +991,14 @@ void configuration_reload_default_session(void)
gboolean configuration_load(void) { - gchar *configfile = utils_build_path(app->configdir, "geany.conf", NULL); + gchar *configfile = g_build_filename(app->configdir, "geany.conf", NULL); GKeyFile *config = g_key_file_new();
if (! g_file_test(configfile, G_FILE_TEST_IS_REGULAR)) { /* config file does not (yet) exist, so try to load a global config file which may be */ /* created by distributors */ geany_debug("No user config file found, trying to use global configuration."); - SETPTR(configfile, utils_build_path(app->datadir, "geany.conf", NULL)); + SETPTR(configfile, g_build_filename(app->datadir, "geany.conf", NULL)); } g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, NULL); g_free(configfile);
Modified: src/symbols.c 8 files changed, 4 insertions(+), 4 deletions(-) =================================================================== @@ -1732,7 +1732,7 @@ void symbols_show_load_tags_dialog(void) GHashTable *lang_hash; gchar *dir;
- dir = utils_build_path(app->configdir, "tags", NULL); + dir = g_build_filename(app->configdir, "tags", NULL); /* create the user tags dir for next time if it doesn't exist */ if (! g_file_test(dir, G_FILE_TEST_IS_DIR)) { @@ -1740,7 +1740,7 @@ void symbols_show_load_tags_dialog(void) } file_list = utils_get_file_list_full(dir, TRUE, TRUE, NULL);
- SETPTR(dir, utils_build_path(app->datadir, "tags", NULL)); + SETPTR(dir, g_build_filename(app->datadir, "tags", NULL)); list = utils_get_file_list_full(dir, TRUE, TRUE, NULL); g_free(dir);
@@ -2171,7 +2171,7 @@ static void create_taglist_popup_menu(void)
static void on_document_save(G_GNUC_UNUSED GObject *object, GeanyDocument *doc) { - gchar *f = utils_build_path(app->configdir, "ignore.tags", NULL); + gchar *f = g_build_filename(app->configdir, "ignore.tags", NULL);
g_return_if_fail(NZV(doc->real_path));
@@ -2188,7 +2188,7 @@ void symbols_init(void)
create_taglist_popup_menu();
- f = utils_build_path(app->configdir, "ignore.tags", NULL); + f = g_build_filename(app->configdir, "ignore.tags", NULL); ui_add_config_file_menu_item(f, NULL, NULL); g_free(f);
Modified: src/templates.c 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -298,7 +298,7 @@ static void on_file_menu_hide(GtkWidget *item) /* reload templates if any file in the templates path is saved */ static void on_document_save(G_GNUC_UNUSED GObject *object, GeanyDocument *doc) { - gchar *path = utils_build_path(app->configdir, GEANY_TEMPLATES_SUBDIR, NULL); + gchar *path = g_build_filename(app->configdir, GEANY_TEMPLATES_SUBDIR, NULL);
g_return_if_fail(NZV(doc->real_path));
Modified: src/toolbar.c 6 files changed, 3 insertions(+), 3 deletions(-) =================================================================== @@ -215,7 +215,7 @@ void toolbar_item_ref(GtkToolItem *item) else { /* Load the toolbar UI XML file from disk (first from config dir, then try data dir) */ - filename = utils_build_path(app->configdir, "ui_toolbar.xml", NULL); + filename = g_build_filename(app->configdir, "ui_toolbar.xml", NULL); merge_id = gtk_ui_manager_add_ui_from_file(uim, filename, &error); if (merge_id == 0) { @@ -224,7 +224,7 @@ void toolbar_item_ref(GtkToolItem *item) g_error_free(error); error = NULL;
- SETPTR(filename, utils_build_path(app->datadir, "ui_toolbar.xml", NULL)); + SETPTR(filename, g_build_filename(app->datadir, "ui_toolbar.xml", NULL)); merge_id = gtk_ui_manager_add_ui_from_file(uim, filename, &error); } g_free(filename); @@ -897,7 +897,7 @@ static void tb_editor_write_markup(TBEditorWidget *tbw)
toolbar_reload(str->str);
- filename = utils_build_path(app->configdir, "ui_toolbar.xml", NULL); + filename = g_build_filename(app->configdir, "ui_toolbar.xml", NULL); utils_write_file(filename, str->str); g_free(filename);
Modified: src/utils.c 39 files changed, 0 insertions(+), 39 deletions(-) =================================================================== @@ -1754,45 +1754,6 @@ gboolean utils_spawn_async(const gchar *dir, gchar **argv, gchar **env, GSpawnFl }
-static gboolean utils_string_vappend(GString *buffer, const gchar *sep, va_list args) -{ - const gchar *str = va_arg(args, const gchar *); - - if (!str) - return FALSE; - do - { - g_string_append(buffer, str); - str = va_arg(args, const gchar *); - if (str && sep) - g_string_append(buffer, sep); - } - while (str); - - return TRUE; -} - - -/* Like g_build_path() but without first argument. */ -gchar *utils_build_path(const gchar *first, ...) -{ - static GString *buffer = NULL; - va_list args; - - if (! buffer) - buffer = g_string_new(first); - else - g_string_assign(buffer, first); - - g_string_append_c(buffer, G_DIR_SEPARATOR); - - va_start(args, first); - utils_string_vappend(buffer, G_DIR_SEPARATOR_S, args); - va_end(args); - return g_strdup(buffer->str); -} - - /* Retrieves the path for the given URI. * It returns: * - the path which was determined by g_filename_from_uri() or GIO
Modified: src/utils.h 2 files changed, 0 insertions(+), 2 deletions(-) =================================================================== @@ -264,8 +264,6 @@ gboolean utils_spawn_async(const gchar *dir, gchar **argv, gchar **env, GSpawnFl
gint utils_str_casecmp(const gchar *s1, const gchar *s2);
-gchar *utils_build_path(const gchar *first, ...) G_GNUC_NULL_TERMINATED; - gchar *utils_get_path_from_uri(const gchar *uri);
gboolean utils_is_uri(const gchar *uri);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: TBD).