[gnome-control-center] datetime: Sync AM/PM button's accessible name with the text displayed
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] datetime: Sync AM/PM button's accessible name with the text displayed
- Date: Tue, 17 Sep 2013 14:37:58 +0000 (UTC)
commit 17a8595ddc47edb7d70d68d6114a181de1a0c3ac
Author: Kalev Lember <kalevlember gmail com>
Date: Tue Sep 17 14:31:22 2013 +0200
datetime: Sync AM/PM button's accessible name with the text displayed
Instead of hardcoding the accessible name as "Switch between AM and
PM.", set it to "AM" or "PM" depending on which label the stack switcher
is currently showing.
https://bugzilla.gnome.org/show_bug.cgi?id=708219
panels/datetime/cc-datetime-panel.c | 20 ++++++++++++++++++++
panels/datetime/datetime.ui | 5 -----
2 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index 50a840d..3742890 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -240,6 +240,23 @@ clock_settings_changed_cb (GSettings *settings,
g_signal_handlers_unblock_by_func (format_combo, change_clock_settings, panel);
}
+static void
+am_pm_stack_visible_child_changed_cb (CcDateTimePanel *self)
+{
+ CcDateTimePanelPrivate *priv = self->priv;
+ AtkObject *am_pm_button_accessible;
+ GtkWidget *visible_label;
+ const gchar *visible_text;
+
+ am_pm_button_accessible = gtk_widget_get_accessible (W ("am_pm_button"));
+ if (am_pm_button_accessible == NULL)
+ return;
+
+ visible_label = gtk_stack_get_visible_child (GTK_STACK (W ("am_pm_stack")));
+ visible_text = gtk_label_get_text (GTK_LABEL (visible_label));
+ atk_object_set_name (am_pm_button_accessible, visible_text);
+}
+
static gboolean
am_pm_button_clicked (GtkWidget *button,
CcDateTimePanel *self)
@@ -1114,6 +1131,9 @@ setup_am_pm_button (CcDateTimePanel *self)
gtk_container_add (GTK_CONTAINER (stack), priv->am_label);
gtk_container_add (GTK_CONTAINER (stack), priv->pm_label);
gtk_widget_show_all (stack);
+ g_signal_connect_swapped (stack, "notify::visible-child",
+ G_CALLBACK (am_pm_stack_visible_child_changed_cb), self);
+ am_pm_stack_visible_child_changed_cb (self);
am_pm_button = W ("am_pm_button");
g_signal_connect (am_pm_button, "clicked",
diff --git a/panels/datetime/datetime.ui b/panels/datetime/datetime.ui
index c33be51..7aa2a1b 100644
--- a/panels/datetime/datetime.ui
+++ b/panels/datetime/datetime.ui
@@ -196,11 +196,6 @@
<style>
<class name="gnome-control-center-ampm-toggle-button"/>
</style>
- <child internal-child="accessible">
- <object class="AtkObject" id="ampm_up_accessible">
- <property name="accessible-description" translatable="yes">Switch between AM and
PM.</property>
- </object>
- </child>
<child>
<object class="GtkStack" id="am_pm_stack">
<property name="visible">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]