Commit 8d874cf0 authored by Matthias Clasen's avatar Matthias Clasen

Stop using pango_split_file_list

Add a copy of this deprecated utility in gtkutils.c and use
it instead of the pango API.
parent 6994fe03
......@@ -1511,7 +1511,7 @@ bin_PROGRAMS = \
gtk-query-settings \
gtk-launch
gtk_query_immodules_3_0_SOURCES = queryimmodules.c
gtk_query_immodules_3_0_SOURCES = queryimmodules.c gtkutils.c
gtk_query_immodules_3_0_LDADD = \
libgtk-3.la \
$(top_builddir)/gdk/libgdk-3.la \
......
......@@ -26,6 +26,7 @@
#include "gtkprivate.h"
#include "gtkmodulesprivate.h"
#include "gtkintl.h"
#include "gtkutilsprivate.h"
#include <gmodule.h>
......@@ -77,9 +78,7 @@ get_module_path (void)
g_free (default_dir);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
result = pango_split_file_list (module_path);
G_GNUC_END_IGNORE_DEPRECATIONS
result = gtk_split_file_list (module_path);
g_free (module_path);
return result;
......@@ -419,10 +418,8 @@ load_modules (const char *module_str)
GTK_NOTE (MODULES, g_message ("Loading module list: %s", module_str));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
module_names = pango_split_file_list (module_str);
G_GNUC_END_IGNORE_DEPRECATIONS
for (i = 0; module_names[i]; i++)
module_names = gtk_split_file_list (module_str);
for (i = 0; module_names[i]; i++)
module_list = load_module (module_list, module_names[i]);
module_list = g_slist_reverse (module_list);
......
......@@ -191,3 +191,76 @@ gtk_read_line (FILE *stream, GString *str)
return (n_read > 0) ? lines : 0;
}
char *
gtk_trim_string (const char *str)
{
int len;
g_return_val_if_fail (str != NULL, NULL);
while (*str && g_ascii_isspace (*str))
str++;
len = strlen (str);
while (len > 0 && g_ascii_isspace (str[len - 1]))
len--;
return g_strndup (str, len);
}
char **
gtk_split_file_list (const char *str)
{
int i = 0;
int j;
char **files;
files = g_strsplit (str, G_SEARCHPATH_SEPARATOR_S, -1);
while (files[i])
{
char *file = gtk_trim_string (files[i]);
/* If the resulting file is empty, skip it */
if (file[0] == '\0')
{
g_free (file);
g_free (files[i]);
for (j = i + 1; files[j]; j++)
files[j - 1] = files[j];
files[j - 1] = NULL;
continue;
}
#ifndef G_OS_WIN32
/* '~' is a quite normal and common character in file names on
* Windows, especially in the 8.3 versions of long file names, which
* still occur now and then. Also, few Windows user are aware of the
* Unix shell convention that '~' stands for the home directory,
* even if they happen to have a home directory.
*/
if (file[0] == '~' && file[1] == G_DIR_SEPARATOR)
{
char *tmp = g_strconcat (g_get_home_dir(), file + 1, NULL);
g_free (file);
file = tmp;
}
else if (file[0] == '~' && file[1] == '\0')
{
g_free (file);
file = g_strdup (g_get_home_dir ());
}
#endif
g_free (files[i]);
files[i] = file;
i++;
}
return files;
}
......@@ -10,6 +10,8 @@ gboolean gtk_scan_string (const char **pos,
gboolean gtk_skip_space (const char **pos);
gint gtk_read_line (FILE *stream,
GString *str);
char * gtk_trim_string (const char *str);
char ** gtk_split_file_list (const char *str);
G_END_DECLS
......
......@@ -36,6 +36,7 @@
#include "gtk/gtkimcontextinfo.h"
#include "gtk/gtkversion.h"
#include "gtk/gtkutilsprivate.h"
#include "gtk/deprecated/gtkrc.h"
......@@ -189,9 +190,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
g_string_append_printf (contents, "# ModulesPath = %s\n#\n", path);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
dirs = pango_split_file_list (path);
G_GNUC_END_IGNORE_DEPRECATIONS
dirs = gtk_split_file_list (path);
dirs_done = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
for (i = 0; dirs[i]; i++)
......
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