Commit a830ab3e authored by Mohammed Sadiq's avatar Mohammed Sadiq
Browse files

Merge branch 'librem5-3-24' into pureos/sloppy

parents 09f08da1 b150a45e
......@@ -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,6 +39,8 @@ struct _CcNotificationsPanel {
CcPanel parent_instance;
GtkListBox *app_listbox;
CcListRow *do_not_disturb_row;
HdyComboRow *feedback_combo_row;
GtkSwitch *lock_screen_switch;
GtkScrolledWindow *main_scrolled_window;
GtkBox *main_box;
......@@ -46,6 +49,7 @@ struct _CcNotificationsPanel {
GtkSizeGroup *sizegroup1;
GSettings *master_settings;
GSettings *feedback_settings;
GCancellable *apps_load_cancellable;
......@@ -73,6 +77,12 @@ typedef struct {
CcNotificationsPanel *panel;
} Application;
enum {
NOTIFICATION_SOUND_AND_VIBRATION = 0,
NOTIFICATION_VIBRATION_ONLY = 1,
NOTIFICATION_SILENT = 2
};
static void build_app_store (CcNotificationsPanel *panel);
static void select_app (CcNotificationsPanel *panel, GtkListBoxRow *row);
static int sort_apps (gconstpointer one, gconstpointer two, gpointer user_data);
......@@ -85,6 +95,7 @@ cc_notifications_panel_dispose (GObject *object)
CcNotificationsPanel *panel = CC_NOTIFICATIONS_PANEL (object);
g_clear_object (&panel->master_settings);
g_clear_object (&panel->feedback_settings);
g_clear_pointer (&panel->known_applications, g_hash_table_unref);
g_clear_pointer (&panel->sections, g_list_free);
g_clear_pointer (&panel->sections_reverse, g_list_free);
......@@ -167,6 +178,92 @@ on_perm_store_ready (GObject *source_object,
self->perm_store = proxy;
}
static void
feedback_row_changed_cb (CcNotificationsPanel *panel)
{
const char *value;
gint index;
if (!panel->feedback_settings)
return;
index = hdy_combo_row_get_selected_index (panel->feedback_combo_row);
if (index == NOTIFICATION_SILENT)
value = "quiet";
else if (index == NOTIFICATION_VIBRATION_ONLY)
value = "silent";
else
value = "full";
g_settings_set_string (panel->feedback_settings, "profile", value);
}
static void
do_not_disturb_changed_cb (CcNotificationsPanel *panel)
{
gboolean active;
gint index;
if (!panel->feedback_settings)
return;
active = cc_list_row_get_active (panel->do_not_disturb_row);
index = hdy_combo_row_get_selected_index (panel->feedback_combo_row);
if (active && index != NOTIFICATION_SILENT)
hdy_combo_row_set_selected_index (panel->feedback_combo_row, NOTIFICATION_SILENT);
}
static void
notifications_row_init (CcNotificationsPanel *panel)
{
GSettingsSchemaSource *schema_source;
g_autoptr(GSettingsSchema) schema = NULL;
GListStore *list_store;
HdyValueObject *obj;
g_autofree char *value = NULL;
gint index;
list_store = g_list_store_new (HDY_TYPE_VALUE_OBJECT);
obj = hdy_value_object_new_string (_("Sound and Vibration"));
g_list_store_insert (list_store, NOTIFICATION_SOUND_AND_VIBRATION, obj);
g_clear_object (&obj);
obj = hdy_value_object_new_string (_("Vibration only"));
g_list_store_insert (list_store, NOTIFICATION_VIBRATION_ONLY, obj);
g_clear_object (&obj);
obj = hdy_value_object_new_string (_("Silent"));
g_list_store_insert (list_store, NOTIFICATION_SILENT, obj);
g_clear_object (&obj);
hdy_combo_row_bind_name_model (panel->feedback_combo_row, G_LIST_MODEL (list_store),
(HdyComboRowGetNameFunc) hdy_value_object_dup_string,
NULL, NULL);
schema_source = g_settings_schema_source_get_default ();
schema = g_settings_schema_source_lookup (schema_source, "org.sigxcpu.feedbackd", FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (panel->feedback_combo_row), schema != NULL);
if (!schema)
return;
panel->feedback_settings = g_settings_new ("org.sigxcpu.feedbackd");
value = g_settings_get_string (panel->feedback_settings, "profile");
if (g_str_equal (value, "silent"))
index = NOTIFICATION_VIBRATION_ONLY;
else if (g_str_equal (value, "quiet"))
index = NOTIFICATION_SILENT;
else
index = 0;
hdy_combo_row_set_selected_index (panel->feedback_combo_row, index);
}
static void
cc_notifications_panel_init (CcNotificationsPanel *panel)
{
......@@ -179,9 +276,13 @@ cc_notifications_panel_init (CcNotificationsPanel *panel)
panel->master_settings = g_settings_new (MASTER_SCHEMA);
notifications_row_init (panel);
g_settings_bind (panel->master_settings, "show-banners",
panel->popups_switch,
"active", G_SETTINGS_BIND_DEFAULT);
panel->do_not_disturb_row,
"active", G_SETTINGS_BIND_INVERT_BOOLEAN);
g_signal_connect_object (panel->do_not_disturb_row, "notify::active",
G_CALLBACK (do_not_disturb_changed_cb), panel,
G_CONNECT_SWAPPED);
g_settings_bind (panel->master_settings, "show-in-lock-screen",
panel->lock_screen_switch,
"active", G_SETTINGS_BIND_DEFAULT);
......@@ -240,6 +341,8 @@ 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, do_not_disturb_row);
gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, feedback_combo_row);
gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, lock_screen_switch);
gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, main_scrolled_window);
gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, main_box);
......@@ -249,6 +352,7 @@ cc_notifications_panel_class_init (CcNotificationsPanelClass *klass)
gtk_widget_class_bind_template_callback (widget_class, keynav_failed);
gtk_widget_class_bind_template_callback (widget_class, select_app);
gtk_widget_class_bind_template_callback (widget_class, feedback_row_changed_cb);
}
static inline GQuark
......
......@@ -42,11 +42,27 @@
<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>
<property name="activate_on_single_click">True</property>
<signal name="keynav-failed" handler="keynav_failed" object="CcNotificationsPanel" swapped="yes" />
<child>
<object class="GtkListBoxRow">
<object class="CcListRow" id="do_not_disturb_row">
<property name="visible">True</property>
<property name="show-switch">True</property>
<property name="title" translatable="yes">Do Not Disturb</property>
<property name="subtitle" translatable="yes">Only urgent notifications are shown</property>
</object>
</child>
<child>
<object class="HdyComboRow" id="feedback_combo_row">
<property name="visible">True</property>
<property name="title" translatable="yes">Notification Feedback</property>
<property name="subtitle" translatable="yes">What happens when notifications come in</property>
<signal name="notify::selected-index" handler="feedback_row_changed_cb" swapped="yes"/>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="visible">False</property>
<property name="can_focus">True</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
......@@ -67,9 +83,7 @@
<property name="hexpand">True</property>
<property name="ellipsize">end</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Notification _Popups</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">popups_switch</property>
<property name="label" translatable="yes">Do Not Disturb</property>
</object>
<packing>
<property name="expand">False</property>
......
......@@ -47,9 +47,21 @@
* of #CcWwanData changes when SIM is changed.
*/
/* Priority for connections. larger the number, lower the priority */
#define CC_WWAN_DNS_PRIORITY_LOW (20)
#define CC_WWAN_DNS_PRIORITY_HIGH (15)
/**
* Priority for connections. larger the number, lower the priority
* https://developer.gnome.org/NetworkManager/stable/nm-settings.html:
*
* A lower value is better (higher priority). Zero selects a globally
* configured default value. If the latter is missing or zero too, it
* defaults to 50 for VPNs and 100 for other connections.
*
* Since WiFi and other network connections will likely get the default
* setting of 100, set WWAN DNS priorities higher than the default, with
* room to allow multiple modems to set priority above/below each other.
*/
#define CC_WWAN_DNS_PRIORITY_LOW (120)
#define CC_WWAN_DNS_PRIORITY_HIGH (115)
/* These are to be set as route metric */
#define CC_WWAN_ROUTE_PRIORITY_LOW (1050)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment