aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-10-31 00:13:17 +0000
committerTarmac <Unknown>2013-10-31 00:13:17 +0000
commitb5ed574ecd4f8a1c84f0a0272bda4b0509877eae (patch)
tree0975152aae9c159e23f3cccb5d05fcf0137d8f2e
parentbbc781d9e2afe500d9a5d09335f0954f25269be6 (diff)
parent668658f383ae43f175a70a0fdca983c64b84fe59 (diff)
downloadayatana-indicator-datetime-b5ed574ecd4f8a1c84f0a0272bda4b0509877eae.tar.gz
ayatana-indicator-datetime-b5ed574ecd4f8a1c84f0a0272bda4b0509877eae.tar.bz2
ayatana-indicator-datetime-b5ed574ecd4f8a1c84f0a0272bda4b0509877eae.zip
As per the spec, let users show the year in indicator-datetime. Fixes: https://bugs.launchpad.net/bugs/465689.
Approved by Ted Gould, PS Jenkins bot.
-rw-r--r--data/com.canonical.indicator.datetime.gschema.xml9
-rw-r--r--data/datetime-dialog.ui45
-rw-r--r--panel/datetime-prefs.c5
-rw-r--r--src/service.c4
-rw-r--r--src/settings-shared.h1
-rw-r--r--src/utils.c32
-rw-r--r--src/utils.h1
7 files changed, 82 insertions, 15 deletions
diff --git a/data/com.canonical.indicator.datetime.gschema.xml b/data/com.canonical.indicator.datetime.gschema.xml
index 4f831d5..1a5922c 100644
--- a/data/com.canonical.indicator.datetime.gschema.xml
+++ b/data/com.canonical.indicator.datetime.gschema.xml
@@ -64,6 +64,15 @@
time-format value is set to custom.
</description>
</key>
+ <key name="show-year" type="b">
+ <default>false</default>
+ <summary>Show the year in the indicator</summary>
+ <description>
+ Puts the year in the panel along with the month and the date.
+ This setting will be ignored if either the time-format value is set to custom
+ or if show-date is set to false.
+ </description>
+ </key>
<key name="show-calendar" type="b">
<default>true</default>
<summary>Show the monthly calendar in the indicator</summary>
diff --git a/data/datetime-dialog.ui b/data/datetime-dialog.ui
index 430f77f..6f74cd0 100644
--- a/data/datetime-dialog.ui
+++ b/data/datetime-dialog.ui
@@ -529,7 +529,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="showDateTimeCheck">
+ <object class="GtkCheckButton" id="showDateAndMonthCheck">
<property name="label" translatable="yes">_Date and month</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -546,6 +546,45 @@
</packing>
</child>
<child>
+ <object class="GtkAlignment" id="showYearAlignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="yscale">0</property>
+ <property name="left_padding">24</property>
+ <child>
+ <object class="GtkVBox" id="showYearVbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="showYearCheck">
+ <property name="label" translatable="yes">_Year</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -589,7 +628,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
<child>
@@ -606,7 +645,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">5</property>
</packing>
</child>
</object>
diff --git a/panel/datetime-prefs.c b/panel/datetime-prefs.c
index 8e5ee35..55456ac 100644
--- a/panel/datetime-prefs.c
+++ b/panel/datetime-prefs.c
@@ -699,7 +699,9 @@ indicator_datetime_panel_init (IndicatorDatetimePanel * self)
"active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind (conf, SETTINGS_SHOW_DAY_S, WIG ("showWeekdayCheck"),
"active", G_SETTINGS_BIND_DEFAULT);
- g_settings_bind (conf, SETTINGS_SHOW_DATE_S, WIG ("showDateTimeCheck"),
+ g_settings_bind (conf, SETTINGS_SHOW_DATE_S, WIG ("showDateAndMonthCheck"),
+ "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (conf, SETTINGS_SHOW_YEAR_S, WIG ("showYearCheck"),
"active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind (conf, SETTINGS_SHOW_SECONDS_S, WIG ("showSecondsCheck"),
"active", G_SETTINGS_BIND_DEFAULT);
@@ -725,6 +727,7 @@ indicator_datetime_panel_init (IndicatorDatetimePanel * self)
"active", G_SETTINGS_BIND_DEFAULT);
/* Set up sensitivities */
+ add_widget_dependency (WIG ("showDateAndMonthCheck"), WIG ("showYearCheck"));
add_widget_dependency (WIG ("showCalendarCheck"), WIG ("calendarOptions"));
add_widget_dependency (WIG ("showClockCheck"), WIG ("clockOptions"));
add_widget_dependency (WIG ("showLocationsCheck"), WIG ("locationsButton"));
diff --git a/src/service.c b/src/service.c
index 6fb2ded..4edcd1c 100644
--- a/src/service.c
+++ b/src/service.c
@@ -666,7 +666,8 @@ get_header_label_format_string (IndicatorDatetimeService * self)
{
gboolean show_day = g_settings_get_boolean (s, SETTINGS_SHOW_DAY_S);
gboolean show_date = g_settings_get_boolean (s, SETTINGS_SHOW_DATE_S);
- fmt = generate_full_format_string (show_day, show_date, s);
+ gboolean show_year = show_date && g_settings_get_boolean (s, SETTINGS_SHOW_YEAR_S);
+ fmt = generate_full_format_string (show_day, show_date, show_year, s);
}
p->header_label_format_string = fmt;
@@ -2182,6 +2183,7 @@ my_constructed (GObject * gself)
SETTINGS_SHOW_SECONDS_S,
SETTINGS_SHOW_DAY_S,
SETTINGS_SHOW_DATE_S,
+ SETTINGS_SHOW_YEAR_S,
SETTINGS_CUSTOM_TIME_FORMAT_S
};
const char * const calendar_settings[] = {
diff --git a/src/settings-shared.h b/src/settings-shared.h
index afcccb6..4615fe8 100644
--- a/src/settings-shared.h
+++ b/src/settings-shared.h
@@ -37,6 +37,7 @@ TimeFormatMode;
#define SETTINGS_SHOW_SECONDS_S "show-seconds"
#define SETTINGS_SHOW_DAY_S "show-day"
#define SETTINGS_SHOW_DATE_S "show-date"
+#define SETTINGS_SHOW_YEAR_S "show-year"
#define SETTINGS_CUSTOM_TIME_FORMAT_S "custom-time-format"
#define SETTINGS_SHOW_CALENDAR_S "show-calendar"
#define SETTINGS_SHOW_WEEK_NUMBERS_S "show-week-numbers"
diff --git a/src/utils.c b/src/utils.c
index d1e1fbf..5539c5c 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -329,19 +329,31 @@ generate_terse_format_string_at_time (GDateTime * now, GDateTime * time)
***/
static const gchar *
-get_full_date_format_string (gboolean show_day, gboolean show_date)
+get_full_date_format_string (gboolean show_day, gboolean show_date, gboolean show_year)
{
- const gchar * fmt;
+ const char * fmt;
- if (show_date && show_day)
- /* TRANSLATORS: a strftime(3) format showing the date and weekday */
+ if (show_day && show_date && show_year)
+ /* TRANSLATORS: a strftime(3) format showing the weekday, date, and year */
+ fmt = T_("%a %b %e %Y");
+ else if (show_day && show_date)
+ /* TRANSLATORS: a strftime(3) format showing the weekday and date */
fmt = T_("%a %b %e");
+ else if (show_day && show_year)
+ /* TRANSLATORS: a strftime(3) format showing the weekday and year. */
+ fmt = T_("%a %Y");
+ else if (show_day)
+ /* TRANSLATORS: a strftime(3) format showing the weekday. */
+ fmt = T_("%a");
+ else if (show_date && show_year)
+ /* TRANSLATORS: a strftime(3) format showing the date and year */
+ fmt = T_("%b %e %Y");
else if (show_date)
/* TRANSLATORS: a strftime(3) format showing the date */
fmt = T_("%b %e");
- else if (show_day)
- /* TRANSLATORS: a strftime(3) format showing the weekday */
- fmt = T_("%a");
+ else if (show_year)
+ /* TRANSLATORS: a strftime(3) format showing the year */
+ fmt = T_("%Y");
else
fmt = NULL;
@@ -400,9 +412,9 @@ get_full_time_format_string (GSettings * settings)
}
gchar *
-generate_full_format_string (gboolean show_day, gboolean show_date, GSettings * settings)
+generate_full_format_string (gboolean show_day, gboolean show_date, gboolean show_year, GSettings * settings)
{
- const gchar * date_fmt = get_full_date_format_string (show_day, show_date);
+ const gchar * date_fmt = get_full_date_format_string (show_day, show_date, show_year);
const gchar * time_fmt = get_full_time_format_string (settings);
return join_date_and_time_format_strings (date_fmt, time_fmt);
}
@@ -436,6 +448,6 @@ generate_full_format_string_at_time (GDateTime * now, GDateTime * time, GSetting
break;
}
- return generate_full_format_string (show_day, show_date, settings);
+ return generate_full_format_string (show_day, show_date, FALSE, settings);
}
diff --git a/src/utils.h b/src/utils.h
index 24eddb6..5eacce5 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -54,6 +54,7 @@ gchar * generate_terse_format_string_at_time (GDateTime * now,
gchar * generate_full_format_string (gboolean show_day,
gboolean show_date,
+ gboolean show_year,
GSettings * settings);
gchar * generate_full_format_string_at_time (GDateTime * now,