~ubuntu-branches/ubuntu/vivid/gnome-desktop3/vivid-proposed

« back to all changes in this revision

Viewing changes to libgnome-desktop/gnome-wall-clock.c

  • Committer: Package Import Robot
  • Author(s): Tim Lunn
  • Date: 2014-09-12 07:22:38 UTC
  • mfrom: (1.6.4) (31.1.1 utopic-proposed)
  • Revision ID: package-import@ubuntu.com-20140912072238-fv5g0rpwuk5yynip
Tags: 3.12.2-2ubuntu1
* New upstream release (LP: #1372346)
* Merge with Debian, Remaining changes:
  - debian/patches:
    + 04_compute_average_color.patch: Compute the avergage color in
      gnome-desktop itself, not in unity to fix some races (LP #963140)
    + tweak_color_computation.patch, Patch from Gord, no patch header,
      no bug link.
    + git_revert_draw_background.patch
    + ubuntu_language.patch, Ported relevant bits from g-c-c 
      52_region_language.patch, as required for gnome 3.8 region panel
    + ubuntu_language_list_from_SUPPORTED.patch,
      adds api to get list of available languages from SUPPORTED file.
      To be used by gnome 3.8 region panel language installation.
  - debian/rules:
    + drop obsolete --disable-scrollkeeper configure flag
  - debian/libgnome-desktop-3-10.symbols:
    + Add symbols included in Ubuntu patches
  - debian/control.in:
    + Mark gnome-desktop3-data Multi-Arch: foreign
* Dropped changes:
  - 02_refuse_to_break_GL_compositors.patch:
    + xrandr code has moved into libunity-settings-daemon now

Show diffs side-by-side

added added

removed removed

Lines of Context:
229
229
        g_type_class_add_private (gobject_class, sizeof (GnomeWallClockPrivate));
230
230
}
231
231
 
 
232
/* Some of our translations use the ratio symbol which isn't
 
233
 * convertible to non-UTF-8 locale encodings.
 
234
 */
 
235
static char *
 
236
filter_ratio_for_locale (const char *input)
 
237
{
 
238
        char **pieces = NULL;
 
239
        char *output = NULL;
 
240
 
 
241
        if (g_get_charset (NULL)) /* UTF-8 is ok */
 
242
                return g_strdup (input);
 
243
 
 
244
        /* else, we'll replace ratio with a plain colon */
 
245
        pieces = g_strsplit (input, "∶", -1);
 
246
        output = g_strjoinv (":", pieces);
 
247
        g_strfreev (pieces);
 
248
        return output;
 
249
}
 
250
 
232
251
static gboolean
233
252
update_clock (gpointer data)
234
253
{
235
254
        GnomeWallClock   *self = data;
236
255
        GDesktopClockFormat clock_format;
237
256
        const char *format_string;
 
257
        char *safe_format_string;
238
258
        gboolean show_full_date;
239
259
        gboolean show_weekday;
240
260
        gboolean show_seconds;
266
286
            self->priv->ampm_available == FALSE) {
267
287
                if (show_full_date) {
268
288
                        /* Translators: This is the time format with full date used
269
 
                           in 24-hour mode.
270
 
                           The character between %R and %S is U+2236 RATIO */
271
 
                        format_string = show_seconds ? _("%a %b %e, %R∶%S")
 
289
                           in 24-hour mode. */
 
290
                        format_string = show_seconds ? _("%a %b %e, %R:%S")
272
291
                                : _("%a %b %e, %R");
273
292
                } else if (show_weekday) {
274
293
                        /* Translators: This is the time format with day used
275
 
                           in 24-hour mode.
276
 
                           The character between %R and %S is U+2236 RATIO */
277
 
                        format_string = show_seconds ? _("%a %R∶%S")
 
294
                           in 24-hour mode. */
 
295
                        format_string = show_seconds ? _("%a %R:%S")
278
296
                                : _("%a %R");
279
297
                } else {
280
298
                        /* Translators: This is the time format without date used
281
 
                           in 24-hour mode.
282
 
                           The character between %R and %S is U+2236 RATIO */
283
 
                        format_string = show_seconds ? _("%R∶%S") : _("%R");
 
299
                           in 24-hour mode. */
 
300
                        format_string = show_seconds ? _("%R:%S") : _("%R");
284
301
                }
285
302
        } else {
286
303
                if (show_full_date) {
287
304
                        /* Translators: This is a time format with full date used
288
 
                           for AM/PM.
289
 
                           The Unicode characters are U+2236 RATIO and
290
 
                           U+2009 THIN SPACE */
291
 
                        format_string = show_seconds ? _("%a %b %e, %l∶%M∶%S %p")
292
 
                                : _("%a %b %e, %l∶%M %p");
 
305
                           for AM/PM. */
 
306
                        format_string = show_seconds ? _("%a %b %e, %l:%M:%S %p")
 
307
                                : _("%a %b %e, %l:%M %p");
293
308
                } else if (show_weekday) {
294
309
                        /* Translators: This is a time format with day used
295
 
                           for AM/PM.
296
 
                           The Unicode characters are U+2236 RATIO and
297
 
                           U+2009 THIN SPACE */
298
 
                        format_string = show_seconds ? _("%a %l∶%M∶%S %p")
299
 
                                : _("%a %l∶%M %p");
 
310
                           for AM/PM. */
 
311
                        format_string = show_seconds ? _("%a %l:%M:%S %p")
 
312
                                : _("%a %l:%M %p");
300
313
                } else {
301
314
                        /* Translators: This is a time format without date used
302
 
                           for AM/PM.
303
 
                           The Unicode characters are U+2236 RATIO and
304
 
                           U+2009 THIN SPACE */
305
 
                        format_string = show_seconds ? _("%l∶%M∶%S %p")
306
 
                                : _("%l∶%M %p");
 
315
                           for AM/PM. */
 
316
                        format_string = show_seconds ? _("%l:%M:%S %p")
 
317
                                : _("%l:%M %p");
307
318
                }
308
319
        }
309
320
 
 
321
        safe_format_string = filter_ratio_for_locale (format_string);
 
322
 
310
323
        g_free (self->priv->clock_string);
311
 
        self->priv->clock_string = g_date_time_format (now, format_string);
 
324
        self->priv->clock_string = g_date_time_format (now, safe_format_string);
312
325
 
313
326
        g_date_time_unref (now);
314
327
        g_date_time_unref (expiry);
315
 
      
 
328
        g_free (safe_format_string);
 
329
 
316
330
        g_object_notify ((GObject*)self, "clock");
317
331
 
318
332
        return FALSE;