}
/* Test loading from inline data. */
- pixbuf = gdk_pixbuf_new_from_stream (-1, apple_red, FALSE, &error);
+ pixbuf = gdk_pixbuf_new_from_inline (-1, apple_red, FALSE, &error);
if (!pixbuf)
{
fprintf (stderr, "failed to construct \"red apple\" pixbuf: %s\n",
else
new_testrgb_window (pixbuf, "Red apple from inlined RLE data");
- pixbuf = gdk_pixbuf_new_from_stream (sizeof (gnome_foot), gnome_foot, TRUE, NULL);
+ pixbuf = gdk_pixbuf_new_from_inline (sizeof (gnome_foot), gnome_foot, TRUE, NULL);
new_testrgb_window (pixbuf, "GNOME Foot from inlined RLE data");
found_valid = TRUE;
int main(int argc,
char *argv[] )
{
- gtk_set_locale ();
gtk_init (&argc, &argv);
create_calendar();
set = gtk_icon_set_new ();
- source.pixbuf = gdk_pixbuf_new_from_stream (-1, inline_data, FALSE, NULL);
+ source.pixbuf = gdk_pixbuf_new_from_inline (-1, inline_data, FALSE, NULL);
g_assert (source.pixbuf);
set = gtk_icon_set_new ();
- source.pixbuf = gdk_pixbuf_new_from_stream (-1, inline_data, FALSE, NULL);
+ source.pixbuf = gdk_pixbuf_new_from_inline (-1, inline_data, FALSE, NULL);
g_assert (source.pixbuf);
source.any_size = TRUE;
- source.pixbuf = gdk_pixbuf_new_from_stream (-1, fallback_data, FALSE, NULL);
+ source.pixbuf = gdk_pixbuf_new_from_inline (-1, fallback_data, FALSE, NULL);
g_assert (source.pixbuf);
set = gtk_icon_set_new ();
- source.pixbuf = gdk_pixbuf_new_from_stream (-1, inline_data, FALSE, NULL);
+ source.pixbuf = gdk_pixbuf_new_from_inline (-1, inline_data, FALSE, NULL);
g_assert (source.pixbuf);
static GtkIconSource fallback_source = { NULL, NULL, 0, 0, 0, TRUE, TRUE, TRUE };
if (fallback_source.pixbuf == NULL)
- fallback_source.pixbuf = gdk_pixbuf_new_from_stream (-1, MISSING_IMAGE_INLINE, FALSE, NULL);
+ fallback_source.pixbuf = gdk_pixbuf_new_from_inline (-1, MISSING_IMAGE_INLINE, FALSE, NULL);
return gtk_style_render_icon (style,
&fallback_source,
GdkPixbuf *pixbuf = NULL;
image = NULL;
- pixbuf = gdk_pixbuf_new_from_stream (-1,
+ pixbuf = gdk_pixbuf_new_from_inline (-1,
entry->extra_data,
FALSE,
NULL);
return gtk_modules;
}
+static gboolean do_setlocale = TRUE;
+
+/**
+ * gtk_disable_setlocale:
+ *
+ * Prevents gtk_init() and gtk_init_check() from automatically
+ * calling setlocale (LC_ALL, ""). You would want to use this
+ * function if you wanted to set the locale for your program
+ * to something other than the user's locale, or if you wanted
+ * to set different values for different locale categories.
+ *
+ * Most programs should not need to call this function.
+ **/
+static void
+gtk_disable_setlocale (void)
+{
+ if (gtk_initialized)
+ g_warning ("gtk_disable_setlocale() must be called before gtk_init()");
+
+ do_setlocale = FALSE;
+}
+
gboolean
gtk_init_check (int *argc,
char ***argv)
g_set_message_handler (gtk_message);
g_set_print_handler (gtk_print);
#endif
+
+ if (do_setlocale)
+ setlocale (LC_ALL, "");
/* Initialize "gdk". We pass along the 'argc' and 'argv'
* parameters as they contain information that GDK uses
/**
* gtk_set_locale:
*
+ * Initializes internationalization support for GTK+. gtk_init()
+ * automatically does this, so there is typically no point
+ * in calling this function.
*
- * Initializes internationalization support for GTK+. You
- * should call this function before gtk_init() if your application
- * supports internationalization.
+ * If you are calling this function because you changed the locale
+ * after GTK+ is was initialized, then calling this function
+ * may help a bit. (Note, however, that changing the locale
+ * after GTK+ is initialized may produce inconsistent results and
+ * is not really supported.)
*
- * (In gory detail - sets the current locale according to the
+ * In detail - sets the current locale according to the
* program environment. This is the same as calling the libc function
* setlocale (LC_ALL, "") but also takes care of the locale specific
- * setup of the windowing system used by GDK.)
+ * setup of the windowing system used by GDK.
*
- * Return value: a string corresponding to the locale set, as with the C library function setlocale()
+ * Return value: a string corresponding to the locale set, as with the
+ * C library function setlocale()
**/
gchar*
gtk_set_locale (void)
int main(int argc,
char *argv[] )
{
- gtk_set_locale ();
gtk_init (&argc, &argv);
create_calendar();
srand (time (NULL));
test_init ();
- gtk_set_locale ();
/* Check to see if we are being run from the correct
* directory.
int i;
test_init ();
- gtk_set_locale ();
gtk_init (&argc, &argv);
buffer = create_buffer ();