Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
cffedf6d
Commit
cffedf6d
authored
13 years ago
by
Tristan Matthews
Browse files
Options
Downloads
Patches
Plain Diff
* #9688: gnome: screensaver_uninhibit must verify that the cookie has been set
parent
0db8a567
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
gnome/src/dbus/dbus.c
+45
-42
45 additions, 42 deletions
gnome/src/dbus/dbus.c
with
45 additions
and
42 deletions
gnome/src/dbus/dbus.c
+
45
−
42
View file @
cffedf6d
...
...
@@ -628,8 +628,10 @@ gboolean dbus_connect_session_manager(DBusGConnection *connection)
}
*/
g_dbus_proxy_new_for_bus
(
G_BUS_TYPE_SESSION
,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES
,
NULL
,
GS_SERVICE
,
GS_PATH
,
GS_INTERFACE
,
NULL
,
screensaver_dbus_proxy_new_cb
,
NULL
);
g_dbus_proxy_new_for_bus
(
G_BUS_TYPE_SESSION
,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES
,
NULL
,
GS_SERVICE
,
GS_PATH
,
GS_INTERFACE
,
NULL
,
screensaver_dbus_proxy_new_cb
,
NULL
);
DEBUG
(
"DBUS: Connected to gnome session manager"
);
...
...
@@ -1891,16 +1893,13 @@ dbus_send_text_message(const gchar *callID, const gchar *message)
static
guint
cookie
;
#define GNOME_SESSION_NO_IDLE_FLAG 8
static
void
screensaver_inhibit_cb
(
GObject
*
source_object
,
GAsyncResult
*
res
,
gpointer
user_data
UNUSED
)
static
void
screensaver_inhibit_cb
(
GObject
*
source_object
,
GAsyncResult
*
res
,
gpointer
user_data
UNUSED
)
{
DEBUG
(
"Screensaver: Inhibit callback"
);
DEBUG
(
__PRETTY_FUNCTION__
);
GDBusProxy
*
proxy
=
G_DBUS_PROXY
(
source_object
);
// ScreenSaver *screensaver = (ScreenSaver *) user_data;
GVariant
*
value
;
GError
*
error
=
NULL
;
value
=
g_dbus_proxy_call_finish
(
proxy
,
res
,
&
error
);
GVariant
*
value
=
g_dbus_proxy_call_finish
(
proxy
,
res
,
&
error
);
if
(
!
value
)
{
ERROR
(
"Screensaver: Error: inhibiting the screensaver: %s"
,
error
->
message
);
g_error_free
(
error
);
...
...
@@ -1916,18 +1915,18 @@ static void screensaver_inhibit_cb (GObject * source_object, GAsyncResult * res,
g_variant_unref
(
value
);
}
static
void
screensaver_uninhibit_cb
(
GObject
*
source_object
,
GAsyncResult
*
res
,
gpointer
user_data
UNUSED
)
static
void
screensaver_uninhibit_cb
(
GObject
*
source_object
,
GAsyncResult
*
res
,
gpointer
user_data
UNUSED
)
{
DEBUG
(
"Screensaver: Uninhibit callback"
);
DEBUG
(
__PRETTY_FUNCTION__
);
GDBusProxy
*
proxy
=
G_DBUS_PROXY
(
source_object
);
// ScreenSaver *screensaver = (ScreenSaver *) user_data;
GVariant
*
value
;
GError
*
error
=
NULL
;
value
=
g_dbus_proxy_call_finish
(
proxy
,
res
,
&
error
);
GVariant
*
value
=
g_dbus_proxy_call_finish
(
proxy
,
res
,
&
error
);
if
(
!
value
)
{
ERROR
(
"Screensaver: Error uninhibiting the screensaver: %s"
,
error
->
message
);
ERROR
(
"Screensaver: Error uninhibiting the screensaver: %s"
,
error
->
message
);
g_error_free
(
error
);
return
;
}
...
...
@@ -1935,42 +1934,46 @@ static void screensaver_uninhibit_cb (GObject * source_object, GAsyncResult * re
/* clear the cookie */
cookie
=
0
;
g_variant_unref
(
value
);
}
void
dbus_screensaver_inhibit
(
void
)
{
guint
xid
=
0
;
DEBUG
(
"Screensaver: inhibit"
);
const
gchar
*
appname
=
g_get_application_name
();
if
(
appname
==
NULL
)
{
ERROR
(
"Screensaver: Could not retr
e
ive application name"
);
ERROR
(
"Screensaver: Could not retri
e
ve application name"
);
return
;
}
GVariant
*
parameters
=
g_variant_new
(
"(susu)"
,
appname
,
xid
,
"Phone call ongoing"
,
GNOME_SESSION_NO_IDLE_FLAG
);
guint
xid
=
0
;
GVariant
*
parameters
=
g_variant_new
(
"(susu)"
,
appname
,
xid
,
"Phone call ongoing"
,
GNOME_SESSION_NO_IDLE_FLAG
);
if
(
parameters
==
NULL
)
{
ERROR
(
"Screensaver: Could not create session manager inhibit parameters"
);
return
;
}
g_dbus_proxy_call
(
session_manager_proxy
,
"Inhibit"
,
parameters
,
G_DBUS_CALL_FLAGS_NO_AUTO_START
,
-
1
,
NULL
,
screensaver_inhibit_cb
,
NULL
);
G_DBUS_CALL_FLAGS_NO_AUTO_START
,
-
1
,
NULL
,
screensaver_inhibit_cb
,
NULL
);
}
void
dbus_screensaver_uninhibit
(
void
)
{
if
(
cookie
==
0
)
return
;
DEBUG
(
"Screensaver: uninhibit"
);
GVariant
*
parameters
=
g_variant_new
(
"(u)"
,
cookie
);
if
(
parameters
==
NULL
)
{
ERROR
(
"Screensaver: Could not create session manager uninhibit parameters"
);
ERROR
(
"Screensaver: Could not create session manager uninhibit "
"parameters"
);
return
;
}
;
}
g_dbus_proxy_call
(
session_manager_proxy
,
"Uninhibit"
,
g_variant_new
(
"(u)"
,
cookie
),
G_DBUS_CALL_FLAGS_NO_AUTO_START
,
-
1
,
NULL
,
screensaver_uninhibit_cb
,
NULL
);
g_dbus_proxy_call
(
session_manager_proxy
,
"Uninhibit"
,
g_variant_new
(
"(u)"
,
cookie
),
G_DBUS_CALL_FLAGS_NO_AUTO_START
,
-
1
,
NULL
,
screensaver_uninhibit_cb
,
NULL
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment