From 3fa294d1001dd7df9e54fec69883d2574be5235c Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 15 Oct 2011 19:16:19 +0200 Subject: [PATCH] Require GLib 2.22 it's already an implicit dependency --- README | 5 ++- extensions/web-cache.c | 6 --- katze/katze-utils.c | 96 ------------------------------------------ midori/gtkiconentry.c | 3 -- midori/sokoke.c | 24 ++--------- midori/sokoke.h | 9 ---- wscript | 2 +- 7 files changed, 7 insertions(+), 138 deletions(-) diff --git a/README b/README index 915dda73..805d5db6 100644 --- a/README +++ b/README @@ -11,9 +11,10 @@ Midori is a lightweight web browser. * Customizable and extensible interface. * Extensions written in C. -Requirements: GTK+ 2.10, WebkitGTK+ 1.1.17, libXML2, libsoup 2.25.2, sqlite 3.0, Vala 0.10 +Requirements: GLib 2.22, GTK+ 2.10, WebkitGTK+ 1.1.17, libXML2, + libsoup 2.27.90, sqlite 3.0, Vala 0.10 -Optional: Unique 0.9, libnotify +Optional: GTK+ 3.0, Unique 0.9, libnotify For installation instructions read INSTALL. diff --git a/extensions/web-cache.c b/extensions/web-cache.c index 9a3d0ebd..b038db8f 100644 --- a/extensions/web-cache.c +++ b/extensions/web-cache.c @@ -330,14 +330,8 @@ web_cache_mesage_got_headers_cb (SoupMessage* msg, if (!web_cache_save_headers (msg, filename)) return; - #if GLIB_CHECK_VERSION (2, 20, 0) ostream = (GOutputStream*)g_file_append_to (file, G_FILE_CREATE_PRIVATE | G_FILE_CREATE_REPLACE_DESTINATION, NULL, NULL); - #else - g_unlink (filename); - ostream = (GOutputStream*)g_file_append_to (file, - G_FILE_CREATE_PRIVATE, NULL, NULL); - #endif g_object_unref (file); if (!ostream) diff --git a/katze/katze-utils.c b/katze/katze-utils.c index 2369ea2c..9869908b 100644 --- a/katze/katze-utils.c +++ b/katze/katze-utils.c @@ -101,11 +101,7 @@ katze_app_info_get_commandline (GAppInfo* info) { const gchar* exe; - #if GLIB_CHECK_VERSION (2, 20, 0) exe = g_app_info_get_commandline (info); - #else - exe = g_object_get_data (G_OBJECT (info), "katze-cmdline"); - #endif if (!exe) exe = g_app_info_get_executable (info); if (!exe) @@ -371,95 +367,6 @@ katze_app_info_get_all_for_category (const gchar* category) return apps; } -#if !GLIB_CHECK_VERSION (2, 20, 0) -/* Icon tokenization, for Glib < 2.20 */ -static gboolean -g_icon_to_string_tokenized (GIcon *icon, - GString *s) -{ - GPtrArray *tokens; - guint i; - - if (G_IS_THEMED_ICON (icon)) - { - guint n; - const char * const *names; - tokens = g_ptr_array_new (); - g_object_get (icon, "names", &names, NULL); - for (n = 0; names[n] != NULL; n++) - g_ptr_array_add (tokens, g_strdup (names[n])); - } - else if (G_IS_FILE_ICON (icon)) - { - tokens = g_ptr_array_new (); - g_ptr_array_add (tokens, - g_file_get_uri (g_file_icon_get_file (G_FILE_ICON (icon)))); - } - else - return FALSE; - - g_string_append (s, g_type_name_from_instance ((GTypeInstance *)icon)); - - for (i = 0; i < tokens->len; i++) - { - char *token = g_ptr_array_index (tokens, i); - - g_string_append_c (s, ' '); - g_string_append_uri_escaped (s, token, "!$&'()*+,;=:@/", TRUE); - - g_free (token); - } - - g_ptr_array_free (tokens, TRUE); - - return TRUE; -} - -/* GIcon serialization, for Glib < 2.20 */ -static gchar * -g_icon_to_string (GIcon *icon) -{ - gchar *ret = NULL; - - g_return_val_if_fail (G_IS_ICON (icon), NULL); - - if (G_IS_FILE_ICON (icon)) - { - GFile *file = g_file_icon_get_file (G_FILE_ICON (icon)); - if (g_file_is_native (file)) - { - ret = g_file_get_path (file); - if (!g_utf8_validate (ret, -1, NULL)) - { - g_free (ret); - ret = NULL; - } - } - else - ret = g_file_get_uri (file); - } - else if (G_IS_THEMED_ICON (icon)) - { - const char * const *names; - g_object_get (icon, "names", &names, NULL); - if (names && names[0] && names[0][0] != '.' && - g_utf8_validate (names[0], -1, NULL) && names[1] == NULL) - ret = g_strdup (names[0]); - } - - if (ret == NULL) - { - GString *s = g_string_new (". "); - if (g_icon_to_string_tokenized (icon, s)) - ret = g_string_free (s, FALSE); - else - g_string_free (s, TRUE); - } - - return ret; -} -#endif - /** * katze_property_proxy: * @object: a #GObject @@ -744,9 +651,6 @@ katze_property_proxy (gpointer object, info = g_app_info_create_from_commandline (string, NULL, G_APP_INFO_CREATE_NONE, NULL); - #if !GLIB_CHECK_VERSION (2, 20, 0) - g_object_set_data (G_OBJECT (info), "katze-cmdline", string); - #endif entry = gtk_entry_new (); exe = g_app_info_get_executable (info); if (exe && *exe && strcmp (exe, "%f")) diff --git a/midori/gtkiconentry.c b/midori/gtkiconentry.c index 583a09a4..44fddc03 100644 --- a/midori/gtkiconentry.c +++ b/midori/gtkiconentry.c @@ -1419,8 +1419,6 @@ icon_theme_changed (GtkIconEntry *entry) gtk_icon_entry_set_icon_from_icon_name (entry, i, priv->icons[i].icon_name); } - - #if GLIB_CHECK_VERSION (2, 16, 0) else if (priv->icons[i].storage_type == _GTK_IMAGE_GICON) { g_object_unref (priv->icons[i].pixbuf); @@ -1428,7 +1426,6 @@ icon_theme_changed (GtkIconEntry *entry) gtk_icon_entry_set_icon_from_gicon (entry, i, priv->icons[i].gicon); } - #endif } gtk_widget_queue_draw (GTK_WIDGET (entry)); diff --git a/midori/sokoke.c b/midori/sokoke.c index 5530354d..14027c13 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -644,20 +644,6 @@ sokoke_hostname_from_uri (const gchar* uri, return g_strdup (uri); } -/** - * sokoke_hostname_to_ascii: - * @uri: an URI string - * - * The specified hostname is encoded if it is not ASCII. - * - * Return value: a newly allocated hostname - **/ -static gchar* -sokoke_hostname_to_ascii (const gchar* hostname) -{ - return g_hostname_to_ascii (hostname); -} - /** * sokoke_uri_to_ascii: * @uri: an URI string @@ -690,7 +676,7 @@ sokoke_uri_to_ascii (const gchar* uri) } hostname = sokoke_hostname_from_uri (uri, &path); - encoded = sokoke_hostname_to_ascii (hostname); + encoded = g_hostname_to_ascii (hostname); if (encoded) { @@ -864,7 +850,7 @@ sokoke_magic_uri (const gchar* uri) if (!strchr (uri, ' ') && ((search = strchr (uri, ':')) || (search = strchr (uri, '@'))) && search[0] && !g_ascii_isalpha (search[1])) - return sokoke_idn_to_punycode (g_strconcat ("http://", uri, NULL)); + return g_strconcat ("http://", uri, NULL); if ((!strcmp (uri, "localhost") || strchr (uri, '/')) && sokoke_resolve_hostname (uri)) return g_strconcat ("http://", uri, NULL); @@ -878,7 +864,7 @@ sokoke_magic_uri (const gchar* uri) { search = g_strconcat ("http://", uri, NULL); g_strfreev (parts); - return sokoke_idn_to_punycode (search); + return search; } } g_strfreev (parts); @@ -1933,11 +1919,7 @@ sokoke_prefetch_uri (MidoriWebSettings* settings, if (!s_uri || !s_uri->host) return FALSE; - #if GLIB_CHECK_VERSION (2, 22, 0) if (g_hostname_is_ip_address (s_uri->host)) - #else - if (g_ascii_isdigit (s_uri->host[0]) && g_strstr_len (s_uri->host, 4, ".")) - #endif { soup_uri_free (s_uri); return FALSE; diff --git a/midori/sokoke.h b/midori/sokoke.h index 20bb9dca..3e132df2 100644 --- a/midori/sokoke.h +++ b/midori/sokoke.h @@ -16,15 +16,6 @@ #include #include -#if !GLIB_CHECK_VERSION (2, 14, 0) - #define G_PARAM_STATIC_STRINGS \ - (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB) -#endif - -#if !GLIB_CHECK_VERSION (2, 18, 0) - #define g_content_type_from_mime_type(mtp) g_strdup (mtp) -#endif - #if !GLIB_CHECK_VERSION (2, 30, 0) #define g_format_size(sz) g_format_size_for_display ((goffset)sz) #endif diff --git a/wscript b/wscript index 40b639ab..c7b616b2 100644 --- a/wscript +++ b/wscript @@ -185,7 +185,7 @@ def configure (conf): conf.check (lib='m', mandatory=True) check_pkg ('gmodule-2.0', '2.8.0', False) check_pkg ('gthread-2.0', '2.8.0', False) - check_pkg ('gio-2.0', '2.16.0') + check_pkg ('gio-2.0', '2.22.0') args = '' if Options.platform == 'win32': args = '--define-variable=target=win32' -- 2.39.5