Commit 6464550d authored by Paolo Borelli's avatar Paolo Borelli

More De-eelification.

parent 1d314080
2004-10-05 Paolo Borelli <pborelli@katamail.com>
2004-10-24 Paolo Borelli <pborelli@katamail.com>
* gedit-document.c:
* gedit-file.c:
* gedit-utils.[ch]: remove more eel functions.
2004-10-24 Paolo Borelli <pborelli@katamail.com>
* gedit-file-selector-util.c: always return uris.
* gedit-file.c: code cleanup.
......
......@@ -690,7 +690,7 @@ gedit_document_get_short_name (const GeditDocument* doc)
}
/* there are problems */
utf8_basename = eel_make_valid_utf8 (basename);
utf8_basename = gedit_utils_make_valid_utf8 (basename);
g_free (basename);
return utf8_basename;
}
......@@ -1814,7 +1814,7 @@ gedit_document_save_as_real (GeditDocument* doc, const gchar *uri, const GeditEn
gchar *scheme_string;
gchar *temp = gnome_vfs_get_uri_scheme (uri);
scheme_string = eel_make_valid_utf8 (temp);
scheme_string = gedit_utils_make_valid_utf8 (temp);
g_free (temp);
if (scheme_string != NULL)
......
......@@ -36,9 +36,6 @@
#include <glib/gunicode.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-vfs-extensions.h>
#include <eel/eel-string.h>
#include <sys/types.h>
#include <sys/stat.h>
......@@ -249,7 +246,7 @@ gedit_utils_uri_has_file_scheme (const gchar *uri)
canonical_uri = gnome_vfs_make_uri_canonical (uri);
g_return_val_if_fail (canonical_uri != NULL, FALSE);
res = eel_istr_has_prefix (canonical_uri, "file:");
res = g_str_has_prefix (canonical_uri, "file:");
g_free (canonical_uri);
......@@ -544,7 +541,7 @@ gedit_utils_error_reporting_loading_file (
}
else
{
gchar *host_name = eel_make_valid_utf8 (hn);
gchar *host_name = gedit_utils_make_valid_utf8 (hn);
error_message = g_strdup_printf (
_("Could not open the file \"%s\" because no host \"%s\" "
......@@ -906,7 +903,7 @@ gedit_utils_error_reporting_reverting_file (
}
else
{
gchar *host_name = eel_make_valid_utf8 (hn);
gchar *host_name = gedit_utils_make_valid_utf8 (hn);
error_message = g_strdup_printf (
_("Could not revert the file \"%s\" because no host \"%s\" "
......@@ -1383,3 +1380,42 @@ gedit_utils_str_middle_truncate (const char *string,
return truncated;
}
/* pinched from eel too */
gchar *
gedit_utils_make_valid_utf8 (const char *name)
{
GString *string;
const char *remainder, *invalid;
int remaining_bytes, valid_bytes;
string = NULL;
remainder = name;
remaining_bytes = strlen (name);
while (remaining_bytes != 0) {
if (g_utf8_validate (remainder, remaining_bytes, &invalid)) {
break;
}
valid_bytes = invalid - remainder;
if (string == NULL) {
string = g_string_sized_new (remaining_bytes);
}
g_string_append_len (string, remainder, valid_bytes);
g_string_append_c (string, '?');
remaining_bytes -= valid_bytes + 1;
remainder = invalid + 1;
}
if (string == NULL) {
return g_strdup (name);
}
g_string_append (string, remainder);
g_string_append (string, _(" (invalid Unicode)"));
g_assert (g_utf8_validate (string->str, -1, NULL));
return g_string_free (string, FALSE);
}
......@@ -94,6 +94,8 @@ void gedit_warning (GtkWindow *parent, gchar *format, ...);
gchar *gedit_utils_str_middle_truncate (const char *string,
guint truncate_length);
gchar *gedit_utils_make_valid_utf8 (const char *name);
#endif /* __GEDIT_UTILS_H__ */
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