[gnome-control-center] notifications: Move switches to a GtkListBox
- From: Marek Kašík <mkasik src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] notifications: Move switches to a GtkListBox
- Date: Tue, 20 Jan 2015 14:17:41 +0000 (UTC)
commit 1a4fdd47dc33121c68727f77f6e7b968aaf329b0
Author: Marek Kasik <mkasik redhat com>
Date: Tue Jan 20 13:25:41 2015 +0100
notifications: Move switches to a GtkListBox
Place the "Show Pop Up Banners" and "Show in Lock Screen" labels
in a list. This makes the UI easier to read.
Add frame around the list box.
https://bugzilla.gnome.org/show_bug.cgi?id=742521
panels/notifications/cc-notifications-panel.c | 29 ++---
panels/notifications/notifications.ui | 171 +++++++++++++++++--------
2 files changed, 129 insertions(+), 71 deletions(-)
---
diff --git a/panels/notifications/cc-notifications-panel.c b/panels/notifications/cc-notifications-panel.c
index db2dba0..00df0b1 100644
--- a/panels/notifications/cc-notifications-panel.c
+++ b/panels/notifications/cc-notifications-panel.c
@@ -172,13 +172,23 @@ cc_notifications_panel_init (CcNotificationsPanel *panel)
panel->focus_adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (w));
w = GTK_WIDGET (gtk_builder_get_object (panel->builder,
- "ccnotify-main-grid"));
+ "ccnotify-main-box"));
gtk_container_set_focus_vadjustment (GTK_CONTAINER (w), panel->focus_adjustment);
w = GTK_WIDGET (gtk_builder_get_object (panel->builder,
- "ccnotify-app-listbox"));
+ "ccnotify-switch-listbox"));
+ panel->sections = g_list_append (panel->sections, w);
+ panel->sections_reverse = g_list_prepend (panel->sections_reverse, w);
g_signal_connect (w, "keynav-failed", G_CALLBACK (keynav_failed), panel);
+ gtk_list_box_set_header_func (GTK_LIST_BOX (w),
+ cc_list_box_update_header_func,
+ NULL, NULL);
+ w = GTK_WIDGET (gtk_builder_get_object (panel->builder,
+ "ccnotify-app-listbox"));
+ panel->sections = g_list_append (panel->sections, w);
+ panel->sections_reverse = g_list_prepend (panel->sections_reverse, w);
+ g_signal_connect (w, "keynav-failed", G_CALLBACK (keynav_failed), panel);
gtk_list_box_set_sort_func (GTK_LIST_BOX (w), (GtkListBoxSortFunc)sort_apps, NULL, NULL);
gtk_list_box_set_header_func (GTK_LIST_BOX (w),
cc_list_box_update_header_func,
@@ -190,21 +200,6 @@ cc_notifications_panel_init (CcNotificationsPanel *panel)
build_app_store (panel);
w = GTK_WIDGET (gtk_builder_get_object (panel->builder,
- "ccnotify-switch-banners"));
- panel->sections = g_list_append (panel->sections, w);
- panel->sections_reverse = g_list_prepend (panel->sections_reverse, w);
-
- w = GTK_WIDGET (gtk_builder_get_object (panel->builder,
- "ccnotify-switch-lock-screen"));
- panel->sections = g_list_append (panel->sections, w);
- panel->sections_reverse = g_list_prepend (panel->sections_reverse, w);
-
- w = GTK_WIDGET (gtk_builder_get_object (panel->builder,
- "ccnotify-app-listbox"));
- panel->sections = g_list_append (panel->sections, w);
- panel->sections_reverse = g_list_prepend (panel->sections_reverse, w);
-
- w = GTK_WIDGET (gtk_builder_get_object (panel->builder,
"ccnotify-main-scrolled-window"));
gtk_container_add (GTK_CONTAINER (panel), w);
diff --git a/panels/notifications/notifications.ui b/panels/notifications/notifications.ui
index ea692e8..2da6f46 100644
--- a/panels/notifications/notifications.ui
+++ b/panels/notifications/notifications.ui
@@ -12,7 +12,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkGrid" id="ccnotify-main-grid">
+ <object class="GtkBox" id="ccnotify-main-box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">134</property>
@@ -20,61 +20,125 @@
<property name="margin_top">22</property>
<property name="margin_bottom">22</property>
<property name="orientation">vertical</property>
- <property name="row_spacing">10</property>
+ <property name="spacing">10</property>
<child>
- <object class="GtkLabel" id="ccnotify-label-banners">
+ <object class="GtkFrame" id="ccnotify-switchbox-frame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Show Pop Up Banners</property>
- <property name="mnemonic_widget">ccnotify-switch-banners</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="ccnotify-label-lock-screen">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Show in Lock Screen</property>
- <property name="mnemonic_widget">ccnotify-switch-lock-screen</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkSwitch" id="ccnotify-switch-banners">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkSwitch" id="ccnotify-switch-lock-screen">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkListBox" id="ccnotify-switch-listbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="selection_mode">none</property>
+ <property name="activate_on_single_click">False</property>
+ <child>
+ <object class="GtkListBoxRow" id="ccnotify-listboxrow-banners">
+ <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="ccnotify-box-banners">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">center</property>
+ <child>
+ <object class="GtkLabel" id="ccnotify-label-banners">
+ <property name="height_request">48</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="margin_start">12</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Show Pop Up Banners</property>
+ <property name="mnemonic_widget">ccnotify-switch-banners</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="ccnotify-switch-banners">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ <property name="margin_end">12</property>
+ </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="ccnotify-listboxrow-screen">
+ <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="ccnotify-box-screen">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">center</property>
+ <child>
+ <object class="GtkLabel" id="ccnotify-label-lock-screen">
+ <property name="height_request">48</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="margin_start">12</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Show in Lock Screen</property>
+ <property name="mnemonic_widget">ccnotify-switch-lock-screen</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="ccnotify-switch-lock-screen">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ <property name="margin_end">12</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label_item">
+ <placeholder/>
+ </child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -100,10 +164,9 @@
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- <property name="width">2</property>
- <property name="height">1</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]