background: Show wallpaper size on startup

When available. Remove the "px" from the size label.
This commit is contained in:
Bastien Nocera 2010-12-14 19:24:19 +00:00
parent 933dee47f0
commit f48054ccf1
5 changed files with 22 additions and 15 deletions

View file

@ -179,7 +179,7 @@ load_wallpapers (gchar *key,
pixbuf = gnome_wp_item_get_thumbnail (item, priv->thumb_factory,
THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT);
gnome_wp_item_update_size (item);
gnome_wp_item_update_size (item, NULL);
gtk_list_store_set (store, &iter,
0, pixbuf,

View file

@ -337,7 +337,7 @@ update_preview (CcBackgroundPanelPrivate *priv,
priv->current_background->shade_type = item->shade_type;
gnome_wp_item_ensure_gnome_bg (priv->current_background);
gnome_wp_item_update_size (priv->current_background);
gnome_wp_item_update_size (priv->current_background, priv->thumb_factory);
}
@ -750,7 +750,7 @@ cc_background_panel_init (CcBackgroundPanel *self)
gnome_wp_item_update (priv->current_background);
gnome_wp_item_ensure_gnome_bg (priv->current_background);
gnome_wp_item_update_size (priv->current_background);
gnome_wp_item_update_size (priv->current_background, priv->thumb_factory);
update_preview (priv, NULL, TRUE);
}

View file

@ -173,7 +173,7 @@ GnomeWPItem * gnome_wp_item_new (const gchar * filename,
gnome_wp_item_update (item);
gnome_wp_item_ensure_gnome_bg (item);
gnome_wp_item_update_size (item);
gnome_wp_item_update_size (item, NULL);
if (wallpapers)
g_hash_table_insert (wallpapers, item->filename, item);
@ -275,22 +275,29 @@ GdkPixbuf * gnome_wp_item_get_thumbnail (GnomeWPItem * item,
return gnome_wp_item_get_frame_thumbnail (item, thumbs, width, height, -1);
}
void gnome_wp_item_update_size (GnomeWPItem * item) {
void gnome_wp_item_update_size (GnomeWPItem * item,
GnomeDesktopThumbnailFactory * thumbs) {
g_free (item->size);
item->size = NULL;
if (!strcmp (item->filename, "(none)")) {
item->size = g_strdup (item->name);
} else {
if (gnome_bg_has_multiple_sizes (item->bg))
item->size = g_strdup (_("multiple sizes"));
else if (item->width > 0 && item->height > 0) {
/* translators: 100 × 100px
* Note that this is not an "x", but U+00D7 MULTIPLICATION SIGN */
item->size = g_strdup_printf (_("%d \303\227 %dpx"),
item->width,
item->height);
} else {
item->size = g_strdup ("");
else {
if (thumbs != NULL && (item->width <= 0 || item->height <= 0)) {
gnome_bg_get_image_size (item->bg, thumbs, 1, 1, &item->width, &item->height);
}
if (item->width > 0 && item->height > 0) {
/* translators: 100 × 100px
* Note that this is not an "x", but U+00D7 MULTIPLICATION SIGN */
item->size = g_strdup_printf (_("%d \303\227 %d"),
item->width,
item->height);
} else {
item->size = g_strdup ("");
}
}
}
}

View file

@ -83,7 +83,7 @@ GdkPixbuf * gnome_wp_item_get_frame_thumbnail (GnomeWPItem *item,
gint height,
gint frame);
void gnome_wp_item_update (GnomeWPItem *item);
void gnome_wp_item_update_size (GnomeWPItem *item);
void gnome_wp_item_update_size (GnomeWPItem *item, GnomeDesktopThumbnailFactory *thumbs);
void gnome_wp_item_ensure_gnome_bg (GnomeWPItem *item);
const gchar *wp_item_option_to_string (GDesktopBackgroundStyle type);

View file

@ -231,7 +231,7 @@ static void gnome_wp_xml_load_xml (GnomeWpXml *data,
}
gnome_wp_item_ensure_gnome_bg (wp);
gnome_wp_item_update_size (wp);
gnome_wp_item_update_size (wp, NULL);
g_hash_table_insert (data->wp_hash, wp->filename, wp);
} else {
gnome_wp_item_free (wp);