summaryrefslogtreecommitdiff
path: root/capplets
diff options
context:
space:
mode:
Diffstat (limited to 'capplets')
-rw-r--r--capplets/time-admin/src/main.c69
-rw-r--r--capplets/time-admin/src/time-share.c17
-rw-r--r--capplets/time-admin/src/time-share.h5
-rw-r--r--capplets/time-admin/src/time-zone.c28
4 files changed, 56 insertions, 63 deletions
diff --git a/capplets/time-admin/src/main.c b/capplets/time-admin/src/main.c
index fe16b7c7..8ae4986c 100644
--- a/capplets/time-admin/src/main.c
+++ b/capplets/time-admin/src/main.c
@@ -137,16 +137,9 @@ static void InitMainWindow(TimeAdmin *ta)
&error);
if (ta->Permission == NULL)
{
+ g_warning ("Failed to acquire %s: %s", TIME_ADMIN_PERMISSION, error->message);
g_error_free (error);
- return;
}
- ta->ButtonLock = gtk_lock_button_new(ta->Permission);
- gtk_lock_button_set_permission(GTK_LOCK_BUTTON (ta->ButtonLock),ta->Permission);
- gtk_widget_grab_focus(ta->ButtonLock);
- g_signal_connect(ta->Permission,
- "notify",
- G_CALLBACK (on_permission_changed),
- ta);
}
static int RecordPid(void)
@@ -344,48 +337,64 @@ static GtkWidget *SetClock(TimeAdmin *ta)
static GtkWidget *SetDate(TimeAdmin *ta)
{
- GtkWidget *table;
- GtkWidget *DateLabel;
+ GtkWidget *table, *image, *DateLabel;
struct tm *LocalTime;
table = gtk_grid_new();
- gtk_grid_set_column_homogeneous(GTK_GRID(table),TRUE);
+ gtk_grid_set_column_homogeneous (GTK_GRID(table), TRUE);
- DateLabel = gtk_label_new(NULL);
- SetLableFontType(DateLabel,13,_("Set Date"));
- gtk_grid_attach(GTK_GRID(table) ,DateLabel, 1 , 0 , 2 , 2);
+ DateLabel = gtk_label_new (NULL);
+ SetLableFontType (DateLabel, 13, _("Set Date"));
+ gtk_grid_attach (GTK_GRID(table), DateLabel, 1, 0, 2, 2);
- LocalTime = GetCurrentTime();
+ LocalTime = GetCurrentTime ();
ta->Calendar = gtk_calendar_new ();
- gtk_widget_set_sensitive(ta->Calendar,!ta->NtpState);
- SetTooltip(ta->Calendar,!ta->NtpState);
- gtk_calendar_mark_day(GTK_CALENDAR(ta->Calendar),LocalTime->tm_mday);
+ gtk_widget_set_sensitive (ta->Calendar, !ta->NtpState);
+ SetTooltip (ta->Calendar, !ta->NtpState);
+ gtk_calendar_mark_day (GTK_CALENDAR(ta->Calendar), LocalTime->tm_mday);
ta->OldDay = LocalTime->tm_mday;
- gtk_grid_attach(GTK_GRID(table) ,ta->Calendar, 0 , 2 , 4 , 3);
-
- ta->CloseButton = gtk_button_new_with_label (_("Close"));
- gtk_grid_attach(GTK_GRID(table) ,ta->CloseButton, 3 , 5 , 1 , 1);
+ gtk_grid_attach (GTK_GRID(table), ta->Calendar, 0, 2, 4, 3);
+
+ ta->CloseButton = gtk_button_new_with_label (_("_Close"));
+ image = gtk_image_new_from_icon_name ("gtk-close", GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (ta->CloseButton), image);
+ gtk_button_set_use_underline (GTK_BUTTON(ta->CloseButton), TRUE);
+ gtk_style_context_add_class (gtk_widget_get_style_context (ta->CloseButton), "text-button");
+ gtk_grid_attach (GTK_GRID(table), ta->CloseButton, 3, 5, 1, 1);
g_signal_connect (ta->CloseButton,
"clicked",
G_CALLBACK (CloseWindow),
ta);
- gtk_grid_attach(GTK_GRID(table) ,ta->ButtonLock, 0 , 5 , 1 , 1);
+ if (ta->Permission)
+ {
+ ta->ButtonLock = gtk_lock_button_new (ta->Permission);
+ gtk_lock_button_set_permission (GTK_LOCK_BUTTON (ta->ButtonLock),ta->Permission);
+ gtk_grid_attach (GTK_GRID(table), ta->ButtonLock, 0, 5, 1, 1);
+ g_signal_connect (ta->Permission,
+ "notify",
+ G_CALLBACK (on_permission_changed),
+ ta);
+ }
- ta->SaveButton = gtk_button_new_with_label (_("Save"));
- gtk_widget_set_sensitive(ta->SaveButton,!ta->NtpState);
- gtk_grid_attach(GTK_GRID(table) ,ta->SaveButton, 2 , 5 , 1 , 1);
+ ta->SaveButton = gtk_button_new_with_label (_("_Save"));
+ image = gtk_image_new_from_icon_name ("gtk-save", GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (ta->SaveButton), image);
+ gtk_button_set_use_underline (GTK_BUTTON(ta->SaveButton), TRUE);
+ gtk_style_context_add_class (gtk_widget_get_style_context (ta->SaveButton), "text-button");
+ gtk_widget_set_sensitive (ta->SaveButton, !ta->NtpState);
+ gtk_grid_attach (GTK_GRID(table), ta->SaveButton, 2, 5, 1, 1);
g_signal_connect (ta->SaveButton,
- "clicked",
+ "clicked",
G_CALLBACK (SaveModifyTime),
ta);
- gtk_grid_set_row_spacing(GTK_GRID(table), 6);
- gtk_grid_set_column_spacing(GTK_GRID(table), 12);
+ gtk_grid_set_row_spacing (GTK_GRID(table), 6);
+ gtk_grid_set_column_spacing (GTK_GRID(table), 12);
return table;
-
}
+
static void CreateClockInterface(TimeAdmin *ta)
{
GtkWidget *Vbox;
diff --git a/capplets/time-admin/src/time-share.c b/capplets/time-admin/src/time-share.c
index 6cc874ff..1bbea7d1 100644
--- a/capplets/time-admin/src/time-share.c
+++ b/capplets/time-admin/src/time-share.c
@@ -123,24 +123,7 @@ void QuitApp(TimeAdmin *ta)
gtk_main_quit();
}
-GtkWidget* DialogAddButtonWithIconName (GtkDialog *dialog,
- const gchar *button_text,
- const gchar *icon_name,
- gint response_id)
-{
- GtkWidget *button;
-
- button = gtk_button_new_with_mnemonic (button_text);
- gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON));
- gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
- gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button");
- gtk_widget_set_can_default (button, TRUE);
-// gtk_widget_show (button);
- gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, response_id);
-
- return button;
-}
void SetTooltip(GtkWidget*box,gboolean mode)
{
if(!mode)
diff --git a/capplets/time-admin/src/time-share.h b/capplets/time-admin/src/time-share.h
index af9bb60d..e4391bf2 100644
--- a/capplets/time-admin/src/time-share.h
+++ b/capplets/time-admin/src/time-share.h
@@ -83,11 +83,6 @@ void SetLableFontType (GtkWidget *Lable,
void QuitApp (TimeAdmin *ta);
-GtkWidget* DialogAddButtonWithIconName (GtkDialog *dialog,
- const gchar *button_text,
- const gchar *icon_name,
- gint response_id);
-
void SetTooltip (GtkWidget *box,
gboolean mode);
#endif
diff --git a/capplets/time-admin/src/time-zone.c b/capplets/time-admin/src/time-zone.c
index 6f26fe12..b9bc4955 100644
--- a/capplets/time-admin/src/time-zone.c
+++ b/capplets/time-admin/src/time-zone.c
@@ -426,9 +426,7 @@ static void ChoooseTimezoneClose(GtkWidget *widget,
void SetupTimezoneDialog(TimeAdmin *ta)
{
- GtkWidget *Vbox;
- GtkWidget *TimeZoneFrame;
- GtkWidget *Scrolled;
+ GtkWidget *Vbox, *TimeZoneFrame, *Scrolled, *image;
ta->dialog = gtk_dialog_new_with_buttons (_("Time Zone Selection"),
NULL,
@@ -437,15 +435,23 @@ void SetupTimezoneDialog(TimeAdmin *ta)
NULL);
gtk_window_set_default_size (GTK_WINDOW (ta->dialog), 730, 520);
- ta->TZclose = DialogAddButtonWithIconName(GTK_DIALOG(ta->dialog),
- _("Close"),
- "window-close",
- GTK_RESPONSE_CANCEL);
- ta->TZconfire = DialogAddButtonWithIconName(GTK_DIALOG(ta->dialog),
- _("Confirm"),
- "emblem-default",
- GTK_RESPONSE_OK);
+ ta->TZclose = gtk_button_new_with_mnemonic (_("_Close"));
+ image = gtk_image_new_from_icon_name ("window-close", GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (ta->TZclose), image);
+ gtk_button_set_use_underline (GTK_BUTTON (ta->TZclose), TRUE);
+ gtk_style_context_add_class (gtk_widget_get_style_context (ta->TZclose), "text-button");
+ gtk_widget_set_can_default (ta->TZclose, TRUE);
+ gtk_dialog_add_action_widget (GTK_DIALOG (ta->dialog), ta->TZclose, GTK_RESPONSE_CANCEL);
+
+ ta->TZconfire = gtk_button_new_with_mnemonic (_("Con_firm"));
+ image = gtk_image_new_from_icon_name ("emblem-default", GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (ta->TZconfire), image);
+ gtk_button_set_use_underline (GTK_BUTTON (ta->TZconfire), TRUE);
+ gtk_style_context_add_class (gtk_widget_get_style_context (ta->TZconfire), "text-button");
+ gtk_widget_set_can_default (ta->TZconfire, TRUE);
+ gtk_dialog_add_action_widget (GTK_DIALOG (ta->dialog), ta->TZconfire, GTK_RESPONSE_OK);
+
g_signal_connect (ta->TZconfire,
"clicked",
G_CALLBACK (ChoooseTimezoneDone),