[gnome-control-center] notifications: Use CcListRow for list box rows
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] notifications: Use CcListRow for list box rows
- Date: Tue, 12 May 2020 22:27:22 +0000 (UTC)
commit 70ded401b0d94f91709487d1f2ec615af8cfa209
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date: Mon May 11 12:34:56 2020 +0530
notifications: Use CcListRow for list box rows
This will reduce the amount of code used and let the user change
the item value clicking on the row.
panels/notifications/cc-notifications-panel.c | 13 ++--
panels/notifications/cc-notifications-panel.ui | 103 ++-----------------------
2 files changed, 15 insertions(+), 101 deletions(-)
---
diff --git a/panels/notifications/cc-notifications-panel.c b/panels/notifications/cc-notifications-panel.c
index 79c1f0d1e..510d7065d 100644
--- a/panels/notifications/cc-notifications-panel.c
+++ b/panels/notifications/cc-notifications-panel.c
@@ -25,6 +25,7 @@
#include <gio/gio.h>
#include <gio/gdesktopappinfo.h>
+#include "cc-list-row.h"
#include "list-box-helper.h"
#include "cc-notifications-panel.h"
#include "cc-notifications-resources.h"
@@ -38,11 +39,11 @@ struct _CcNotificationsPanel {
CcPanel parent_instance;
GtkListBox *app_listbox;
- GtkSwitch *lock_screen_switch;
+ CcListRow *lock_screen_row;
GtkScrolledWindow *main_scrolled_window;
GtkBox *main_box;
GtkListBox *options_listbox;
- GtkSwitch *dnd_switch;
+ CcListRow *dnd_row;
GtkSizeGroup *sizegroup1;
GSettings *master_settings;
@@ -177,10 +178,10 @@ cc_notifications_panel_init (CcNotificationsPanel *panel)
panel->master_settings = g_settings_new (MASTER_SCHEMA);
g_settings_bind (panel->master_settings, "show-banners",
- panel->dnd_switch,
+ panel->dnd_row,
"active", G_SETTINGS_BIND_INVERT_BOOLEAN);
g_settings_bind (panel->master_settings, "show-in-lock-screen",
- panel->lock_screen_switch,
+ panel->lock_screen_row,
"active", G_SETTINGS_BIND_DEFAULT);
panel->focus_adjustment = gtk_scrolled_window_get_vadjustment (panel->main_scrolled_window);
@@ -237,11 +238,11 @@ cc_notifications_panel_class_init (CcNotificationsPanelClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/control-center/notifications/cc-notifications-panel.ui");
gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, app_listbox);
- gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, lock_screen_switch);
+ gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, lock_screen_row);
gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, main_scrolled_window);
gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, main_box);
gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, options_listbox);
- gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, dnd_switch);
+ gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, dnd_row);
gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, sizegroup1);
gtk_widget_class_bind_template_callback (widget_class, keynav_failed);
diff --git a/panels/notifications/cc-notifications-panel.ui b/panels/notifications/cc-notifications-panel.ui
index d3df1806d..527e03b53 100644
--- a/panels/notifications/cc-notifications-panel.ui
+++ b/panels/notifications/cc-notifications-panel.ui
@@ -42,108 +42,21 @@
<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>
<signal name="keynav-failed" handler="keynav_failed"
object="CcNotificationsPanel" swapped="yes" />
<child>
- <object class="GtkListBoxRow">
+ <object class="CcListRow" id="dnd_row">
<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">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">center</property>
- <child>
- <object class="GtkLabel">
- <property name="height_request">32</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="margin_top">8</property>
- <property name="margin_bottom">8</property>
- <property name="hexpand">True</property>
- <property name="ellipsize">end</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Do Not Disturb</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">dnd_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="dnd_switch">
- <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>
+ <property name="title" translatable="yes">_Do Not Disturb</property>
+ <property name="use-underline">True</property>
+ <property name="show-switch">True</property>
</object>
</child>
<child>
- <object class="GtkListBoxRow">
+ <object class="CcListRow" id="lock_screen_row">
<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">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">center</property>
- <child>
- <object class="GtkLabel">
- <property name="height_request">32</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="margin_top">8</property>
- <property name="margin_bottom">8</property>
- <property name="hexpand">True</property>
- <property name="ellipsize">end</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Lock Screen
Notifications</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">lock_screen_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_switch">
- <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>
+ <property name="title" translatable="yes">_Lock Screen
Notifications</property>
+ <property name="use-underline">True</property>
+ <property name="show-switch">True</property>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]