[gnome-control-center] notifications: Place switches into GtkListBox



commit 9407015730e347f493c4af76548942dcc078be03
Author: Marek Kasik <mkasik redhat com>
Date:   Fri Jan 16 11:50:48 2015 +0100

    notifications: Place switches into GtkListBox
    
    Place panel switches into GtkListBox and change their
    behaviour so that:
    
    When "Notifications" switch is off, all other switches in the dialog are
    insensitive.
    "Notifications Banners" switch is off and insensitive when corresponding
    panel switch is off.
    "Show Message Content in Banners" switch is off and insensitive when switch
    above is off.
    "Lock Screen Notifications" switch is off and insensitive when corresponding
    panel switch is off.
    "Show Message Content on Lock Screen" switch is off and insensitive when switch
    above is off.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742521

 panels/notifications/cc-edit-dialog.c            |  424 ++++++++++++++++++----
 panels/notifications/cc-edit-dialog.h            |    5 +-
 panels/notifications/cc-notifications-panel.c    |    2 +-
 panels/notifications/edit-dialog.ui              |  352 ++++++++++++++++++
 panels/notifications/notifications.gresource.xml |    1 +
 5 files changed, 704 insertions(+), 80 deletions(-)
---
diff --git a/panels/notifications/cc-edit-dialog.c b/panels/notifications/cc-edit-dialog.c
index b230a4d..a06601d 100644
--- a/panels/notifications/cc-edit-dialog.c
+++ b/panels/notifications/cc-edit-dialog.c
@@ -1,6 +1,7 @@
 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 /*
  * Copyright (C) 2012 Giovanni Campagna <scampa giovanni gmail com>
+ * Copyright (C) 2015 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -25,96 +26,363 @@
 #include <gio/gio.h>
 #include <gio/gdesktopappinfo.h>
 
+#include "shell/list-box-helper.h"
 #include "cc-notifications-panel.h"
 #include "cc-edit-dialog.h"
 
-static struct {
-  const char *setting_key;
-  const char *label;
-  gboolean bold;
-} policy_settings[] = {
-  /* TRANSLATORS: this is the per application switch for message tray usage. */
-  { "enable",                  NC_("notifications", "Notifications"),               TRUE  },
-  /* TRANSLATORS: this is the setting to configure sounds associated with notifications */
-  { "enable-sound-alerts",     NC_("notifications", "Sound Alerts"),                FALSE },
-  { "show-banners",            NC_("notifications", "Show Popup Banners"),          FALSE },
-  /* TRANSLATORS: banners here refers to message tray notifications in the middle of the screen */
-  { "force-expanded",          NC_("notifications", "Show Details in Banners"),     FALSE },
-  { "show-in-lock-screen",     NC_("notifications", "View in Lock Screen"),         FALSE },
-  { "details-in-lock-screen",  NC_("notifications", "Show Details in Lock Screen"), FALSE }
-};
+/*
+ *  Key                       Switch
+ *
+ * "enable",                 "notifications-switch"                 When set to off, all other switches in 
the dialog are insensitive
+ * "enable-sound-alerts",    "sound-alerts-switch"
+ * "show-banners",           "notification-banners-switch"          Off and insensitive when corresponding 
panel switch is off
+ * "force-expanded",         "notification-banners-content-switch"  Off and insensitive when switch above is 
off
+ * "show-in-lock-screen",    "lock-screen-notifications-switch"     Off and insensitive when corresponding 
panel switch is off
+ * "details-in-lock-screen", "lock-screen-content-switch"           Off and insensitive when switch above is 
off
+ */
+
+static void update_banner_switch (GtkWidget *dialog);
+static void update_banner_content_switch (GtkWidget *dialog);
+static void update_lock_screen_switch (GtkWidget *dialog);
+static void update_lock_screen_content_switch (GtkWidget *dialog);
+static void update_sound_switch (GtkWidget *dialog);
+static void update_notification_switch (GtkWidget *dialog);
+static void update_switches (GtkWidget *dialog);
+
+static GtkWidget *
+get_switch (GtkBuilder  *builder,
+            const gchar *prefix)
+{
+  GtkWidget *result;
+  gchar     *name;
+
+  name = g_strdup_printf ("%s-switch", prefix);
+  result = GTK_WIDGET (gtk_builder_get_object (builder, name));
+  g_free (name);
+
+  return result;
+}
+
+static void
+set_key_from_switch (GtkWidget   *dialog,
+                     const gchar *key,
+                     GtkSwitch   *the_switch)
+{
+  GSettings *settings;
+
+  settings = G_SETTINGS (g_object_get_data (G_OBJECT (dialog), "settings"));
+
+  g_settings_set_boolean (settings, key, gtk_switch_get_active (the_switch));
+}
+
+static void
+notifications_switch_state_set_cb (GtkSwitch  *widget,
+                                   GParamSpec *pspec,
+                                   GtkWidget  *dialog)
+{
+  set_key_from_switch (dialog, "enable", widget);
+  update_sound_switch (dialog);
+  update_banner_switch (dialog);
+  update_banner_content_switch (dialog);
+  update_lock_screen_switch (dialog);
+  update_lock_screen_content_switch (dialog);
+}
+
+static void
+sound_alerts_switch_state_set_cb (GtkSwitch  *widget,
+                                  GParamSpec *pspec,
+                                  GtkWidget  *dialog)
+{
+  set_key_from_switch (dialog, "enable-sound-alerts", widget);
+}
+
+static void
+notification_banners_switch_state_set_cb (GtkSwitch  *widget,
+                                          GParamSpec *pspec,
+                                          GtkWidget  *dialog)
+{
+  set_key_from_switch (dialog, "show-banners", widget);
+  update_banner_content_switch (dialog);
+}
+
+static void
+notification_banners_content_switch_state_set_cb (GtkSwitch  *widget,
+                                                  GParamSpec *pspec,
+                                                  GtkWidget  *dialog)
+{
+  set_key_from_switch (dialog, "force-expanded", widget);
+}
+
+static void
+lock_screen_notifications_switch_state_set_cb (GtkSwitch  *widget,
+                                               GParamSpec *pspec,
+                                               GtkWidget  *dialog)
+{
+  set_key_from_switch (dialog, "show-in-lock-screen", widget);
+  update_lock_screen_content_switch (dialog);
+}
+
+static void
+lock_screen_content_switch_state_set_cb (GtkSwitch  *widget,
+                                         GParamSpec *pspec,
+                                         GtkWidget  *dialog)
+{
+  set_key_from_switch (dialog, "details-in-lock-screen", widget);
+}
+
+static void
+update_switches (GtkWidget *dialog)
+{
+  update_notification_switch (dialog);
+  update_sound_switch (dialog);
+  update_banner_switch (dialog);
+  update_banner_content_switch (dialog);
+  update_lock_screen_switch (dialog);
+  update_lock_screen_content_switch (dialog);
+}
+
+static void
+update_notification_switch (GtkWidget *dialog)
+{
+  GtkBuilder *builder;
+  GSettings  *settings;
+  GtkWidget  *widget;
+
+  builder = GTK_BUILDER (g_object_get_data (G_OBJECT (dialog), "builder"));
+  settings = G_SETTINGS (g_object_get_data (G_OBJECT (dialog), "settings"));
+
+  widget = get_switch (builder, "notifications");
+  g_signal_handlers_block_by_func (G_OBJECT (widget), notifications_switch_state_set_cb, dialog);
+  gtk_switch_set_active (GTK_SWITCH (widget), g_settings_get_boolean (settings, "enable"));
+  g_signal_handlers_unblock_by_func (G_OBJECT (widget), notifications_switch_state_set_cb, dialog);
+}
+
+static void
+update_sound_switch (GtkWidget *dialog)
+{
+  GtkBuilder *builder;
+  GSettings  *settings;
+  GtkWidget  *widget;
+
+  builder = GTK_BUILDER (g_object_get_data (G_OBJECT (dialog), "builder"));
+  settings = G_SETTINGS (g_object_get_data (G_OBJECT (dialog), "settings"));
+
+  widget = get_switch (builder, "sound-alerts");
+  g_signal_handlers_block_by_func (G_OBJECT (widget), sound_alerts_switch_state_set_cb, dialog);
+  gtk_switch_set_active (GTK_SWITCH (widget), g_settings_get_boolean (settings, "enable-sound-alerts"));
+  g_signal_handlers_unblock_by_func (G_OBJECT (widget), sound_alerts_switch_state_set_cb, dialog);
+  gtk_widget_set_sensitive (widget, g_settings_get_boolean (settings, "enable"));
+}
+
+static void
+update_banner_switch (GtkWidget *dialog)
+{
+  GtkBuilder *builder;
+  GSettings  *settings;
+  GSettings  *master_settings;
+  GtkWidget  *widget;
+  gboolean    notifications_enabled;
+  gboolean    show_banners;
+  gboolean    active;
+  gboolean    sensitive;
+
+  builder = GTK_BUILDER (g_object_get_data (G_OBJECT (dialog), "builder"));
+  settings = G_SETTINGS (g_object_get_data (G_OBJECT (dialog), "settings"));
+  master_settings = G_SETTINGS (g_object_get_data (G_OBJECT (dialog), "master-settings"));
+
+  show_banners = g_settings_get_boolean (master_settings, "show-banners");
+  notifications_enabled = g_settings_get_boolean (settings, "enable");
+
+  widget = get_switch (builder, "notification-banners");
+  active = g_settings_get_boolean (settings, "show-banners") &&
+          show_banners;
+  sensitive = notifications_enabled &&
+              show_banners;
+  g_signal_handlers_block_by_func (G_OBJECT (widget), notification_banners_switch_state_set_cb, dialog);
+  gtk_switch_set_active (GTK_SWITCH (widget), active);
+  g_signal_handlers_unblock_by_func (G_OBJECT (widget), notification_banners_switch_state_set_cb, dialog);
+  gtk_widget_set_sensitive (widget, sensitive);
+}
+
+static void
+update_banner_content_switch (GtkWidget *dialog)
+{
+  GtkBuilder *builder;
+  GSettings  *settings;
+  GSettings  *master_settings;
+  GtkWidget  *widget;
+  gboolean    notifications_enabled;
+  gboolean    show_banners;
+  gboolean    active;
+  gboolean    sensitive;
+
+  builder = GTK_BUILDER (g_object_get_data (G_OBJECT (dialog), "builder"));
+  settings = G_SETTINGS (g_object_get_data (G_OBJECT (dialog), "settings"));
+  master_settings = G_SETTINGS (g_object_get_data (G_OBJECT (dialog), "master-settings"));
+
+  show_banners = g_settings_get_boolean (master_settings, "show-banners");
+  notifications_enabled = g_settings_get_boolean (settings, "enable");
+
+  widget = get_switch (builder, "notification-banners-content");
+  active = g_settings_get_boolean (settings, "force-expanded") &&
+           g_settings_get_boolean (settings, "show-banners") &&
+           show_banners;
+  sensitive = g_settings_get_boolean (settings, "show-banners") &&
+              notifications_enabled &&
+              show_banners;
+  g_signal_handlers_block_by_func (G_OBJECT (widget), notification_banners_content_switch_state_set_cb, 
dialog);
+  gtk_switch_set_active (GTK_SWITCH (widget), active);
+  g_signal_handlers_unblock_by_func (G_OBJECT (widget), notification_banners_content_switch_state_set_cb, 
dialog);
+  gtk_widget_set_sensitive (widget, sensitive);
+}
+
+static void
+update_lock_screen_switch (GtkWidget *dialog)
+{
+  GtkBuilder *builder;
+  GSettings  *settings;
+  GSettings  *master_settings;
+  GtkWidget  *widget;
+  gboolean    notifications_enabled;
+  gboolean    show_in_lock_screen;
+  gboolean    active;
+  gboolean    sensitive;
+
+  builder = GTK_BUILDER (g_object_get_data (G_OBJECT (dialog), "builder"));
+  settings = G_SETTINGS (g_object_get_data (G_OBJECT (dialog), "settings"));
+  master_settings = G_SETTINGS (g_object_get_data (G_OBJECT (dialog), "master-settings"));
+
+  show_in_lock_screen = g_settings_get_boolean (master_settings, "show-in-lock-screen");
+  notifications_enabled = g_settings_get_boolean (settings, "enable");
+
+  widget = get_switch (builder, "lock-screen-notifications");
+  active = g_settings_get_boolean (settings, "show-in-lock-screen") &&
+           show_in_lock_screen;
+  sensitive = notifications_enabled &&
+              show_in_lock_screen;
+
+  g_signal_handlers_block_by_func (G_OBJECT (widget), lock_screen_notifications_switch_state_set_cb, dialog);
+  gtk_switch_set_active (GTK_SWITCH (widget), active);
+  g_signal_handlers_unblock_by_func (G_OBJECT (widget), lock_screen_notifications_switch_state_set_cb, 
dialog);
+  gtk_widget_set_sensitive (widget, sensitive);
+}
+
+static void
+update_lock_screen_content_switch (GtkWidget *dialog)
+{
+  GtkBuilder *builder;
+  GSettings  *settings;
+  GSettings  *master_settings;
+  GtkWidget  *widget;
+  gboolean    notifications_enabled;
+  gboolean    show_in_lock_screen;
+  gboolean    active;
+  gboolean    sensitive;
+
+  builder = GTK_BUILDER (g_object_get_data (G_OBJECT (dialog), "builder"));
+  settings = G_SETTINGS (g_object_get_data (G_OBJECT (dialog), "settings"));
+  master_settings = G_SETTINGS (g_object_get_data (G_OBJECT (dialog), "master-settings"));
+
+  show_in_lock_screen = g_settings_get_boolean (master_settings, "show-in-lock-screen");
+  notifications_enabled = g_settings_get_boolean (settings, "enable");
+
+  widget = get_switch (builder, "lock-screen-content");
+  active = g_settings_get_boolean (settings, "details-in-lock-screen") &&
+           g_settings_get_boolean (settings, "show-in-lock-screen") &&
+           show_in_lock_screen;
+  sensitive = g_settings_get_boolean (settings, "show-in-lock-screen") &&
+              notifications_enabled &&
+              show_in_lock_screen;
+  g_signal_handlers_block_by_func (G_OBJECT (widget), lock_screen_content_switch_state_set_cb, dialog);
+  gtk_switch_set_active (GTK_SWITCH (widget), active);
+  g_signal_handlers_unblock_by_func (G_OBJECT (widget), lock_screen_content_switch_state_set_cb, dialog);
+  gtk_widget_set_sensitive (widget, sensitive);
+}
 
 void
 cc_build_edit_dialog (CcNotificationsPanel *panel,
                       GAppInfo             *app,
-                      GSettings            *settings)
+                      GSettings            *settings,
+                      GSettings            *master_settings)
 {
-  GtkWindow *shell;
-  GtkDialog *win;
-  GtkWidget *content_area;
-  GtkGrid *content_grid;
-  int i;
+  GtkBuilder *builder;
+  GtkWindow  *shell;
+  GtkWidget  *dialog;
+  GtkWidget  *listbox;
+  GError     *error = NULL;
+  gchar      *objects[] = { "edit-dialog", NULL };
+  guint       builder_result;
+
+  builder = gtk_builder_new ();
+  builder_result = gtk_builder_add_objects_from_resource (builder,
+                                                          
"/org/gnome/control-center/notifications/edit-dialog.ui",
+                                                          objects,
+                                                          &error);
+
+  if (builder_result == 0)
+    {
+      g_warning ("Could not load ui: %s", error->message);
+      g_error_free (error);
+      g_object_unref (builder);
+      return;
+    }
 
   shell = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (panel)));
 
-  win = g_object_new (GTK_TYPE_DIALOG,
-                      "modal", TRUE,
-                      "title", g_app_info_get_name (app),
-                      "width-request", 450,
-                      "transient-for", shell,
-                      "resizable", FALSE,
-                      "use-header-bar", TRUE,
-                      NULL);
-
-  content_area = gtk_dialog_get_content_area (win);
-  content_grid = GTK_GRID (gtk_grid_new ());
-  g_object_set (content_grid,
-                "row-spacing", 10,
-                "margin-top", 12,
-                "margin-start", 15,
-                "margin-end", 15,
-                "margin-bottom", 12,
+  dialog = GTK_WIDGET (gtk_builder_get_object (builder, "edit-dialog"));
+
+  g_object_set (dialog,
+                "title", g_app_info_get_name (app),
+                "transient-for", shell,
                 NULL);
-  gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET (content_grid));
 
-  for (i = 0; i < G_N_ELEMENTS (policy_settings); i++)
-    {
-      GtkWidget *label;
-      GtkWidget *_switch;
-
-      label = gtk_label_new (g_dpgettext2 (GETTEXT_PACKAGE,
-                                           "notifications",
-                                           policy_settings[i].label));
-      g_object_set (label,
-                    "xalign", 0.0,
-                    "hexpand", TRUE,
-                    NULL);
-
-      if (policy_settings[i].bold)
-        {
-          PangoAttrList *list;
-          PangoAttribute *weight;
-          list = pango_attr_list_new ();
-          weight = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
-
-          pango_attr_list_insert (list, weight);
-          gtk_label_set_attributes (GTK_LABEL (label), list);
-
-          pango_attr_list_unref (list);
-        }
-
-      _switch = gtk_switch_new ();
-      gtk_label_set_mnemonic_widget (GTK_LABEL (label), _switch);
-      g_settings_bind (settings, policy_settings[i].setting_key,
-                       _switch, "active",
-                       G_SETTINGS_BIND_DEFAULT);
-
-      gtk_grid_attach (content_grid, GTK_WIDGET (label),
-                       0, i, 1, 1);
-      gtk_grid_attach (content_grid, _switch,
-                       1, i, 1, 1);
-    }
+  listbox = GTK_WIDGET (gtk_builder_get_object (builder,
+                                                "main-listbox"));
+
+  gtk_list_box_set_header_func (GTK_LIST_BOX (listbox),
+                                cc_list_box_update_header_func,
+                                NULL, NULL);
+
+  /*
+   * Store builder, settings and master_settings to the dialog so we can
+   * access them from callbacks easily.
+   */
+  g_object_set_data_full (G_OBJECT (dialog),
+                          "builder",
+                          builder,
+                          g_object_unref);
+
+  g_object_set_data_full (G_OBJECT (dialog),
+                          "settings",
+                          g_object_ref (settings),
+                          g_object_unref);
+
+  g_object_set_data_full (G_OBJECT (dialog),
+                          "master-settings",
+                          g_object_ref (master_settings),
+                          g_object_unref);
+
+  /* Connect signals */
+  gtk_builder_add_callback_symbols (builder,
+                                    "notifications_switch_state_set_cb",
+                                    G_CALLBACK (notifications_switch_state_set_cb),
+                                    "sound_alerts_switch_state_set_cb",
+                                    G_CALLBACK (sound_alerts_switch_state_set_cb),
+                                    "notification_banners_switch_state_set_cb",
+                                    G_CALLBACK (notification_banners_switch_state_set_cb),
+                                    "notification_banners_content_switch_state_set_cb",
+                                    G_CALLBACK (notification_banners_content_switch_state_set_cb),
+                                    "lock_screen_notifications_switch_state_set_cb",
+                                    G_CALLBACK (lock_screen_notifications_switch_state_set_cb),
+                                    "lock_screen_content_switch_state_set_cb",
+                                    G_CALLBACK (lock_screen_content_switch_state_set_cb),
+                                    NULL);
+
+  gtk_builder_connect_signals (builder, dialog);
+
+  /* Init states of switches */
+  update_switches (dialog);
 
-  g_signal_connect (win, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-  gtk_widget_show_all (GTK_WIDGET (win));
+  /* Show the dialog */
+  gtk_widget_show_all (dialog);
 }
diff --git a/panels/notifications/cc-edit-dialog.h b/panels/notifications/cc-edit-dialog.h
index 1633f0d..fdd73ac 100644
--- a/panels/notifications/cc-edit-dialog.h
+++ b/panels/notifications/cc-edit-dialog.h
@@ -24,7 +24,10 @@
 
 G_BEGIN_DECLS
 
-void cc_build_edit_dialog (CcNotificationsPanel *panel, GAppInfo *app, GSettings *settings);
+void cc_build_edit_dialog (CcNotificationsPanel *panel,
+                           GAppInfo             *app,
+                           GSettings            *settings,
+                           GSettings            *master_settings);
 
 G_END_DECLS
 
diff --git a/panels/notifications/cc-notifications-panel.c b/panels/notifications/cc-notifications-panel.c
index 00df0b1..75dd712 100644
--- a/panels/notifications/cc-notifications-panel.c
+++ b/panels/notifications/cc-notifications-panel.c
@@ -514,7 +514,7 @@ select_app (GtkListBox           *list_box,
   Application *app;
 
   app = g_object_get_qdata (G_OBJECT (row), application_quark ());
-  cc_build_edit_dialog (panel, app->app_info, app->settings);
+  cc_build_edit_dialog (panel, app->app_info, app->settings, panel->master_settings);
 }
 
 static void
diff --git a/panels/notifications/edit-dialog.ui b/panels/notifications/edit-dialog.ui
new file mode 100644
index 0000000..d23ac07
--- /dev/null
+++ b/panels/notifications/edit-dialog.ui
@@ -0,0 +1,352 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <object class="GtkDialog" id="edit-dialog">
+    <property name="width_request">450</property>
+    <property name="can_focus">False</property>
+    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="type_hint">dialog</property>
+    <property name="use_header_bar">1</property>
+    <signal name="response" handler="gtk_widget_destroy" swapped="no"/>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="edit-dialog-vbox">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <property name="border_width">0</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="edit-dialog-action-area">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkListBox" id="main-listbox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="selection_mode">none</property>
+            <property name="activate_on_single_click">False</property>
+            <child>
+              <object class="GtkListBoxRow" id="notifications-listboxrow">
+                <property name="width_request">100</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="activatable">False</property>
+                <property name="selectable">False</property>
+                <child>
+                  <object class="GtkBox" id="notifications-box">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_start">15</property>
+                    <property name="margin_end">15</property>
+                    <property name="margin_top">12</property>
+                    <property name="margin_bottom">12</property>
+                    <child>
+                      <object class="GtkLabel" id="notifications-label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes" context="notifications" comments="This is 
the per application switch for message tray usage.">Notifications</property>
+                        <property name="mnemonic_widget">notifications-switch</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSwitch" id="notifications-switch">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="halign">end</property>
+                        <property name="valign">center</property>
+                        <property name="active">True</property>
+                        <signal name="notify::active" handler="notifications_switch_state_set_cb" 
swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkListBoxRow" id="sound-alerts-listboxrow">
+                <property name="width_request">100</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="activatable">False</property>
+                <property name="selectable">False</property>
+                <child>
+                  <object class="GtkBox" id="sound-alerts-box">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_start">15</property>
+                    <property name="margin_end">15</property>
+                    <property name="margin_top">12</property>
+                    <property name="margin_bottom">12</property>
+                    <child>
+                      <object class="GtkLabel" id="sound-alerts-label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <property name="xalign">0</property>
+                        <property name="margin_end">15</property>
+                        <property name="label" translatable="yes" context="notifications" comments="This is 
the setting to configure sounds associated with notifications.">Sound Alerts</property>
+                        <property name="mnemonic_widget">sound-alerts-switch</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSwitch" id="sound-alerts-switch">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="halign">end</property>
+                        <property name="valign">center</property>
+                        <signal name="notify::active" handler="sound_alerts_switch_state_set_cb" 
swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkListBoxRow" id="notification-banners-listboxrow">
+                <property name="width_request">100</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="activatable">False</property>
+                <property name="selectable">False</property>
+                <child>
+                  <object class="GtkBox" id="notification-banners-box">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_start">15</property>
+                    <property name="margin_end">15</property>
+                    <property name="margin_top">12</property>
+                    <property name="margin_bottom">12</property>
+                    <child>
+                      <object class="GtkLabel" id="notification-banners-label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <property name="xalign">0</property>
+                        <property name="margin_end">15</property>
+                        <property name="label" translatable="yes" context="notifications">Notification 
Banners</property>
+                        <property name="mnemonic_widget">notification-banners-switch</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSwitch" id="notification-banners-switch">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="halign">end</property>
+                        <property name="valign">center</property>
+                        <signal name="notify::active" handler="notification_banners_switch_state_set_cb" 
swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkListBoxRow" id="notification-banners-content-listboxrow">
+                <property name="width_request">100</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="activatable">False</property>
+                <property name="selectable">False</property>
+                <child>
+                  <object class="GtkBox" id="notification-banners-content-box">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_start">15</property>
+                    <property name="margin_end">15</property>
+                    <property name="margin_top">12</property>
+                    <property name="margin_bottom">12</property>
+                    <child>
+                      <object class="GtkLabel" id="notification-banners-content-label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <property name="xalign">0</property>
+                        <property name="margin_end">15</property>
+                        <property name="label" translatable="yes" context="notifications" comments="Banners 
here refers to message tray notifications in the middle of the screen.">Show Message Content in 
Banners</property>
+                        <property name="mnemonic_widget">notification-banners-content-switch</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSwitch" id="notification-banners-content-switch">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="halign">end</property>
+                        <property name="valign">center</property>
+                        <signal name="notify::active" 
handler="notification_banners_content_switch_state_set_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkListBoxRow" id="lock-screen-notifications-listboxrow">
+                <property name="width_request">100</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="activatable">False</property>
+                <property name="selectable">False</property>
+                <child>
+                  <object class="GtkBox" id="lock-screen-notifications-box">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_start">15</property>
+                    <property name="margin_end">15</property>
+                    <property name="margin_top">12</property>
+                    <property name="margin_bottom">12</property>
+                    <child>
+                      <object class="GtkLabel" id="lock-screen-notifications-label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <property name="xalign">0</property>
+                        <property name="margin_end">15</property>
+                        <property name="label" translatable="yes" context="notifications">Lock Screen 
Notifications</property>
+                        <property name="mnemonic_widget">lock-screen-notifications-switch</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSwitch" id="lock-screen-notifications-switch">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="halign">end</property>
+                        <property name="valign">center</property>
+                        <signal name="notify::active" 
handler="lock_screen_notifications_switch_state_set_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkListBoxRow" id="lock-screen-content-listboxrow">
+                <property name="width_request">100</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="activatable">False</property>
+                <property name="selectable">False</property>
+                <child>
+                  <object class="GtkBox" id="lock-screen-content-box">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_start">15</property>
+                    <property name="margin_end">15</property>
+                    <property name="margin_top">12</property>
+                    <property name="margin_bottom">12</property>
+                    <child>
+                      <object class="GtkLabel" id="lock-screen-content-label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <property name="xalign">0</property>
+                        <property name="margin_end">15</property>
+                        <property name="label" translatable="yes" context="notifications">Show Message 
Content on Lock Screen</property>
+                        <property name="mnemonic_widget">lock-screen-content-switch</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSwitch" id="lock-screen-content-switch">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="halign">end</property>
+                        <property name="valign">center</property>
+                        <signal name="notify::active" handler="lock_screen_content_switch_state_set_cb" 
swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/panels/notifications/notifications.gresource.xml 
b/panels/notifications/notifications.gresource.xml
index fa82dfe..8eaf36d 100644
--- a/panels/notifications/notifications.gresource.xml
+++ b/panels/notifications/notifications.gresource.xml
@@ -2,5 +2,6 @@
 <gresources>
   <gresource prefix="/org/gnome/control-center/notifications">
     <file preprocess="xml-stripblanks">notifications.ui</file>
+    <file preprocess="xml-stripblanks">edit-dialog.ui</file>
   </gresource>
 </gresources>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]