Commit dcbe7f47 authored by Matthias Clasen's avatar Matthias Clasen

Fix 336772

parent a62b7cdc
2006-04-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrecentmanager.c: Make filename_warning() static,
and use caseless matching when looking for file:/.
(#336772, Morten Welinder)
2006-04-13 Anders Carlsson <andersca@imendio.com> 2006-04-13 Anders Carlsson <andersca@imendio.com>
* gdk/quartz/gdkevents-quartz.c: * gdk/quartz/gdkevents-quartz.c:
......
2006-04-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrecentmanager.c: Make filename_warning() static,
and use caseless matching when looking for file:/.
(#336772, Morten Welinder)
2006-04-13 Anders Carlsson <andersca@imendio.com> 2006-04-13 Anders Carlsson <andersca@imendio.com>
* gdk/quartz/gdkevents-quartz.c: * gdk/quartz/gdkevents-quartz.c:
......
...@@ -152,14 +152,38 @@ static guint signal_changed = 0; ...@@ -152,14 +152,38 @@ static guint signal_changed = 0;
G_DEFINE_TYPE (GtkRecentManager, gtk_recent_manager, G_TYPE_OBJECT); G_DEFINE_TYPE (GtkRecentManager, gtk_recent_manager, G_TYPE_OBJECT);
void static void
filename_warning (const char *format, const char *filename, const char *message) filename_warning (const gchar *format,
const gchar *filename,
const gchar *message)
{ {
char *utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL); gchar *utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
g_warning (format, utf8 ? utf8 : "(invalid filename)", message); g_warning (format, utf8 ? utf8 : "(invalid filename)", message);
g_free (utf8); g_free (utf8);
} }
/* Test of haystack has the needle prefix, comparing case
* insensitive. haystack may be UTF-8, but needle must
* contain only lowercase ascii. */
static gboolean
has_case_prefix (const gchar *haystack,
const gchar *needle)
{
const gchar *h, *n;
/* Eat one character at a time. */
h = haystack;
n = needle;
while (*n && *h && *n == g_ascii_tolower (*h))
{
n++;
h++;
}
return *n == '\0';
}
GQuark GQuark
gtk_recent_manager_error_quark (void) gtk_recent_manager_error_quark (void)
{ {
...@@ -823,7 +847,7 @@ gtk_recent_manager_add_item (GtkRecentManager *manager, ...@@ -823,7 +847,7 @@ gtk_recent_manager_add_item (GtkRecentManager *manager,
recent_data->description = NULL; recent_data->description = NULL;
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
if (g_str_has_prefix (uri, "file://")) if (has_case_prefix (uri, "file:/"))
{ {
gchar *filename; gchar *filename;
const gchar *mime_type; const gchar *mime_type;
...@@ -2062,7 +2086,7 @@ gtk_recent_info_is_local (GtkRecentInfo *info) ...@@ -2062,7 +2086,7 @@ gtk_recent_info_is_local (GtkRecentInfo *info)
{ {
g_return_val_if_fail (info != NULL, FALSE); g_return_val_if_fail (info != NULL, FALSE);
return g_str_has_prefix (info->uri, "file://"); return has_case_prefix (info->uri, "file:/");
} }
/** /**
...@@ -2203,7 +2227,7 @@ get_uri_shortname_for_display (const gchar *uri) ...@@ -2203,7 +2227,7 @@ get_uri_shortname_for_display (const gchar *uri)
gchar *name = NULL; gchar *name = NULL;
gboolean validated = FALSE; gboolean validated = FALSE;
if (g_str_has_prefix (uri, "file://")) if (has_case_prefix (uri, "file:/"))
{ {
gchar *local_file; gchar *local_file;
......
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