[gnome-screensaver] Adapt to recent GDK changes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-screensaver] Adapt to recent GDK changes
- Date: Wed, 22 Dec 2010 15:07:32 +0000 (UTC)
commit 92ea9734ffc2cca32d231eac097a9f27f2f6b5e0
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Dec 22 10:06:07 2010 -0500
Adapt to recent GDK changes
Don't use gdk_spawn APIs anymore. Also, drop gdkx_visual_get and
use the correct command to open power preferences. Bump the gtk
dep to 2.91.7.
configure.ac | 4 +-
src/gnome-screensaver-preferences.c | 58 ++++++++++------------------------
src/gs-job.c | 23 ++++++-------
src/gs-lock-plug.c | 4 +--
src/gs-visual-gl.c | 2 +-
src/gs-window-x11.c | 31 ++++++++++--------
6 files changed, 49 insertions(+), 73 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5009fe4..ac41467 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,8 +40,8 @@ GLIB_GSETTINGS
DBUS_REQUIRED_VERSION=0.30
GLIB_REQUIRED_VERSION=2.15.0
-GDK_REQUIRED_VERSION=2.90.7
-GTK_REQUIRED_VERSION=2.90.7
+GDK_REQUIRED_VERSION=2.91.7
+GTK_REQUIRED_VERSION=2.91.7
X11_REQUIRED_VERSION=1.0
LIBGNOME_MENU_REQUIRED_VERSION=2.11.1
GNOME_DESKTOP_REQUIRED_VERSION=2.91.2
diff --git a/src/gnome-screensaver-preferences.c b/src/gnome-screensaver-preferences.c
index 89faf5f..b98bbb8 100644
--- a/src/gnome-screensaver-preferences.c
+++ b/src/gnome-screensaver-preferences.c
@@ -56,7 +56,7 @@
#define KEY_CYCLE_DELAY "cycle-delay"
#define KEY_THEMES "themes"
-#define GPM_COMMAND "gnome-power-preferences"
+#define GPM_COMMAND "gnome-control-center power"
enum {
NAME_COLUMN = 0,
@@ -398,38 +398,10 @@ preview_set_theme (GtkWidget *widget,
static void
help_display (void)
{
- GError *error = NULL;
- char *command;
- const char *lang;
- char *uri = NULL;
- GdkScreen *gscreen;
- int i;
-
- const char * const * langs = g_get_language_names ();
-
- for (i = 0; langs[i] != NULL; i++) {
- lang = langs[i];
- if (strchr (lang, '.')) {
- continue;
- }
-
- uri = g_build_filename (DATADIR,
- "/gnome/help/user-guide/",
- lang,
- "/user-guide.xml",
- NULL);
-
- if (g_file_test (uri, G_FILE_TEST_EXISTS)) {
- break;
- }
- }
+ GError *error;
- command = g_strconcat ("gnome-open ghelp://",
- uri,
- "?prefs-screensaver",
- NULL);
- gscreen = gdk_screen_get_default ();
- gdk_spawn_command_line_on_screen (gscreen, command, &error);
+ error = NULL;
+ gtk_show_uri (NULL, "ghelp:prefs-screensaver", GDK_CURRENT_TIME, &error);
if (error != NULL) {
GtkWidget *d;
@@ -442,9 +414,6 @@ help_display (void)
gtk_widget_destroy (d);
g_error_free (error);
}
-
- g_free (command);
- g_free (uri);
}
static void
@@ -455,18 +424,25 @@ response_cb (GtkWidget *widget,
if (response_id == GTK_RESPONSE_HELP) {
help_display ();
} else if (response_id == GTK_RESPONSE_REJECT) {
+ GAppInfo *appinfo;
+ GAppLaunchContext *context;
GError *error;
- gboolean res;
error = NULL;
- res = gdk_spawn_command_line_on_screen (gdk_screen_get_default (),
- GPM_COMMAND,
- &error);
- if (! res) {
+ context = gdk_app_launch_context_new ();
+ appinfo = g_app_info_create_from_commandline (GPM_COMMAND, "Power preferences", 0, &error);
+ if (appinfo) {
+ g_app_info_launch (appinfo, NULL, context, &error);
+ }
+
+ if (error) {
g_warning ("Unable to start power management preferences: %s", error->message);
g_error_free (error);
}
+
+ g_object_unref (context);
+ g_object_unref (appinfo);
} else {
gtk_widget_destroy (widget);
gtk_main_quit ();
@@ -1278,7 +1254,7 @@ get_best_visual (void)
VisualID visual_id;
visual_id = (VisualID) v;
- visual = gdkx_visual_get (visual_id);
+ visual = gdk_x11_screen_lookup_visual (gdk_screen_get_default (), visual_id);
g_debug ("Found best visual for GL: 0x%x",
(unsigned int) visual_id);
diff --git a/src/gs-job.c b/src/gs-job.c
index 9f6b912..fe4f924 100644
--- a/src/gs-job.c
+++ b/src/gs-job.c
@@ -318,18 +318,17 @@ spawn_on_widget (GtkWidget *widget,
env = get_env_vars (widget);
error = NULL;
- result = gdk_spawn_on_screen_with_pipes (gtk_widget_get_screen (widget),
- NULL,
- argv,
- (char **)env->pdata,
- G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
- NULL,
- NULL,
- &child_pid,
- NULL,
- NULL,
- &standard_error,
- &error);
+ result = g_spawn_async_with_pipes (NULL,
+ argv,
+ (char **)env->pdata,
+ G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
+ NULL,
+ NULL,
+ &child_pid,
+ NULL,
+ NULL,
+ &standard_error,
+ &error);
for (i = 0; i < env->len; i++) {
g_free (g_ptr_array_index (env, i));
}
diff --git a/src/gs-lock-plug.c b/src/gs-lock-plug.c
index 20a0eda..68b4158 100644
--- a/src/gs-lock-plug.c
+++ b/src/gs-lock-plug.c
@@ -161,9 +161,7 @@ do_user_switch (GSLockPlug *plug)
GDM_FLEXISERVER_ARGS);
error = NULL;
- res = gdk_spawn_command_line_on_screen (gdk_screen_get_default (),
- command,
- &error);
+ res = g_spawn_command_line_async (command, &error);
g_free (command);
diff --git a/src/gs-visual-gl.c b/src/gs-visual-gl.c
index 4bb77d6..ed382b5 100644
--- a/src/gs-visual-gl.c
+++ b/src/gs-visual-gl.c
@@ -90,7 +90,7 @@ gs_visual_gl_get_best_for_screen (GdkScreen *screen)
vid = XVisualIDFromVisual (vi->visual);
- visual = gdkx_visual_get (vid);
+ visual = gdk_x11_screen_lookup_visual (screen, vid);
XFree (vi);
diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c
index eaaba36..abbe379 100644
--- a/src/gs-window-x11.c
+++ b/src/gs-window-x11.c
@@ -497,7 +497,7 @@ get_best_visual_for_screen (GdkScreen *screen)
VisualID visual_id;
visual_id = (VisualID) v;
- visual = gdkx_visual_get (visual_id);
+ visual = gdk_x11_screen_lookup_visual (screen, visual_id);
gs_debug ("Found best GL visual for screen %d: 0x%x",
gdk_screen_get_number (screen),
@@ -625,7 +625,7 @@ x11_window_is_ours (Window window)
ret = FALSE;
- gwindow = gdk_window_lookup (window);
+ gwindow = gdk_x11_window_lookup_for_display (gdk_display_get_default (), window);
if (gwindow && (window != GDK_ROOT_WINDOW ())) {
ret = TRUE;
}
@@ -960,6 +960,7 @@ spawn_on_window (GSWindow *window,
{
int argc;
char **argv;
+ char **envp;
GError *error;
gboolean result;
GIOChannel *channel;
@@ -975,19 +976,20 @@ spawn_on_window (GSWindow *window,
return FALSE;
}
+ envp = spawn_make_environment_for_screen (gtk_window_get_screen (GTK_WINDOW (window)), NULL);
+
error = NULL;
- result = gdk_spawn_on_screen_with_pipes (gtk_window_get_screen (GTK_WINDOW (window)),
- NULL,
- argv,
- NULL,
- G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,
- NULL,
- NULL,
- &child_pid,
- NULL,
- &standard_output,
- &standard_error,
- &error);
+ result = g_spawn_async_with_pipes (NULL,
+ argv,
+ envp,
+ G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,
+ NULL,
+ NULL,
+ &child_pid,
+ NULL,
+ &standard_output,
+ &standard_error,
+ &error);
if (! result) {
gs_debug ("Could not start command '%s': %s", command, error->message);
@@ -1030,6 +1032,7 @@ spawn_on_window (GSWindow *window,
g_io_channel_unref (channel);
g_strfreev (argv);
+ g_strfreev (envp);
return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]