libgimpwidgets/gimpwidgets.[ch] added new utility function

2004-06-21  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpwidgets.[ch]
	* libgimpwidgets/gimpwidgets.def: added new utility function
	gimp_label_set_attributes().

	* app/display/gimpdisplayshell.c
	* app/gui/preferences-dialog.c
	* app/gui/resolution-calibrate-dialog.c
	* app/widgets/gimpviewabledialog.c
	* app/widgets/gimpwidgets-utils.c: use the new function.

	* app/widgets/gimpcontainergridview.c
	* app/widgets/gimphistogrameditor.c: display the name in italic.

	* plug-ins/common/jpeg.c: display the file size in italic.
This commit is contained in:
Sven Neumann 2004-06-21 13:18:50 +00:00 committed by Sven Neumann
parent f68a788d01
commit 2670ce0bf8
23 changed files with 249 additions and 154 deletions

View File

@ -1,3 +1,20 @@
2004-06-21 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpwidgets.[ch]
* libgimpwidgets/gimpwidgets.def: added new utility function
gimp_label_set_attributes().
* app/display/gimpdisplayshell.c
* app/gui/preferences-dialog.c
* app/gui/resolution-calibrate-dialog.c
* app/widgets/gimpviewabledialog.c
* app/widgets/gimpwidgets-utils.c: use the new function.
* app/widgets/gimpcontainergridview.c
* app/widgets/gimphistogrameditor.c: display the name in italic.
* plug-ins/common/jpeg.c: display the file size in italic.
2004-06-20 Bill Skaggs <weskaggs@primate.ucdavis.edu> 2004-06-20 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* plug-ins/common/url.c: if url does not end in a recognized * plug-ins/common/url.c: if url does not end in a recognized

View File

@ -950,8 +950,6 @@ prefs_dialog_new (Gimp *gimp,
GtkWidget *image; GtkWidget *image;
GtkWidget *sizeentry; GtkWidget *sizeentry;
GtkWidget *calibrate_button; GtkWidget *calibrate_button;
PangoAttrList *attrs;
PangoAttribute *attr;
GSList *group; GSList *group;
GtkWidget *editor; GtkWidget *editor;
gint i; gint i;
@ -1040,24 +1038,13 @@ prefs_dialog_new (Gimp *gimp,
label = gtk_label_new (NULL); label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gimp_label_set_attributes (GTK_LABEL (label),
PANGO_ATTR_SCALE, PANGO_SCALE_LARGE,
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
-1);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 6); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 6);
gtk_widget_show (label); gtk_widget_show (label);
attrs = pango_attr_list_new ();
attr = pango_attr_scale_new (PANGO_SCALE_LARGE);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
gtk_label_set_attributes (GTK_LABEL (label), attrs);
pango_attr_list_unref (attrs);
image = gtk_image_new (); image = gtk_image_new ();
gtk_box_pack_end (GTK_BOX (hbox), image, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_widget_show (image); gtk_widget_show (image);

View File

@ -49,15 +49,13 @@ void
resolution_calibrate_dialog (GtkWidget *resolution_entry, resolution_calibrate_dialog (GtkWidget *resolution_entry,
GdkPixbuf *pixbuf) GdkPixbuf *pixbuf)
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *table; GtkWidget *table;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *ruler; GtkWidget *ruler;
GtkWidget *label; GtkWidget *label;
GdkScreen *screen; GdkScreen *screen;
PangoAttrList *attrs;
PangoAttribute *attr;
g_return_if_fail (GIMP_IS_SIZE_ENTRY (resolution_entry)); g_return_if_fail (GIMP_IS_SIZE_ENTRY (resolution_entry));
g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf)); g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
@ -122,24 +120,13 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_label_new (_("Measure the rulers and enter their lengths:")); gtk_label_new (_("Measure the rulers and enter their lengths:"));
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gimp_label_set_attributes (GTK_LABEL (label),
PANGO_ATTR_SCALE, PANGO_SCALE_LARGE,
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
-1);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label); gtk_widget_show (label);
attrs = pango_attr_list_new ();
attr = pango_attr_scale_new (PANGO_SCALE_LARGE);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
gtk_label_set_attributes (GTK_LABEL (label), attrs);
pango_attr_list_unref (attrs);
hbox = gtk_hbox_new (FALSE, 0); hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox); gtk_widget_show (hbox);

View File

@ -1474,8 +1474,6 @@ gimp_display_shell_close_warning_dialog (GimpDisplayShell *shell,
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *image; GtkWidget *image;
GtkWidget *label; GtkWidget *label;
PangoAttrList *attrs;
PangoAttribute *attr;
gchar *name; gchar *name;
gchar *title; gchar *title;
gchar *message; gchar *message;
@ -1526,18 +1524,6 @@ gimp_display_shell_close_warning_dialog (GimpDisplayShell *shell,
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
gtk_widget_show (vbox); gtk_widget_show (vbox);
attrs = pango_attr_list_new ();
attr = pango_attr_scale_new (PANGO_SCALE_LARGE);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
message = g_strdup_printf (_("Changes were made to '%s'."), name); message = g_strdup_printf (_("Changes were made to '%s'."), name);
label = gtk_label_new (message); label = gtk_label_new (message);
@ -1546,12 +1532,13 @@ gimp_display_shell_close_warning_dialog (GimpDisplayShell *shell,
g_free (name); g_free (name);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_label_set_attributes (GTK_LABEL (label), attrs); gimp_label_set_attributes (GTK_LABEL (label),
PANGO_ATTR_SCALE, PANGO_SCALE_LARGE,
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
-1);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label); gtk_widget_show (label);
pango_attr_list_unref (attrs);
label = gtk_label_new (_("Unsaved changes will be lost.")); label = gtk_label_new (_("Unsaved changes will be lost."));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);

View File

@ -950,8 +950,6 @@ prefs_dialog_new (Gimp *gimp,
GtkWidget *image; GtkWidget *image;
GtkWidget *sizeentry; GtkWidget *sizeentry;
GtkWidget *calibrate_button; GtkWidget *calibrate_button;
PangoAttrList *attrs;
PangoAttribute *attr;
GSList *group; GSList *group;
GtkWidget *editor; GtkWidget *editor;
gint i; gint i;
@ -1040,24 +1038,13 @@ prefs_dialog_new (Gimp *gimp,
label = gtk_label_new (NULL); label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gimp_label_set_attributes (GTK_LABEL (label),
PANGO_ATTR_SCALE, PANGO_SCALE_LARGE,
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
-1);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 6); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 6);
gtk_widget_show (label); gtk_widget_show (label);
attrs = pango_attr_list_new ();
attr = pango_attr_scale_new (PANGO_SCALE_LARGE);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
gtk_label_set_attributes (GTK_LABEL (label), attrs);
pango_attr_list_unref (attrs);
image = gtk_image_new (); image = gtk_image_new ();
gtk_box_pack_end (GTK_BOX (hbox), image, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_widget_show (image); gtk_widget_show (image);

View File

@ -49,15 +49,13 @@ void
resolution_calibrate_dialog (GtkWidget *resolution_entry, resolution_calibrate_dialog (GtkWidget *resolution_entry,
GdkPixbuf *pixbuf) GdkPixbuf *pixbuf)
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *table; GtkWidget *table;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *ruler; GtkWidget *ruler;
GtkWidget *label; GtkWidget *label;
GdkScreen *screen; GdkScreen *screen;
PangoAttrList *attrs;
PangoAttribute *attr;
g_return_if_fail (GIMP_IS_SIZE_ENTRY (resolution_entry)); g_return_if_fail (GIMP_IS_SIZE_ENTRY (resolution_entry));
g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf)); g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
@ -122,24 +120,13 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
gtk_label_new (_("Measure the rulers and enter their lengths:")); gtk_label_new (_("Measure the rulers and enter their lengths:"));
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gimp_label_set_attributes (GTK_LABEL (label),
PANGO_ATTR_SCALE, PANGO_SCALE_LARGE,
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
-1);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label); gtk_widget_show (label);
attrs = pango_attr_list_new ();
attr = pango_attr_scale_new (PANGO_SCALE_LARGE);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
gtk_label_set_attributes (GTK_LABEL (label), attrs);
pango_attr_list_unref (attrs);
hbox = gtk_hbox_new (FALSE, 0); hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox); gtk_widget_show (hbox);

View File

@ -204,6 +204,9 @@ gimp_container_grid_view_init (GimpContainerGridView *grid_view)
grid_view->name_label = gtk_label_new (_("(None)")); grid_view->name_label = gtk_label_new (_("(None)"));
gtk_misc_set_alignment (GTK_MISC (grid_view->name_label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (grid_view->name_label), 0.0, 0.5);
gimp_label_set_attributes (GTK_LABEL (grid_view->name_label),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_box_pack_start (GTK_BOX (grid_view), grid_view->name_label, gtk_box_pack_start (GTK_BOX (grid_view), grid_view->name_label,
FALSE, FALSE, 0); FALSE, FALSE, 0);
gtk_box_reorder_child (GTK_BOX (grid_view), grid_view->name_label, 0); gtk_box_reorder_child (GTK_BOX (grid_view), grid_view->name_label, 0);

View File

@ -140,6 +140,9 @@ gimp_histogram_editor_init (GimpHistogramEditor *editor)
editor->name = label = gtk_label_new (_("(None)")); editor->name = label = gtk_label_new (_("(None)"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gimp_label_set_attributes (GTK_LABEL (editor->name),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_box_pack_start (GTK_BOX (editor), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (editor), label, FALSE, FALSE, 0);
gtk_widget_show (label); gtk_widget_show (label);

View File

@ -163,29 +163,13 @@ gimp_viewable_dialog_init (GimpViewableDialog *dialog)
dialog->desc_label = gtk_label_new (NULL); dialog->desc_label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (dialog->desc_label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (dialog->desc_label), 0.0, 0.5);
gimp_label_set_attributes (GTK_LABEL (dialog->desc_label),
PANGO_ATTR_SCALE, PANGO_SCALE_LARGE,
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
-1);
gtk_box_pack_start (GTK_BOX (vbox), dialog->desc_label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), dialog->desc_label, FALSE, FALSE, 0);
gtk_widget_show (dialog->desc_label); gtk_widget_show (dialog->desc_label);
{
PangoAttrList *attrs;
PangoAttribute *attr;
attrs = pango_attr_list_new ();
attr = pango_attr_scale_new (PANGO_SCALE_LARGE);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
gtk_label_set_attributes (GTK_LABEL (dialog->desc_label), attrs);
pango_attr_list_unref (attrs);
}
dialog->viewable_label = gtk_label_new (NULL); dialog->viewable_label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (dialog->viewable_label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (dialog->viewable_label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox), dialog->viewable_label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), dialog->viewable_label, FALSE, FALSE, 0);

View File

@ -77,16 +77,14 @@ gimp_message_box (const gchar *stock_id,
GtkCallback callback, GtkCallback callback,
gpointer data) gpointer data)
{ {
MessageBox *msg_box; MessageBox *msg_box;
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *image; GtkWidget *image;
GtkWidget *label; GtkWidget *label;
GList *list; GList *list;
PangoAttrList *attrs; gchar *str;
PangoAttribute *attr;
gchar *str;
g_return_if_fail (stock_id != NULL); g_return_if_fail (stock_id != NULL);
g_return_if_fail (message != NULL); g_return_if_fail (message != NULL);
@ -120,22 +118,15 @@ gimp_message_box (const gchar *stock_id,
{ {
GtkWidget *label; GtkWidget *label;
attrs = pango_attr_list_new ();
attr = pango_attr_style_new (PANGO_STYLE_OBLIQUE);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
label = gtk_label_new (_("Message repeated once.")); label = gtk_label_new (_("Message repeated once."));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_label_set_attributes (GTK_LABEL (label), attrs); gimp_label_set_attributes (GTK_LABEL (label),
PANGO_ATTR_STYLE, PANGO_STYLE_OBLIQUE,
-1);
gtk_box_pack_end (GTK_BOX (msg_box->vbox), label, gtk_box_pack_end (GTK_BOX (msg_box->vbox), label,
FALSE, FALSE, 0); FALSE, FALSE, 0);
gtk_widget_show (label); gtk_widget_show (label);
pango_attr_list_unref (attrs);
msg_box->repeat_label = label; msg_box->repeat_label = label;
} }
@ -184,29 +175,18 @@ gimp_message_box (const gchar *stock_id,
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
gtk_widget_show (vbox); gtk_widget_show (vbox);
attrs = pango_attr_list_new ();
attr = pango_attr_scale_new (PANGO_SCALE_LARGE);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
str = g_strdup_printf (_("%s Message"), domain); str = g_strdup_printf (_("%s Message"), domain);
label = gtk_label_new (str); label = gtk_label_new (str);
g_free (str); g_free (str);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_label_set_attributes (GTK_LABEL (label), attrs); gimp_label_set_attributes (GTK_LABEL (label),
PANGO_ATTR_SCALE, PANGO_SCALE_LARGE,
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
-1);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label); gtk_widget_show (label);
pango_attr_list_unref (attrs);
label = gtk_label_new (message); label = gtk_label_new (message);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);

View File

@ -1,3 +1,9 @@
2004-06-21 Sven Neumann <sven@gimp.org>
* libgimpwidgets/libgimpwidgets-sections.txt
* libgimpwidgets/tmpl/gimpwidgets.sgml:
added gimp_label_set_attributes().
2004-06-02 Michael Natterer <mitch@gimp.org> 2004-06-02 Michael Natterer <mitch@gimp.org>
* libgimp/libgimp-sections.txt: follow function renaming. * libgimp/libgimp-sections.txt: follow function renaming.

View File

@ -585,6 +585,7 @@ gimp_float_adjustment_update
gimp_double_adjustment_update gimp_double_adjustment_update
gimp_unit_menu_update gimp_unit_menu_update
gimp_table_attach_aligned gimp_table_attach_aligned
gimp_label_set_attributes
</SECTION> </SECTION>
<SECTION> <SECTION>

View File

@ -355,3 +355,12 @@ Returns the #GimpChainButton which is attached to the #GimpSizeEntry.
@Returns: @Returns:
<!-- ##### FUNCTION gimp_label_set_attributes ##### -->
<para>
</para>
@label:
@Varargs:

View File

@ -1406,3 +1406,134 @@ gimp_table_attach_aligned (GtkTable *table,
return label; return label;
} }
/**
* gimp_label_set_attributes:
* @label: a #GtkLabel
* @...: a list of PangoAttrType and value pairs terminated by -1.
*
* Sets Pango attributes on a #GtkLabel in a more convenient way than
* gtk_label_set_attributes().
*
* This function is useful if you want to change the font attributes
* of a #GtkLabel. This is an alternative to using PangoMarkup which
* is slow to parse and akward to handle in an i18n-friendly way.
*
* The attributes are set on the complete label, from start to end. If
* you need to set attributes on part of the label, you will have to
* use the PangoAttributes API directly.
*
* Since: GIMP 2.2
**/
void
gimp_label_set_attributes (GtkLabel *label,
...)
{
PangoAttribute *attr = NULL;
PangoAttrList *attrs;
va_list args;
g_return_if_fail (GTK_IS_LABEL (label));
attrs = pango_attr_list_new ();
va_start (args, label);
do
{
PangoAttrType attr_type = va_arg (args, PangoAttrType);
switch (attr_type)
{
case PANGO_ATTR_LANGUAGE:
attr = pango_attr_language_new (va_arg (args, PangoLanguage *));
break;
case PANGO_ATTR_FAMILY:
attr = pango_attr_family_new (va_arg (args, const gchar *));
break;
case PANGO_ATTR_STYLE:
attr = pango_attr_style_new (va_arg (args, PangoStyle));
break;
case PANGO_ATTR_WEIGHT:
attr = pango_attr_weight_new (va_arg (args, PangoWeight));
break;
case PANGO_ATTR_VARIANT:
attr = pango_attr_variant_new (va_arg (args, PangoVariant));
break;
case PANGO_ATTR_STRETCH:
attr = pango_attr_stretch_new (va_arg (args, PangoStretch));
break;
case PANGO_ATTR_SIZE:
attr = pango_attr_stretch_new (va_arg (args, gint));
break;
case PANGO_ATTR_FONT_DESC:
attr = pango_attr_font_desc_new (va_arg (args,
const PangoFontDescription *));
break;
case PANGO_ATTR_FOREGROUND:
{
const PangoColor *color = va_arg (args, const PangoColor *);
attr = pango_attr_foreground_new (color->red,
color->green,
color->blue);
}
break;
case PANGO_ATTR_BACKGROUND:
{
const PangoColor *color = va_arg (args, const PangoColor *);
attr = pango_attr_background_new (color->red,
color->green,
color->blue);
}
break;
case PANGO_ATTR_UNDERLINE:
attr = pango_attr_underline_new (va_arg (args, PangoUnderline));
break;
case PANGO_ATTR_STRIKETHROUGH:
attr = pango_attr_underline_new (va_arg (args, gboolean));
break;
case PANGO_ATTR_RISE:
attr = pango_attr_rise_new (va_arg (args, gint));
break;
case PANGO_ATTR_SCALE:
attr = pango_attr_scale_new (va_arg (args, gdouble));
break;
default:
g_warning ("%s: invalid PangoAttribute type %d",
G_STRFUNC, attr_type);
case -1:
case PANGO_ATTR_INVALID:
attr = NULL;
break;
}
if (attr)
{
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
}
}
while (attr);
va_end (args);
gtk_label_set_attributes (label, attrs);
pango_attr_list_unref (attrs);
}

View File

@ -112,6 +112,7 @@ EXPORTS
gimp_int_store_get_type gimp_int_store_get_type
gimp_int_store_lookup_by_value gimp_int_store_lookup_by_value
gimp_int_store_new gimp_int_store_new
gimp_label_set_attributes
gimp_memsize_entry_get_type gimp_memsize_entry_get_type
gimp_memsize_entry_get_value gimp_memsize_entry_get_value
gimp_memsize_entry_new gimp_memsize_entry_new

View File

@ -267,6 +267,10 @@ GtkWidget * gimp_table_attach_aligned (GtkTable *table,
gboolean left_align); gboolean left_align);
void gimp_label_set_attributes (GtkLabel *label,
...);
G_END_DECLS G_END_DECLS
#endif /* __GIMP_WIDGETS_H__ */ #endif /* __GIMP_WIDGETS_H__ */

View File

@ -1720,6 +1720,9 @@ save_dialog (void)
preview_size = gtk_label_new (_("File size: unknown")); preview_size = gtk_label_new (_("File size: unknown"));
gtk_misc_set_alignment (GTK_MISC (preview_size), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (preview_size), 0.0, 0.5);
gimp_label_set_attributes (GTK_LABEL (preview_size),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_box_pack_start (GTK_BOX (vbox), preview_size, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), preview_size, FALSE, FALSE, 0);
gtk_widget_show (preview_size); gtk_widget_show (preview_size);

View File

@ -1720,6 +1720,9 @@ save_dialog (void)
preview_size = gtk_label_new (_("File size: unknown")); preview_size = gtk_label_new (_("File size: unknown"));
gtk_misc_set_alignment (GTK_MISC (preview_size), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (preview_size), 0.0, 0.5);
gimp_label_set_attributes (GTK_LABEL (preview_size),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_box_pack_start (GTK_BOX (vbox), preview_size, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), preview_size, FALSE, FALSE, 0);
gtk_widget_show (preview_size); gtk_widget_show (preview_size);

View File

@ -1720,6 +1720,9 @@ save_dialog (void)
preview_size = gtk_label_new (_("File size: unknown")); preview_size = gtk_label_new (_("File size: unknown"));
gtk_misc_set_alignment (GTK_MISC (preview_size), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (preview_size), 0.0, 0.5);
gimp_label_set_attributes (GTK_LABEL (preview_size),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_box_pack_start (GTK_BOX (vbox), preview_size, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), preview_size, FALSE, FALSE, 0);
gtk_widget_show (preview_size); gtk_widget_show (preview_size);

View File

@ -1720,6 +1720,9 @@ save_dialog (void)
preview_size = gtk_label_new (_("File size: unknown")); preview_size = gtk_label_new (_("File size: unknown"));
gtk_misc_set_alignment (GTK_MISC (preview_size), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (preview_size), 0.0, 0.5);
gimp_label_set_attributes (GTK_LABEL (preview_size),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_box_pack_start (GTK_BOX (vbox), preview_size, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), preview_size, FALSE, FALSE, 0);
gtk_widget_show (preview_size); gtk_widget_show (preview_size);

View File

@ -1720,6 +1720,9 @@ save_dialog (void)
preview_size = gtk_label_new (_("File size: unknown")); preview_size = gtk_label_new (_("File size: unknown"));
gtk_misc_set_alignment (GTK_MISC (preview_size), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (preview_size), 0.0, 0.5);
gimp_label_set_attributes (GTK_LABEL (preview_size),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_box_pack_start (GTK_BOX (vbox), preview_size, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), preview_size, FALSE, FALSE, 0);
gtk_widget_show (preview_size); gtk_widget_show (preview_size);

View File

@ -1720,6 +1720,9 @@ save_dialog (void)
preview_size = gtk_label_new (_("File size: unknown")); preview_size = gtk_label_new (_("File size: unknown"));
gtk_misc_set_alignment (GTK_MISC (preview_size), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (preview_size), 0.0, 0.5);
gimp_label_set_attributes (GTK_LABEL (preview_size),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_box_pack_start (GTK_BOX (vbox), preview_size, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), preview_size, FALSE, FALSE, 0);
gtk_widget_show (preview_size); gtk_widget_show (preview_size);

View File

@ -1720,6 +1720,9 @@ save_dialog (void)
preview_size = gtk_label_new (_("File size: unknown")); preview_size = gtk_label_new (_("File size: unknown"));
gtk_misc_set_alignment (GTK_MISC (preview_size), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (preview_size), 0.0, 0.5);
gimp_label_set_attributes (GTK_LABEL (preview_size),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_box_pack_start (GTK_BOX (vbox), preview_size, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), preview_size, FALSE, FALSE, 0);
gtk_widget_show (preview_size); gtk_widget_show (preview_size);