Add callback function for doing ngettext on the "minutes" label

2004-12-17  Rodney Dawes  <dobey@novell.com>

	* gui/alarm-notify/alarm-notify-dialog.c (an_minutes_update_label):
	Add callback function for doing ngettext on the "minutes" label
	(alarm_notify_dialog): Get the "minutes" label from the glade file
	and set the callback for its "value_changed" signal

	Fixes #47535

svn path=/trunk/; revision=28146
This commit is contained in:
Rodney Dawes
2004-12-17 18:03:22 +00:00
committed by Rodney Dawes
parent 603f99314a
commit 0fe65f8c1a
2 changed files with 29 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2004-12-17 Rodney Dawes <dobey@novell.com>
* gui/alarm-notify/alarm-notify-dialog.c (an_minutes_update_label):
Add callback function for doing ngettext on the "minutes" label
(alarm_notify_dialog): Get the "minutes" label from the glade file
and set the callback for its "value_changed" signal
Fixes #47535
2004-12-13 Harish Krishnaswamy <kharish@novell.com> 2004-12-13 Harish Krishnaswamy <kharish@novell.com>
* gui/dialogs/calendar-setup.c : Correct some white space * gui/dialogs/calendar-setup.c : Correct some white space

View File

@ -49,6 +49,7 @@ typedef struct {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *title; GtkWidget *title;
GtkWidget *snooze_time; GtkWidget *snooze_time;
GtkWidget *minutes_label;
GtkWidget *description; GtkWidget *description;
GtkWidget *location; GtkWidget *location;
GtkWidget *start; GtkWidget *start;
@ -65,6 +66,21 @@ enum {
static void
an_update_minutes_label (GtkSpinButton *sb, gpointer data)
{
AlarmNotify *an;
char *new_label;
int snooze_timeout;
an = (AlarmNotify *) data;
snooze_timeout = gtk_spin_button_get_value_as_int (sb);
new_label = g_strdup (ngettext ("minute", "minutes", snooze_timeout));
gtk_label_set_text (GTK_LABEL (an->minutes_label), new_label);
g_free (new_label);
}
/** /**
* alarm_notify_dialog: * alarm_notify_dialog:
* @trigger: Trigger time for the alarm. * @trigger: Trigger time for the alarm.
@ -122,6 +138,7 @@ alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end,
an->dialog = glade_xml_get_widget (an->xml, "alarm-notify"); an->dialog = glade_xml_get_widget (an->xml, "alarm-notify");
an->title = glade_xml_get_widget (an->xml, "title-label"); an->title = glade_xml_get_widget (an->xml, "title-label");
an->snooze_time = glade_xml_get_widget (an->xml, "snooze-time"); an->snooze_time = glade_xml_get_widget (an->xml, "snooze-time");
an->minutes_label = glade_xml_get_widget (an->xml, "minutes-label");
an->description = glade_xml_get_widget (an->xml, "description-label"); an->description = glade_xml_get_widget (an->xml, "description-label");
an->location = glade_xml_get_widget (an->xml, "location-label"); an->location = glade_xml_get_widget (an->xml, "location-label");
an->start = glade_xml_get_widget (an->xml, "start-label"); an->start = glade_xml_get_widget (an->xml, "start-label");
@ -167,6 +184,9 @@ alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end,
end = timet_to_str_with_zone (occur_end, current_zone); end = timet_to_str_with_zone (occur_end, current_zone);
gtk_label_set_text (GTK_LABEL (an->end), end); gtk_label_set_text (GTK_LABEL (an->end), end);
/* Set callback for updating the snooze "minutes" label */
g_signal_connect (G_OBJECT (an->snooze_time), "value_changed",
G_CALLBACK (an_update_minutes_label), an);
/* Run! */ /* Run! */
if (!GTK_WIDGET_REALIZED (an->dialog)) if (!GTK_WIDGET_REALIZED (an->dialog))