summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2010-12-14 17:56:52 +0000
committerBastien Nocera <hadess@hadess.net>2010-12-14 18:27:11 +0000
commit39f452afee8e127cf38fa419332aff7f4130043c (patch)
tree0d1a9acf68416f58479967faa3511c32f11530e8
parent855b7830d33f300c7ae125723b0530640147ab3b (diff)
background: Follow mockups
Add icon to represent slideshows, always show a name for the currently set background on startup, show whether a background is a slideshow, and its pixel size if available.
-rw-r--r--panels/background/Makefile.am2
-rw-r--r--panels/background/background.ui54
-rw-r--r--panels/background/bg-wallpapers-source.c2
-rw-r--r--panels/background/cc-background-panel.c15
-rw-r--r--panels/background/gnome-wp-item.c68
-rw-r--r--panels/background/gnome-wp-item.h4
-rw-r--r--panels/background/gnome-wp-xml.c2
7 files changed, 79 insertions, 68 deletions
diff --git a/panels/background/Makefile.am b/panels/background/Makefile.am
index 6d8278440..c9c1f2f2b 100644
--- a/panels/background/Makefile.am
+++ b/panels/background/Makefile.am
@@ -7,6 +7,8 @@ dist_ui_DATA = \
display-base.png \
display-overlay.png
+slideshowicondir = $(datadir)/icons/hicolor/scalable/emblems/
+slideshowicon_DATA = slideshow-emblem-symbolic.svg
INCLUDES = \
$(PANEL_CFLAGS) \
diff --git a/panels/background/background.ui b/panels/background/background.ui
index b9d9ae98e..0913db301 100644
--- a/panels/background/background.ui
+++ b/panels/background/background.ui
@@ -88,24 +88,54 @@
<child>
<object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
- <object class="GtkDrawingArea" id="preview-area">
+ <object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
+ <property name="spacing">24</property>
+ <child>
+ <object class="GtkLabel" id="background-label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label">&lt;b&gt;Current background&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="size_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label">1280x700px</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
+ <property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
+ <object class="GtkDrawingArea" id="preview-area">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkHBox" id="bottom-hbox">
<property name="visible">True</property>
- <property name="orientation">horizontal</property>
<child>
- <object class="GtkLabel" id="background-label">
+ <object class="GtkImage" id="slide_image">
<property name="visible">True</property>
- <property name="xalign">0</property>
+ <property name="icon_name">slideshow-emblem-symbolic</property>
</object>
<packing>
<property name="expand">False</property>
@@ -113,10 +143,20 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="slide-label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes" comments="This refers to a slideshow background">Changes throughout the day</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkHBox" id="edit-hbox">
<property name="visible">True</property>
<property name="spacing">12</property>
- <property name="orientation">horizontal</property>
<child>
<object class="GtkColorButton" id="style-color">
<property name="visible">True</property>
@@ -156,7 +196,7 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
diff --git a/panels/background/bg-wallpapers-source.c b/panels/background/bg-wallpapers-source.c
index 4a2a75649..035bf1c32 100644
--- a/panels/background/bg-wallpapers-source.c
+++ b/panels/background/bg-wallpapers-source.c
@@ -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_description (item);
+ gnome_wp_item_update_size (item);
gtk_list_store_set (store, &iter,
0, pixbuf,
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index ffe9c7d1b..195a40ef1 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -315,6 +315,7 @@ update_preview (CcBackgroundPanelPrivate *priv,
gboolean redraw_preview)
{
gchar *markup;
+ gboolean changes_with_time;
if (item && priv->current_background)
{
@@ -336,6 +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);
}
@@ -344,19 +346,29 @@ update_preview (CcBackgroundPanelPrivate *priv,
else
gtk_widget_hide (WID ("edit-hbox"));
+ changes_with_time = FALSE;
+
if (priv->current_background)
{
markup = g_strdup_printf ("<b>%s</b>", priv->current_background->name);
gtk_label_set_markup (GTK_LABEL (WID ("background-label")), markup);
g_free (markup);
+ gtk_label_set_text (GTK_LABEL (WID ("size_label")), priv->current_background->size);
+
gtk_color_button_set_color (GTK_COLOR_BUTTON (WID ("style-color")),
priv->current_background->pcolor);
select_style (GTK_COMBO_BOX (WID ("style-combobox")),
priv->current_background->options);
+
+ if (priv->current_background->bg)
+ changes_with_time = gnome_bg_changes_with_time (priv->current_background->bg);
}
+ gtk_widget_set_visible (WID ("slide_image"), changes_with_time);
+ gtk_widget_set_visible (WID ("slide-label"), changes_with_time);
+
if (redraw_preview)
gtk_widget_queue_draw (WID ("preview-area"));
}
@@ -734,10 +746,11 @@ cc_background_panel_init (CcBackgroundPanel *self)
priv->current_background = g_new0 (GnomeWPItem, 1);
priv->current_background->filename = filename;
- priv->current_background->name = g_strdup ("");
+ priv->current_background->name = g_strdup (_("Current background"));
gnome_wp_item_update (priv->current_background);
gnome_wp_item_ensure_gnome_bg (priv->current_background);
+ gnome_wp_item_update_size (priv->current_background);
update_preview (priv, NULL, TRUE);
}
diff --git a/panels/background/gnome-wp-item.c b/panels/background/gnome-wp-item.c
index e2ad20b45..4939fa351 100644
--- a/panels/background/gnome-wp-item.c
+++ b/panels/background/gnome-wp-item.c
@@ -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_description (item);
+ gnome_wp_item_update_size (item);
if (wallpapers)
g_hash_table_insert (wallpapers, item->filename, item);
@@ -192,7 +192,7 @@ void gnome_wp_item_free (GnomeWPItem * item) {
g_free (item->name);
g_free (item->filename);
- g_free (item->description);
+ g_free (item->size);
if (item->pcolor != NULL)
gdk_color_free (item->pcolor);
@@ -275,67 +275,23 @@ 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_description (GnomeWPItem * item) {
- g_free (item->description);
+void gnome_wp_item_update_size (GnomeWPItem * item) {
+ g_free (item->size);
if (!strcmp (item->filename, "(none)")) {
- item->description = g_strdup (item->name);
+ item->size = g_strdup (item->name);
} else {
- gchar *description;
- gchar *size;
- gchar *dirname = g_path_get_dirname (item->filename);
-
- description = NULL;
- size = NULL;
-
- if (strcmp (item->fileinfo->mime_type, "application/xml") == 0)
- {
- if (gnome_bg_changes_with_time (item->bg))
- description = g_strdup (_("Slide Show"));
- else if (item->width > 0 && item->height > 0)
- description = g_strdup (_("Image"));
- }
- else
- description = g_content_type_get_description (item->fileinfo->mime_type);
-
if (gnome_bg_has_multiple_sizes (item->bg))
- size = g_strdup (_("multiple sizes"));
+ item->size = g_strdup (_("multiple sizes"));
else if (item->width > 0 && item->height > 0) {
/* translators: x pixel(s) by y pixel(s) */
- size = g_strdup_printf (_("%d %s by %d %s"),
- item->width,
- ngettext ("pixel", "pixels", item->width),
- item->height,
- ngettext ("pixel", "pixels", item->height));
- }
-
- if (description && size) {
- /* translators: <b>wallpaper name</b>
- * mime type, size
- * Folder: /path/to/file
- */
- item->description = g_markup_printf_escaped (_("<b>%s</b>\n"
- "%s, %s\n"
- "Folder: %s"),
- item->name,
- description,
- size,
- dirname);
+ item->size = g_strdup_printf (_("%d %s by %d %s"),
+ item->width,
+ ngettext ("pixel", "pixels", item->width),
+ item->height,
+ ngettext ("pixel", "pixels", item->height));
} else {
- /* translators: <b>wallpaper name</b>
- * Image missing
- * Folder: /path/to/file
- */
- item->description = g_markup_printf_escaped (_("<b>%s</b>\n"
- "%s\n"
- "Folder: %s"),
- item->name,
- _("Image missing"),
- dirname);
+ item->size = g_strdup ("");
}
-
- g_free (size);
- g_free (dirname);
- g_free (description);
}
}
diff --git a/panels/background/gnome-wp-item.h b/panels/background/gnome-wp-item.h
index 33232f63c..94820f465 100644
--- a/panels/background/gnome-wp-item.h
+++ b/panels/background/gnome-wp-item.h
@@ -44,7 +44,7 @@ struct _GnomeWPItem {
gchar * name;
gchar * filename;
- gchar * description;
+ gchar * size;
GDesktopBackgroundStyle options;
GDesktopBackgroundShading shade_type;
@@ -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_description (GnomeWPItem *item);
+void gnome_wp_item_update_size (GnomeWPItem *item);
void gnome_wp_item_ensure_gnome_bg (GnomeWPItem *item);
const gchar *wp_item_option_to_string (GDesktopBackgroundStyle type);
diff --git a/panels/background/gnome-wp-xml.c b/panels/background/gnome-wp-xml.c
index b5e3c4a73..fef729a9b 100644
--- a/panels/background/gnome-wp-xml.c
+++ b/panels/background/gnome-wp-xml.c
@@ -231,7 +231,7 @@ static void gnome_wp_xml_load_xml (GnomeWpXml *data,
}
gnome_wp_item_ensure_gnome_bg (wp);
- gnome_wp_item_update_description (wp);
+ gnome_wp_item_update_size (wp);
g_hash_table_insert (data->wp_hash, wp->filename, wp);
} else {
gnome_wp_item_free (wp);