datetime: Toggle the NTP switch when clicking on the row
Pointed out by Allan Day on IRC. https://bugzilla.gnome.org/show_bug.cgi?id=694985
This commit is contained in:
parent
20670b5360
commit
6fddedad84
1 changed files with 20 additions and 9 deletions
|
@ -1013,12 +1013,22 @@ run_dialog (CcDateTimePanel *self,
|
||||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
toggle_switch (GtkWidget *sw)
|
||||||
|
{
|
||||||
|
gboolean active;
|
||||||
|
|
||||||
|
active = gtk_switch_get_active (GTK_SWITCH (sw));
|
||||||
|
gtk_switch_set_active (GTK_SWITCH (sw), !active);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
list_box_row_activated (GtkListBox *listbox,
|
list_box_row_activated (GtkListBox *listbox,
|
||||||
GtkListBoxRow *row,
|
GtkListBoxRow *row,
|
||||||
CcDateTimePanel *self)
|
CcDateTimePanel *self)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
CcDateTimePanelPrivate *priv = self->priv;
|
||||||
gchar *widget_name, *found;
|
gchar *widget_name, *found;
|
||||||
|
|
||||||
widget_name = g_strdup (gtk_buildable_get_name (GTK_BUILDABLE (row)));
|
widget_name = g_strdup (gtk_buildable_get_name (GTK_BUILDABLE (row)));
|
||||||
|
@ -1028,17 +1038,18 @@ list_box_row_activated (GtkListBox *listbox,
|
||||||
|
|
||||||
gtk_list_box_select_row (listbox, NULL);
|
gtk_list_box_select_row (listbox, NULL);
|
||||||
|
|
||||||
/* replace "button" with "dialog" */
|
if (!g_strcmp0 (widget_name, "auto-datetime-row"))
|
||||||
found = g_strrstr (widget_name, "button");
|
{
|
||||||
|
toggle_switch (W ("network_time_switch"));
|
||||||
|
}
|
||||||
|
else if ((found = g_strrstr (widget_name, "button")))
|
||||||
|
{
|
||||||
|
/* replace "button" with "dialog" */
|
||||||
|
memcpy (found, "dialog", 6);
|
||||||
|
|
||||||
if (!found)
|
run_dialog (self, widget_name);
|
||||||
goto out;
|
}
|
||||||
|
|
||||||
memcpy (found, "dialog", 6);
|
|
||||||
|
|
||||||
run_dialog (self, widget_name);
|
|
||||||
|
|
||||||
out:
|
|
||||||
g_free (widget_name);
|
g_free (widget_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue