tools/Makefile.am added GimpStringComboBox; improved image loading; set

2007-02-15  Sven Neumann  <sven@gimp.org>

	* tools/Makefile.am
	* tools/widgets.c: added GimpStringComboBox; improved image loading;
	set some window manager hints to make the doc-shooter less intrusive.


svn path=/trunk/; revision=21919
This commit is contained in:
Sven Neumann 2007-02-15 09:10:49 +00:00 committed by Sven Neumann
parent 3a0de24630
commit 6bb0d7ed23
3 changed files with 56 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2007-02-15 Sven Neumann <sven@gimp.org>
* tools/Makefile.am
* tools/widgets.c: added GimpStringComboBox; improved image loading;
set some window manager hints to make the doc-shooter less intrusive.
2007-02-12 Sven Neumann <sven@gimp.org>
* libgimpwidgets/libgimpwidgets-docs.sgml

View File

@ -8,9 +8,9 @@ libgimpmodule = $(top_builddir)/libgimpmodule/libgimpmodule-$(GIMP_API_VERSION).
libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSION).la
INCLUDES = \
-I$(top_srcdir) \
$(GTK_CFLAGS)
AM_CPPFLAGS = $(GTK_CFLAGS) -DTOP_SRCDIR=\"$(top_srcdir)\"
INCLUDES = -I$(top_srcdir)
if ENABLE_GTK_DOC

View File

@ -90,7 +90,6 @@ new_widget_info (const char *name,
info->size = size;
info->no_focus = TRUE;
if (GTK_IS_WINDOW (widget))
{
info->window = widget;
@ -103,11 +102,15 @@ new_widget_info (const char *name,
{
info->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_accept_focus (GTK_WINDOW (info->window), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (info->window), 12);
gtk_container_add (GTK_CONTAINER (info->window), widget);
gtk_widget_show_all (widget);
}
gtk_window_set_skip_taskbar_hint (GTK_WINDOW (info->window), TRUE);
gtk_widget_set_app_paintable (info->window, TRUE);
g_signal_connect (info->window, "focus", G_CALLBACK (gtk_true), NULL);
@ -136,6 +139,21 @@ color_init (GimpRGB *rgb)
gimp_rgb_set_alpha (rgb, 0.7);
}
static GdkPixbuf *
load_image (const gchar *name)
{
GdkPixbuf *pixbuf;
gchar *filename;
filename = g_build_filename (TOP_SRCDIR, "data", "images", name, NULL);
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
g_free (filename);
return pixbuf;
}
static WidgetInfo *
create_browser (void)
{
@ -573,8 +591,7 @@ area_realize (GimpPreviewArea *area)
{
GdkPixbuf *pixbuf;
pixbuf = gdk_pixbuf_new_from_file ("../../data/images/wilber-wizard.png",
NULL);
pixbuf = load_image ("wilber-wizard.png");
gimp_preview_area_draw (GIMP_PREVIEW_AREA (area), 0, 0,
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf),
@ -600,8 +617,7 @@ create_preview_area (void)
g_signal_connect (area, "realize",
G_CALLBACK (area_realize), NULL);
gtk_container_add (GTK_CONTAINER (align), area);
pixbuf = gdk_pixbuf_new_from_file ("../../data/images/wilber-wizard.png",
NULL);
pixbuf = load_image ("wilber-wizard.png");
gtk_widget_set_size_request (area,
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf));
@ -632,6 +648,31 @@ create_ratio_entry (void)
return new_widget_info ("gimp-ratio-entry", vbox, SMALL);
}
static WidgetInfo *
create_string_combo_box (void)
{
GtkWidget *vbox;
GtkWidget *combo;
GtkWidget *align;
GtkListStore *store;
vbox = gtk_vbox_new (FALSE, 6);
align = gtk_alignment_new (0.5, 0.5, 0.5, 0.0);
store = gtk_list_store_new (1, G_TYPE_STRING);
gtk_list_store_insert_with_values (store, NULL, 0, 0, "Foo", -1);
gtk_list_store_insert_with_values (store, NULL, 1, 0, "Bar", -1);
combo = gimp_string_combo_box_new (GTK_TREE_MODEL (store), 0, 0);
g_object_unref (store);
gimp_string_combo_box_set_active (GIMP_STRING_COMBO_BOX (combo), "Foo");
gtk_container_add (GTK_CONTAINER (align), combo);
gtk_box_pack_start_defaults (GTK_BOX (vbox), align);
gtk_box_pack_start (GTK_BOX (vbox),
gtk_label_new ("String Combo Box"), FALSE, FALSE, 0);
return new_widget_info ("gimp-string-combo-box", vbox, SMALL);
}
static WidgetInfo *
create_unit_menu (void)
{
@ -677,6 +718,7 @@ get_all_widgets (void)
retval = g_list_append (retval, create_pick_button ());
retval = g_list_append (retval, create_preview_area ());
retval = g_list_append (retval, create_ratio_entry ());
retval = g_list_append (retval, create_string_combo_box ());
retval = g_list_append (retval, create_unit_menu ());
return retval;