[gnome-initial-setup/software-sources] software: Hook up setting gnome-software settings on page completion
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/software-sources] software: Hook up setting gnome-software settings on page completion
- Date: Thu, 1 Sep 2016 13:04:15 +0000 (UTC)
commit e67ef6b0896750f2cf54352cfec7f4aa82f65452
Author: Kalev Lember <klember redhat com>
Date: Wed Aug 31 12:49:47 2016 +0200
software: Hook up setting gnome-software settings on page completion
.../pages/software/gis-software-page.c | 27 ++++++++++++++++++-
1 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/gnome-initial-setup/pages/software/gis-software-page.c
b/gnome-initial-setup/pages/software/gis-software-page.c
index 4908613..a19683a 100644
--- a/gnome-initial-setup/pages/software/gis-software-page.c
+++ b/gnome-initial-setup/pages/software/gis-software-page.c
@@ -36,6 +36,7 @@ struct _GisSoftwarePagePrivate
GtkWidget *more_popover;
GtkWidget *proprietary_switch;
GtkWidget *text_label;
+ GSettings *software_settings;
};
typedef struct _GisSoftwarePagePrivate GisSoftwarePagePrivate;
@@ -113,6 +114,8 @@ gis_software_page_constructed (GObject *object)
G_OBJECT_CLASS (gis_software_page_parent_class)->constructed (object);
+ priv->software_settings = g_settings_new ("org.gnome.software");
+
update_distro_name (page);
gis_page_set_complete (GIS_PAGE (page), TRUE);
@@ -126,9 +129,30 @@ gis_software_page_dispose (GObject *object)
GisSoftwarePage *page = GIS_SOFTWARE_PAGE (object);
GisSoftwarePagePrivate *priv = gis_software_page_get_instance_private (page);
+ g_clear_object (&priv->software_settings);
+
G_OBJECT_CLASS (gis_software_page_parent_class)->dispose (object);
}
+static gboolean
+gis_software_page_apply (GisPage *gis_page,
+ GCancellable *cancellable)
+{
+ GisSoftwarePage *page = GIS_SOFTWARE_PAGE (gis_page);
+ GisSoftwarePagePrivate *priv = gis_software_page_get_instance_private (page);
+ gboolean enable;
+
+ enable = gtk_switch_get_active (GTK_SWITCH (priv->proprietary_switch));
+
+ g_print ("%s proprietary software sources\n", enable ? "Enable" : "Disable");
+
+ g_settings_set_boolean (priv->software_settings, "show-nonfree-software", enable);
+ /* don't prompt for the same thing again in gnome-software */
+ g_settings_set_boolean (priv->software_settings, "show-nonfree-prompt", FALSE);
+
+ return FALSE;
+}
+
static void
gis_software_page_locale_changed (GisPage *page)
{
@@ -152,8 +176,6 @@ state_set (GtkSwitch *sw,
gboolean state,
gpointer data)
{
- g_print ("%s proprietary software sources\n", state ? "Enable" : "Disable");
-
gtk_switch_set_state (sw, state);
return TRUE;
@@ -174,6 +196,7 @@ gis_software_page_class_init (GisSoftwarePageClass *klass)
page_class->page_id = PAGE_ID;
page_class->locale_changed = gis_software_page_locale_changed;
+ page_class->apply = gis_software_page_apply;
object_class->constructed = gis_software_page_constructed;
object_class->dispose = gis_software_page_dispose;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]