ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #00041
[Merge] lp:~bratsche/xsplash/new-assets into lp:xsplash
Cody Russell has proposed merging lp:~bratsche/xsplash/new-assets into lp:xsplash.
--
https://code.launchpad.net/~bratsche/xsplash/new-assets/+merge/11006
Your team ayatana-commits is subscribed to branch lp:xsplash.
=== modified file 'images/Makefile.am'
--- images/Makefile.am 2009-08-20 11:07:58 +0000
+++ images/Makefile.am 2009-08-31 19:11:01 +0000
@@ -2,6 +2,20 @@
imagesdir = $(datadir)/images/xsplash
-images_DATA = xsplash-background.png xsplash-throbber.png
+images_DATA = bg_800x600.jpg \
+ bg_1024x768.jpg \
+ bg_1280x1024.jpg \
+ bg_1440x900.jpg \
+ bg_1680x1050.jpg \
+ bg_1920x1200.jpg \
+ bg_2560x1600.jpg \
+ logo_small.png \
+ logo_medium.png \
+ logo_large.png \
+ logo_xtra_large.png \
+ throbber_small.png \
+ throbber_medium.png \
+ throbber_large.png \
+ throbber_xtra-large.png
EXTRA_DIST = $(images_DATA)
=== added file 'images/bg_1024x768.jpg'
Binary files images/bg_1024x768.jpg 1970-01-01 00:00:00 +0000 and images/bg_1024x768.jpg 2009-08-31 18:47:10 +0000 differ
=== added file 'images/bg_1280x1024.jpg'
Binary files images/bg_1280x1024.jpg 1970-01-01 00:00:00 +0000 and images/bg_1280x1024.jpg 2009-08-31 18:47:10 +0000 differ
=== added file 'images/bg_1440x900.jpg'
Binary files images/bg_1440x900.jpg 1970-01-01 00:00:00 +0000 and images/bg_1440x900.jpg 2009-08-31 18:47:10 +0000 differ
=== added file 'images/bg_1680x1050.jpg'
Binary files images/bg_1680x1050.jpg 1970-01-01 00:00:00 +0000 and images/bg_1680x1050.jpg 2009-08-31 18:47:10 +0000 differ
=== added file 'images/bg_1920x1200.jpg'
Binary files images/bg_1920x1200.jpg 1970-01-01 00:00:00 +0000 and images/bg_1920x1200.jpg 2009-08-31 18:47:10 +0000 differ
=== added file 'images/bg_2560x1600.jpg'
Binary files images/bg_2560x1600.jpg 1970-01-01 00:00:00 +0000 and images/bg_2560x1600.jpg 2009-08-31 18:47:10 +0000 differ
=== added file 'images/bg_800x600.jpg'
Binary files images/bg_800x600.jpg 1970-01-01 00:00:00 +0000 and images/bg_800x600.jpg 2009-08-31 18:47:10 +0000 differ
=== added file 'images/logo_large.png'
Binary files images/logo_large.png 1970-01-01 00:00:00 +0000 and images/logo_large.png 2009-08-31 18:47:10 +0000 differ
=== added file 'images/logo_medium.png'
Binary files images/logo_medium.png 1970-01-01 00:00:00 +0000 and images/logo_medium.png 2009-08-31 18:47:10 +0000 differ
=== added file 'images/logo_small.png'
Binary files images/logo_small.png 1970-01-01 00:00:00 +0000 and images/logo_small.png 2009-08-31 18:47:10 +0000 differ
=== added file 'images/logo_xtra_large.png'
Binary files images/logo_xtra_large.png 1970-01-01 00:00:00 +0000 and images/logo_xtra_large.png 2009-08-31 18:47:10 +0000 differ
=== added file 'images/throbber_large.png'
Binary files images/throbber_large.png 1970-01-01 00:00:00 +0000 and images/throbber_large.png 2009-08-31 18:47:10 +0000 differ
=== added file 'images/throbber_medium.png'
Binary files images/throbber_medium.png 1970-01-01 00:00:00 +0000 and images/throbber_medium.png 2009-08-31 18:47:10 +0000 differ
=== added file 'images/throbber_small.png'
Binary files images/throbber_small.png 1970-01-01 00:00:00 +0000 and images/throbber_small.png 2009-08-31 18:47:10 +0000 differ
=== added file 'images/throbber_xtra-large.png'
Binary files images/throbber_xtra-large.png 1970-01-01 00:00:00 +0000 and images/throbber_xtra-large.png 2009-08-31 18:47:10 +0000 differ
=== removed file 'images/xsplash-background.png'
Binary files images/xsplash-background.png 2009-08-06 14:42:39 +0000 and images/xsplash-background.png 1970-01-01 00:00:00 +0000 differ
=== removed file 'images/xsplash-throbber.png'
Binary files images/xsplash-throbber.png 2009-08-19 00:44:34 +0000 and images/xsplash-throbber.png 1970-01-01 00:00:00 +0000 differ
=== modified file 'src/xsplash.c'
--- src/xsplash.c 2009-08-26 15:29:53 +0000
+++ src/xsplash.c 2009-09-01 17:22:54 +0000
@@ -267,6 +267,114 @@
return gdk_pixbuf_scale_simple (src, new_width, new_height, GDK_INTERP_BILINEAR);
}
+static gchar *
+get_background_filename (void)
+{
+ gint widths[] = { 2560, 1920, 1680, 1440, 1280, 1024, 800 };
+ gint heights[] = { 1600, 1200, 1050, 900, 1024, 768, 600 };
+ gint width, height;
+ gint i;
+ gint last_good = 0;
+ gchar *ret;
+ GdkScreen *screen;
+
+ screen = gdk_screen_get_default ();
+ width = gdk_screen_get_width (screen);
+ height = gdk_screen_get_height (screen);
+
+ g_debug ("get_background_filename(): looking for appropriate resolution...");
+ for (i = 0; i < (sizeof (widths) / sizeof (gint)); i++)
+ {
+ if (widths[i] > width && heights[i] && height)
+ {
+ g_debug (" ** %dx%d will work.", widths[i], heights[i]);
+ last_good = i;
+ }
+ else
+ {
+ g_debug (" ** %dx%d is too small, using last good size.\n", widths[i], heights[i]);
+ break;
+ }
+ }
+
+ g_debug (" ** Found a resolution: %dx%d", widths[last_good], heights[last_good]);
+
+ ret = g_strdup_printf (DATADIR "/images/xsplash/bg_%dx%d.jpg", widths[last_good], heights[last_good]);
+
+ g_debug (" ** filename: %s\n", ret);
+
+ return ret;
+}
+
+static const gchar *
+get_filename_size_modifier (gint width)
+{
+ if (width < 1280)
+ return "small";
+ else if (width < 1600)
+ return "medium";
+ else if (width < 2560)
+ return "large";
+ else
+ return "xtra_large";
+}
+
+static gchar *
+get_throbber_filename (void)
+{
+ gchar *ret;
+ GdkScreen *screen;
+ gint width;
+
+ screen = gdk_screen_get_default ();
+ width = gdk_screen_get_width (screen);
+
+ if (throbber_image != NULL)
+ {
+ g_debug ("get_throbber_filename(): user provided a throbber on the command line; using that\n");
+
+ return g_strdup (throbber_image);
+ }
+
+ g_debug ("get_throbber_filename(): looking for the best throbber for screen width...");
+
+ ret = g_strdup_printf (DATADIR "/images/xsplash/throbber_%s.png",
+ get_filename_size_modifier (width));
+
+ g_debug (" ** Chose `%s'", get_filename_size_modifier (width));
+ g_debug (" ** throbber filename is: %s\n", ret);
+
+ return ret;
+}
+
+static gchar *
+get_logo_filename ()
+{
+ gchar *ret;
+ GdkScreen *screen;
+ gint width;
+
+ screen = gdk_screen_get_default ();
+ width = gdk_screen_get_width (screen);
+
+ if (logo_image != NULL)
+ {
+ g_debug ("get_logo_filename(): user provided a logo on the command line; using that\n");
+
+ return g_strdup (logo_image);
+ }
+
+ g_debug ("get_logo_filename(): looking for the best logo for screen width...");
+
+ ret = g_strdup_printf (DATADIR "/images/xsplash/logo_%s.png",
+ get_filename_size_modifier (width));
+
+ g_debug (" ** Chose `%s'", get_filename_size_modifier (width));
+ g_debug (" ** logo filename is: %s\n", ret);
+
+ return ret;
+}
+
static GdkPixbuf *
get_pixbuf (gint width, gint height)
{
@@ -276,7 +384,8 @@
pixbuf = gdk_pixbuf_new_from_file (background_image, NULL);
scaled = scale_to_min (pixbuf,
- width, height);
+ width,
+ height);
w = gdk_pixbuf_get_width (scaled);
h = gdk_pixbuf_get_height (scaled);
@@ -325,6 +434,8 @@
GdkPixbuf *logo;
GtkWidget *image;
GtkWidget *fixed;
+ gchar *logo_filename;
+ gchar *throbber_filename;
priv->dbusobject = NULL;
priv->system_bus = NULL;
@@ -373,9 +484,13 @@
G_CALLBACK (key_press_event),
server);
+ logo_filename = get_logo_filename (gdk_screen_get_width (priv->screen));
+ throbber_filename = get_throbber_filename ();
+
pixbuf = get_pixbuf (gdk_screen_get_width (priv->screen),
gdk_screen_get_height (priv->screen));
- logo = gdk_pixbuf_new_from_file (logo_image, NULL);
+
+ logo = gdk_pixbuf_new_from_file (logo_filename, NULL);
fixed = gtk_fixed_new ();
@@ -387,9 +502,9 @@
gdk_pixbuf_get_width (pixbuf) / 2 - gdk_pixbuf_get_width (logo) / 2,
gdk_pixbuf_get_height (pixbuf) / 3 - gdk_pixbuf_get_height (logo) / 2);
- if (throbber_image && throbber_frames)
+ if (throbber_filename && throbber_frames)
{
- priv->throbber_pixbuf = gdk_pixbuf_new_from_file (throbber_image, NULL);
+ priv->throbber_pixbuf = gdk_pixbuf_new_from_file (throbber_filename, NULL);
if (priv->throbber_pixbuf != NULL)
{
@@ -411,6 +526,12 @@
gtk_container_add (GTK_CONTAINER (priv->window), fixed);
gtk_widget_show_all (priv->window);
+
+ if (logo_filename)
+ g_free (logo_filename);
+
+ if (throbber_filename)
+ g_free (throbber_filename);
}
static void
@@ -674,13 +795,13 @@
signal (SIGTERM, sig_handler);
if (background_image == NULL)
- background_image = g_strdup ("/usr/share/backgrounds/warty-final-ubuntu.png");
+ background_image = get_background_filename ();
if (logo_image == NULL)
- logo_image = g_strdup ("/usr/share/images/C/ubuntuheader.png");
+ logo_image = get_logo_filename ();
if (throbber_image == NULL)
- throbber_image = g_strdup (DATADIR "/images/xsplash/xsplash-throbber.png");
+ throbber_image = get_throbber_filename ();
g_debug ("background_image = %s", background_image);
g_debug ("logo_image = %s", logo_image);
Follow ups