[gnome-control-center] background: Follow mockups
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] background: Follow mockups
- Date: Tue, 14 Dec 2010 18:28:03 +0000 (UTC)
commit 39f452afee8e127cf38fa419332aff7f4130043c
Author: Bastien Nocera <hadess hadess net>
Date: Tue Dec 14 17:56:52 2010 +0000
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.
panels/background/Makefile.am | 2 +
panels/background/background.ui | 54 ++++++++++++++++++++---
panels/background/bg-wallpapers-source.c | 2 +-
panels/background/cc-background-panel.c | 15 ++++++-
panels/background/gnome-wp-item.c | 68 +++++------------------------
panels/background/gnome-wp-item.h | 4 +-
panels/background/gnome-wp-xml.c | 2 +-
7 files changed, 79 insertions(+), 68 deletions(-)
---
diff --git a/panels/background/Makefile.am b/panels/background/Makefile.am
index 6d82784..c9c1f2f 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 b9d9ae9..0913db3 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"><b>Current background</b></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 4a2a756..035bf1c 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 ffe9c7d..195a40e 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 e2ad20b..4939fa3 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 33232f6..94820f4 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 b5e3c4a..fef729a 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]