[Xfce4-commits] [apps/xfce4-screensaver] 01/02: Notify invalid lid-switch configuration and add Resolve button (bug #14782)
noreply at xfce.org
noreply at xfce.org
Sun Oct 28 23:13:04 CET 2018
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfce4-screensaver.
commit bd8c16e580cad3abb3f0f62c514e0a5242342dd3
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Sun Oct 28 18:12:40 2018 -0400
Notify invalid lid-switch configuration and add Resolve button (bug #14782)
---
NEWS | 3 +-
src/xfce4-screensaver-preferences.c | 50 ++++++++++++++++
src/xfce4-screensaver-preferences.ui | 109 ++++++++++++++++++++++++++++++++++-
3 files changed, 158 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index 144e262..4a3ce7d 100644
--- a/NEWS
+++ b/NEWS
@@ -5,9 +5,10 @@
- Fallback to the Xfdesktop default color background (dark blue)
- UI files are now compiled and included in the binaries
- Bug Fixes:
- - Fix crash with no background placement, fix color settings (Xfce #14769)
+ - Fix crash with no background placement, fix color settings (Xfce #14769)
- Redraw the screensaver on monitor configuration events (Xfce #14796)
- Automate detection of PAM configuration, add flag to override (Xfce #14779)
+ - Notify invalid lid-switch configuration and add Resolve button (Xfce #14782)
- Fix appearance with the Adwaita GTK theme
- Fix builds on OpenBSD, build status can now be tracked on the
Xfce Build Bot: https://buildbot.xfce.alteroot.org/job/xfce4-screensaver/
diff --git a/src/xfce4-screensaver-preferences.c b/src/xfce4-screensaver-preferences.c
index 76d8f73..e2bca5c 100644
--- a/src/xfce4-screensaver-preferences.c
+++ b/src/xfce4-screensaver-preferences.c
@@ -1290,6 +1290,54 @@ setup_for_root_user (void)
gtk_widget_show (label);
}
+static void
+resolve_lid_switch_cb (GtkWidget *widget,
+ gpointer user_data)
+{
+ XfconfChannel *channel = xfconf_channel_get("xfce4-power-manager");
+ const gchar *property = "/xfce4-power-manager/logind-handle-lid-switch";
+ gboolean locked = xfconf_channel_is_property_locked(channel, property);
+ GtkWidget *infobar = GTK_WIDGET (gtk_builder_get_object (builder, "logind_lid_infobar"));
+
+ if (!locked)
+ {
+ xfconf_channel_set_bool(channel, property, FALSE);
+ gtk_widget_hide (GTK_WIDGET (infobar));
+ }
+}
+
+static void
+setup_for_lid_switch (void)
+{
+ XfconfChannel *channel = xfconf_channel_get ("xfce4-power-manager");
+ const gchar *property = "/xfce4-power-manager/logind-handle-lid-switch";
+ gboolean handled = xfconf_channel_get_bool (channel, property, FALSE);
+ gboolean locked = xfconf_channel_is_property_locked (channel, property);
+ GtkWidget *infobar;
+ GtkWidget *button;
+
+ infobar = GTK_WIDGET (gtk_builder_get_object (builder, "logind_lid_infobar"));
+ button = GTK_WIDGET (gtk_builder_get_object (builder, "logind_lid_resolve"));
+
+ if (handled)
+ {
+ gtk_widget_show (infobar);
+ if (locked)
+ {
+ gtk_widget_hide (button);
+ }
+ else
+ {
+ gtk_widget_show (button);
+ g_signal_connect (button, "clicked", G_CALLBACK (resolve_lid_switch_cb), NULL);
+ }
+ }
+ else
+ {
+ gtk_widget_hide (infobar);
+ }
+}
+
/* copied from gs-window-x11.c */
extern char **environ;
@@ -1615,6 +1663,8 @@ init_capplet (void)
g_signal_connect (preview, "draw", G_CALLBACK (preview_on_draw), NULL);
gs_job_set_widget (job, preview);
+ setup_for_lid_switch ();
+
if (check_is_root_user ())
{
setup_for_root_user ();
diff --git a/src/xfce4-screensaver-preferences.ui b/src/xfce4-screensaver-preferences.ui
index 5d0433c..41619d8 100644
--- a/src/xfce4-screensaver-preferences.ui
+++ b/src/xfce4-screensaver-preferences.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1
+<!-- Generated with glade 3.22.1
xfce4-screensaver - screensaver preferences
Copyright (C) 2018 Xfce Developers
@@ -305,6 +305,108 @@ Simon Steinbeiß
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
+ <object class="GtkInfoBar" id="logind_lid_infobar">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="logind_lid_resolve">
+ <property name="label" translatable="yes">Resolve</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child internal-child="content_area">
+ <object class="GtkBox">
+ <property name="can_focus">False</property>
+ <property name="spacing">16</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">dialog-information</property>
+ <property name="icon_size">3</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">center</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Xfce Power Manager is not configured to handle laptop lid events.</property>
+ <property name="xalign">0</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Your computer may not be locked when you close the lid.</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkBox" id="hbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -402,7 +504,7 @@ Simon Steinbeiß
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -458,6 +560,7 @@ Simon Steinbeiß
<property name="can_focus">True</property>
<property name="adjustment">adjustment1</property>
<property name="digits">0</property>
+ <property name="value_pos">bottom</property>
</object>
<packing>
<property name="expand">True</property>
@@ -555,7 +658,7 @@ Simon Steinbeiß
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list