#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 <mclasen@redhat.com>
- 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 <mclasen@redhat.com>
- 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
#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
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)
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);