76
76
#define NEVER_SENSITIVE "never_sensitive"
78
#define N_GCONF_PREFS 12 /* Keep this in sync with the number of keys below! */
78
#define N_GCONF_PREFS 11 /* Keep this in sync with the number of keys below! */
79
79
#define KEY_FORMAT "format"
80
80
#define KEY_SHOW_SECONDS "show_seconds"
81
81
#define KEY_SHOW_DATE "show_date"
82
82
#define KEY_SHOW_WEATHER "show_weather"
83
83
#define KEY_SHOW_TEMPERATURE "show_temperature"
84
#define KEY_GMT_TIME "gmt_time"
85
84
#define KEY_CUSTOM_FORMAT "custom_format"
86
85
#define KEY_SHOW_WEEK "show_week_numbers"
87
86
#define KEY_CITIES "cities"
435
get_updated_timeformat (ClockData *cd,
431
get_updated_timeformat (ClockData *cd)
438
433
/* Show date in another line if panel is vertical, or
439
434
* horizontal but large enough to hold two lines of text
442
437
const char *time_format;
443
char *time_gravity_format;
444
438
const char *date_format;
445
439
char *clock_format;
455
449
* in France: 20:10). */
456
450
time_format = cd->showseconds ? _("%H:%M:%S") : _("%H:%M");
459
/* FIXME: we need this for bug #410169 in pango. We'll be able
460
* to remove this at a later stage. */
461
time_gravity_format = g_strdup_printf ("<span gravity=\"south\">%s</span>",
464
time_gravity_format = g_strdup (time_format);
467
452
if (!cd->showdate)
468
clock_format = g_strdup (time_gravity_format);
453
clock_format = g_strdup (time_format);
471
456
/* Translators: This is a strftime format string.
491
476
clock_format = g_strdup_printf (_("%1$s, %2$s"),
493
time_gravity_format);
496
g_free (time_gravity_format);
498
481
result = g_locale_from_utf8 (clock_format, -1, NULL, NULL, NULL);
499
482
g_free (clock_format);
509
492
update_timeformat (ClockData *cd)
511
494
g_free (cd->timeformat);
512
cd->timeformat = get_updated_timeformat (cd, FALSE);
513
g_free (cd->fallback_timeformat);
514
cd->fallback_timeformat = get_updated_timeformat (cd, TRUE);
495
cd->timeformat = get_updated_timeformat (cd);
517
498
/* sets accessible name and description for the widget */
559
tm = gmtime (&cd->current_time);
561
tm = localtime (&cd->current_time);
539
tm = localtime (&cd->current_time);
563
541
if (cd->format == CLOCK_FORMAT_UNIX) {
564
542
if (use_two_line_format (cd)) {
870
844
cd->orient == PANEL_APPLET_ORIENT_UP);
871
845
g_free (prefs_dir);
873
calendar_window_set_utc_time (CALENDAR_WINDOW (window),
875
847
calendar_window_set_show_weeks (CALENDAR_WINDOW (window),
877
849
calendar_window_set_time_format (CALENDAR_WINDOW (window),
1616
1588
format = g_locale_from_utf8 (_("%H:%M"), -1, NULL, NULL, NULL);
1620
tm = gmtime (&cd->current_time);
1622
tm = localtime (&cd->current_time);
1591
tm = localtime (&cd->current_time);
1625
1594
strcpy (string, "???");
1645
1614
char string[256];
1646
1615
char *utf8, *loc;
1649
tm = gmtime (&cd->current_time);
1651
tm = localtime (&cd->current_time);
1617
tm = localtime (&cd->current_time);
1653
1619
/* Translators: This is a strftime format string.
1654
1620
* It is used to display a date in the full format (so that people can
2419
gmt_time_changed (GConfClient *client,
2426
if (!entry->value || entry->value->type != GCONF_VALUE_BOOL)
2429
value = gconf_value_get_bool (entry->value);
2431
clock->gmt_time = (value != 0);
2433
refresh_clock_timeout (clock);
2435
if (clock->calendar_popup != NULL) {
2436
calendar_window_set_utc_time (CALENDAR_WINDOW (clock->calendar_popup), clock->gmt_time);
2437
position_calendar_popup (clock);
2442
2385
custom_format_changed (GConfClient *client,
2444
2387
GConfEntry *entry,
2510
2453
{ KEY_SHOW_DATE, (GConfClientNotifyFunc) show_date_changed },
2511
2454
{ KEY_SHOW_WEATHER, (GConfClientNotifyFunc) show_weather_changed },
2512
2455
{ KEY_SHOW_TEMPERATURE, (GConfClientNotifyFunc) show_temperature_changed },
2513
{ KEY_GMT_TIME, (GConfClientNotifyFunc) gmt_time_changed },
2514
2456
{ KEY_CUSTOM_FORMAT, (GConfClientNotifyFunc) custom_format_changed },
2515
2457
{ KEY_SHOW_WEEK, (GConfClientNotifyFunc) show_week_changed },
2516
2458
{ KEY_CITIES, (GConfClientNotifyFunc) cities_changed },
2598
2540
cd->show_weather = panel_applet_gconf_get_bool (applet, KEY_SHOW_WEATHER, NULL);
2599
2541
cd->show_temperature = panel_applet_gconf_get_bool (applet, KEY_SHOW_TEMPERATURE, NULL);
2600
cd->gmt_time = panel_applet_gconf_get_bool (applet, KEY_GMT_TIME, NULL);
2601
2542
cd->showweek = panel_applet_gconf_get_bool (applet, KEY_SHOW_WEEK, NULL);
2602
2543
cd->timeformat = NULL;
2603
cd->fallback_timeformat = NULL;
2605
2545
cd->can_handle_format_12 = (clock_locale_format () == CLOCK_FORMAT_12);
2606
2546
if (!cd->can_handle_format_12 && cd->format == CLOCK_FORMAT_12)
2774
2714
case CLOCK_FORMAT_24:
2775
2715
gtk_widget_set_sensitive (cd->showseconds_check, TRUE);
2776
2716
gtk_widget_set_sensitive (cd->showdate_check, TRUE);
2777
gtk_widget_set_sensitive (cd->gmt_time_check, TRUE);
2778
2717
gtk_widget_set_sensitive (cd->custom_entry, FALSE);
2779
2718
gtk_widget_set_sensitive (cd->custom_label, FALSE);
2781
2720
case CLOCK_FORMAT_UNIX:
2782
2721
gtk_widget_set_sensitive (cd->showseconds_check, FALSE);
2783
2722
gtk_widget_set_sensitive (cd->showdate_check, FALSE);
2784
gtk_widget_set_sensitive (cd->gmt_time_check, FALSE);
2785
2723
gtk_widget_set_sensitive (cd->custom_entry, FALSE);
2786
2724
gtk_widget_set_sensitive (cd->custom_label, FALSE);
2788
2726
case CLOCK_FORMAT_INTERNET:
2789
2727
gtk_widget_set_sensitive (cd->showseconds_check, TRUE);
2790
2728
gtk_widget_set_sensitive (cd->showdate_check, FALSE);
2791
gtk_widget_set_sensitive (cd->gmt_time_check, FALSE);
2792
2729
gtk_widget_set_sensitive (cd->custom_entry, FALSE);
2793
2730
gtk_widget_set_sensitive (cd->custom_label, FALSE);
2795
2732
case CLOCK_FORMAT_CUSTOM:
2796
2733
gtk_widget_set_sensitive (cd->showseconds_check, FALSE);
2797
2734
gtk_widget_set_sensitive (cd->showdate_check, FALSE);
2798
gtk_widget_set_sensitive (cd->gmt_time_check, TRUE);
2799
2735
gtk_widget_set_sensitive (cd->custom_entry, TRUE);
2800
2736
gtk_widget_set_sensitive (cd->custom_label, TRUE);
3682
3618
KEY_CUSTOM_FORMAT);
3683
3619
setup_writability_sensitivity (cd, cd->showseconds_check, NULL, KEY_SHOW_SECONDS);
3684
3620
setup_writability_sensitivity (cd, cd->showdate_check, NULL, KEY_SHOW_DATE);
3685
setup_writability_sensitivity (cd, cd->gmt_time_check, NULL, KEY_GMT_TIME);
3687
3622
gtk_widget_show (cd->props);