From dad59bf5059c08dd62702bffb55da3f74b86871c Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 6 Nov 2008 01:36:57 +0100 Subject: [PATCH] Remove unused gdk_pixbuf_new_from_stream and sokoke_web_icon --- midori/compat.c | 82 ------------------------------------------------- midori/compat.h | 13 -------- midori/sokoke.c | 38 ----------------------- midori/sokoke.h | 5 --- 4 files changed, 138 deletions(-) diff --git a/midori/compat.c b/midori/compat.c index e51fc095..20fdc2df 100644 --- a/midori/compat.c +++ b/midori/compat.c @@ -29,88 +29,6 @@ g_strcmp0 (const gchar* string1, #endif -#if !GTK_CHECK_VERSION(2, 14, 0) - -#if GLIB_CHECK_VERSION (2, 16, 0) - -/* GTK+/ GdkPixbuf internal helper function - Copyright (C) 2008 Matthias Clasen - Copied from Gtk+ 2.13, coding style adjusted */ - -static GdkPixbuf* -load_from_stream (GdkPixbufLoader* loader, - GInputStream* stream, - GCancellable* cancellable, - GError** error) -{ - GdkPixbuf* pixbuf; - gssize n_read; - guchar buffer[65536]; - gboolean res; - - res = TRUE; - while (1) - { - n_read = g_input_stream_read (stream, buffer, sizeof (buffer), - cancellable, error); - if (n_read < 0) - { - res = FALSE; - error = NULL; /* Ignore further errors */ - break; - } - - if (!n_read) - break; - - if (!gdk_pixbuf_loader_write (loader, buffer, n_read, - error)) - { - res = FALSE; - error = NULL; - break; - } - } - - if (!gdk_pixbuf_loader_close (loader, error)) - { - res = FALSE; - error = NULL; - } - - pixbuf = NULL; - if (res) - { - pixbuf = gdk_pixbuf_loader_get_pixbuf (loader); - if (pixbuf) - g_object_ref (pixbuf); - } - - return pixbuf; -} - -/* GTK+/ GdkPixbuf stream loading function - Copyright (C) 2008 Matthias Clasen - Copied from Gtk+ 2.13, coding style adjusted */ -GdkPixbuf* -gdk_pixbuf_new_from_stream (GInputStream* stream, - GCancellable* cancellable, - GError** error) -{ - GdkPixbuf* pixbuf; - GdkPixbufLoader* loader; - - loader = gdk_pixbuf_loader_new (); - pixbuf = load_from_stream (loader, stream, cancellable, error); - g_object_unref (loader); - - return pixbuf; -} - -#endif - -#endif - #if !GTK_CHECK_VERSION(2, 12, 0) void diff --git a/midori/compat.h b/midori/compat.h index 423b2236..68cda360 100644 --- a/midori/compat.h +++ b/midori/compat.h @@ -32,19 +32,6 @@ g_strcmp0 (const gchar* string1, #endif -#if !GTK_CHECK_VERSION (2, 14, 0) - -#if GLIB_CHECK_VERSION (2, 16, 0) - -GdkPixbuf* -gdk_pixbuf_new_from_stream (GInputStream* stream, - GCancellable* cancellable, - GError** error); - -#endif - -#endif - #if !GTK_CHECK_VERSION(2, 12, 0) void diff --git a/midori/sokoke.c b/midori/sokoke.c index 34036698..5310cf4c 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -474,44 +474,6 @@ sokoke_widget_get_text_size (GtkWidget* widget, g_object_unref (layout); } -GdkPixbuf* -sokoke_web_icon (const gchar* icon, - GtkIconSize size, - GtkWidget* widget) -{ - g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); - - GdkPixbuf* pixbuf = NULL; - if (icon && *icon) - { - /* TODO: We want to allow http as well, maybe also base64? */ - const gchar* icon_ready = g_str_has_prefix (icon, "file://") - ? &icon[7] : icon; - GtkStockItem stock_id; - if (gtk_stock_lookup (icon, &stock_id)) - pixbuf = gtk_widget_render_icon (widget, icon_ready, size, NULL); - else - { - gint width, height; - if (gtk_widget_has_screen (widget)) - { - GdkScreen* screen = gtk_widget_get_screen (widget); - gtk_icon_size_lookup_for_settings ( - gtk_settings_get_for_screen (screen), - size, &width, &height); - pixbuf = gtk_icon_theme_load_icon ( - gtk_icon_theme_get_for_screen (screen), icon, - MAX (width, height), GTK_ICON_LOOKUP_USE_BUILTIN, NULL); - } - } - if (!pixbuf) - pixbuf = gdk_pixbuf_new_from_file_at_size (icon_ready, 16, 16, NULL); - } - if (!pixbuf) - pixbuf = gtk_widget_render_icon (widget, GTK_STOCK_FIND, size, NULL); - return pixbuf; -} - gint sokoke_object_get_int (gpointer object, const gchar* property) diff --git a/midori/sokoke.h b/midori/sokoke.h index 0f69217b..526e9b3f 100644 --- a/midori/sokoke.h +++ b/midori/sokoke.h @@ -115,11 +115,6 @@ sokoke_widget_get_text_size (GtkWidget* widget, gint* width, gint* height); -GdkPixbuf* -sokoke_web_icon (const gchar* icon, - GtkIconSize size, - GtkWidget* widget); - gint sokoke_object_get_int (gpointer object, const gchar* property);