Check for the scale type being zoom in the config, to set the option menu

2006-01-14  Alan Swanson <swanson@ukfsn.org>

	* gnome-wp-capplet.c (gnome_wp_option_menu_set): Check for the scale
	type being zoom in the config, to set the option menu
	(gnome_wp_scale_type_changed): Update the options for zoom type
	(gnome_wp_icon_theme_changed): Update the zoom icon in the menu
	(wallpaper_properties_init): Add an item for Zoom to the scaling menu

	* gnome-wp-capplet.h (_GnomeWPCapplet): Add a widget for the zoom item
	(GnomeWPScaleType): Add an enumeration for the zoom type

	* gnome-wp-item.c (gnome_wp_item_get_thumbnail): Add the code to
	generate a proper thumbnail for the new zoom option

	Fixes #105231
This commit is contained in:
Alan Swanson 2006-01-14 16:10:24 +00:00 committed by Rodney Dawes
parent 0f56daf38d
commit 9c27b0926f
4 changed files with 70 additions and 2 deletions

View file

@ -1,6 +1,22 @@
2006-01-14 Alan Swanson <swanson@ukfsn.org>
* gnome-wp-capplet.c (gnome_wp_option_menu_set): Check for the scale
type being zoom in the config, to set the option menu
(gnome_wp_scale_type_changed): Update the options for zoom type
(gnome_wp_icon_theme_changed): Update the zoom icon in the menu
(wallpaper_properties_init): Add an item for Zoom to the scaling menu
* gnome-wp-capplet.h (_GnomeWPCapplet): Add a widget for the zoom item
(GnomeWPScaleType): Add an enumeration for the zoom type
* gnome-wp-item.c (gnome_wp_item_get_thumbnail): Add the code to
generate a proper thumbnail for the new zoom option
Fixes #105231
2005-10-05 Dennis Cranston <dennis_cranston@yahoo.com>
* gnome-wp-capplet.c: (wallpaper_properties_init): Add an image
* gnome-wp-capplet.c (wallpaper_properties_init): Add an image
filter to the file chooser.
2005-10-01 Rodney Dawes <dobey@novell.com>

View file

@ -259,6 +259,9 @@ static void gnome_wp_option_menu_set (GnomeWPCapplet * capplet,
} else if (!strcmp (value, "scaled")) {
gtk_option_menu_set_history (GTK_OPTION_MENU (capplet->wp_opts),
GNOME_WP_SCALE_TYPE_SCALED);
} else if (!strcmp (value, "zoom")) {
gtk_option_menu_set_history (GTK_OPTION_MENU (capplet->wp_opts),
GNOME_WP_SCALE_TYPE_ZOOM);
} else if (strcmp (value, "none") != 0) {
gtk_option_menu_set_history (GTK_OPTION_MENU (capplet->wp_opts),
GNOME_WP_SCALE_TYPE_TILED);
@ -423,6 +426,9 @@ static void gnome_wp_scale_type_changed (GtkOptionMenu * option_menu,
case GNOME_WP_SCALE_TYPE_SCALED:
item->options = g_strdup ("scaled");
break;
case GNOME_WP_SCALE_TYPE_ZOOM:
item->options = g_strdup ("zoom");
break;
case GNOME_WP_SCALE_TYPE_TILED:
item->options = g_strdup ("wallpaper");
break;
@ -850,6 +856,16 @@ static void gnome_wp_icon_theme_changed (GtkIconTheme * theme,
g_object_unref (pixbuf);
}
icon_info = gtk_icon_theme_lookup_icon (capplet->theme,
"stock_wallpaper-zoom",
16, 0);
if (icon_info != NULL) {
pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
gtk_icon_info_free (icon_info);
gtk_image_set_from_pixbuf (GTK_IMAGE (capplet->zitem), pixbuf);
g_object_unref (pixbuf);
}
icon_info = gtk_icon_theme_lookup_icon (capplet->theme,
"stock_wallpaper-tile",
16, 0);
@ -1132,6 +1148,31 @@ static void wallpaper_properties_init (poptContext ctx) {
gtk_menu_append (GTK_MENU (menu), mitem);
gtk_widget_show (mitem);
mitem = gtk_menu_item_new ();
set_accessible_name (mitem, _("Zoom"));
icon_info = gtk_icon_theme_lookup_icon (capplet->theme,
"stock_wallpaper-zoom",
16, 0);
mbox = gtk_hbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER (mitem), mbox);
gtk_widget_show (mbox);
if (icon_info != NULL) {
pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
gtk_icon_info_free (icon_info);
capplet->zitem = gtk_image_new_from_pixbuf (pixbuf);
gtk_box_pack_start (GTK_BOX (mbox), capplet->zitem, FALSE, FALSE, 0);
gtk_widget_show (capplet->zitem);
g_object_unref (pixbuf);
}
label = gtk_label_new (_("Zoom"));
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_box_pack_start (GTK_BOX (mbox), label, TRUE, TRUE, 0);
gtk_widget_show (label);
gtk_menu_append (GTK_MENU (menu), mitem);
gtk_widget_show (mitem);
mitem = gtk_menu_item_new ();
set_accessible_name (mitem, _("Tiled"));
icon_info = gtk_icon_theme_lookup_icon (capplet->theme,

View file

@ -53,10 +53,11 @@ struct _GnomeWPCapplet {
GtkWidget * wp_opts;
GtkWidget * rm_button;
/* Menu Items for Fill/Scale/Center/Tile Options */
/* Menu Items for Fill/Scale/Center/Zoom/Tile Options */
GtkWidget * fitem;
GtkWidget * sitem;
GtkWidget * citem;
GtkWidget * zitem;
GtkWidget * witem;
/* Widgets for Color Options */
@ -100,6 +101,7 @@ typedef enum {
GNOME_WP_SCALE_TYPE_CENTERED,
GNOME_WP_SCALE_TYPE_STRETCHED,
GNOME_WP_SCALE_TYPE_SCALED,
GNOME_WP_SCALE_TYPE_ZOOM,
GNOME_WP_SCALE_TYPE_TILED
} GnomeWPScaleType;

View file

@ -274,6 +274,15 @@ GdkPixbuf * gnome_wp_item_get_thumbnail (GnomeWPItem * item,
tw = bw;
}
scaled = gnome_wp_pixbuf_center (pixbuf, bgpixbuf, tw, th);
} else if (!strcmp (item->options, "zoom")) {
if ((gdouble) ph * (gdouble) bw < (gdouble) pw * (gdouble) bh) {
tw = 0.5 + (gdouble) pw * (gdouble) bh / (gdouble) ph;
th = bh;
} else {
th = 0.5 + (gdouble) ph * (gdouble) bw / (gdouble) pw;
tw = bw;
}
scaled = gnome_wp_pixbuf_center (pixbuf, bgpixbuf, tw, th);
}
}