summaryrefslogtreecommitdiff
path: root/libnautilus-private
diff options
context:
space:
mode:
Diffstat (limited to 'libnautilus-private')
-rw-r--r--libnautilus-private/Makefile.am16
-rw-r--r--libnautilus-private/egg-screen-exec.c260
-rw-r--r--libnautilus-private/egg-screen-exec.h46
-rw-r--r--libnautilus-private/egg-screen-help.c487
-rw-r--r--libnautilus-private/egg-screen-help.h75
-rw-r--r--libnautilus-private/egg-screen-url.c183
-rw-r--r--libnautilus-private/egg-screen-url.h44
-rw-r--r--libnautilus-private/nautilus-directory-background.c69
-rw-r--r--libnautilus-private/nautilus-dnd.c11
-rw-r--r--libnautilus-private/nautilus-dnd.h6
-rw-r--r--libnautilus-private/nautilus-icon-canvas-item.c6
-rw-r--r--libnautilus-private/nautilus-icon-container.c16
-rw-r--r--libnautilus-private/nautilus-icon-dnd.c26
-rw-r--r--libnautilus-private/nautilus-icon-dnd.h5
-rw-r--r--libnautilus-private/nautilus-program-chooser.c24
-rw-r--r--libnautilus-private/nautilus-program-choosing.c36
-rw-r--r--libnautilus-private/nautilus-program-choosing.h10
-rwxr-xr-xlibnautilus-private/update-from-egg.sh25
18 files changed, 1264 insertions, 81 deletions
diff --git a/libnautilus-private/Makefile.am b/libnautilus-private/Makefile.am
index 81346b5c7..b67b8a606 100644
--- a/libnautilus-private/Makefile.am
+++ b/libnautilus-private/Makefile.am
@@ -35,6 +35,15 @@ marshal_sources = \
nautilus-marshal-guts.c \
$(NULL)
+EGGFILES = \
+ egg-screen-exec.h \
+ egg-screen-exec.c \
+ egg-screen-url.h \
+ egg-screen-url.c \
+ egg-screen-help.h \
+ egg-screen-help.c \
+ $(NULL)
+
libnautilus_private_la_SOURCES = \
$(nautilus_metafile_server_idl_sources) \
eggtreemultidnd.c \
@@ -162,6 +171,7 @@ libnautilus_private_la_SOURCES = \
nautilus-view-identifier.h \
nautilus-volume-monitor.c \
nautilus-volume-monitor.h \
+ $(EGGFILES) \
$(NULL)
fsattributesdir = $(datadir)/nautilus
@@ -197,6 +207,7 @@ EXTRA_DIST = \
$(fsattributes_DATA) \
nautilus-metafile-server.idl \
nautilus-marshal.list \
+ update-from-egg.sh \
$(schema_DATA) \
$(NULL)
@@ -208,3 +219,8 @@ CLEANFILES = \
dist-hook:
cd $(distdir); rm -f $(CLEANFILES)
+
+EGGDIR = $(srcdir)/../../libegg/libegg/screen-exec
+
+regenerate-built-sources:
+ EGGFILES="$(EGGFILES)" EGGDIR="$(EGGDIR)" $(srcdir)/update-from-egg.sh
diff --git a/libnautilus-private/egg-screen-exec.c b/libnautilus-private/egg-screen-exec.c
new file mode 100644
index 000000000..94a068e36
--- /dev/null
+++ b/libnautilus-private/egg-screen-exec.c
@@ -0,0 +1,260 @@
+/* egg-screen-exec.c
+ *
+ * Copyright (C) 2002 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Mark McLoughlin <mark@skynet.ie>
+ */
+
+#include <config.h>
+
+#include "egg-screen-exec.h"
+
+#include <string.h>
+#include <libgnome/gnome-exec.h>
+
+#ifndef HAVE_GTK_MULTIHEAD
+#include <gdk/gdkx.h>
+#endif
+
+extern char **environ;
+
+/**
+ * egg_screen_exec_display_string:
+ * @screen: A #GdkScreen
+ *
+ * Description: Returns a string that when passed to XOpenDisplay()
+ * would cause @screen to be the default screen on the newly opened
+ * X display. This string is suitable for setting $DISPLAY when
+ * launching an application which should appear on @screen.
+ *
+ * Returns: a newly allocated string or %NULL on error.
+ **/
+char *
+egg_screen_exec_display_string (GdkScreen *screen)
+{
+#ifdef HAVE_GTK_MULTIHEAD
+ GString *str;
+ const char *old_display;
+ char *retval;
+ char *p;
+
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+
+ if (gdk_screen_get_default () == screen)
+ return g_strdup_printf ("DISPLAY=%s",
+ gdk_display_get_name (
+ gdk_screen_get_display (screen)));
+
+ old_display = gdk_display_get_name (gdk_screen_get_display (screen));
+
+ str = g_string_new ("DISPLAY=");
+ g_string_append (str, old_display);
+
+ p = strrchr (str->str, '.');
+ if (p && p > strchr (str->str, ':'))
+ g_string_truncate (str, p - str->str);
+
+ g_string_append_printf (str, ".%d", gdk_screen_get_number (screen));
+
+ retval = str->str;
+
+ g_string_free (str, FALSE);
+
+ return retval;
+#else
+ return g_strdup (DisplayString (GDK_DISPLAY ()));
+#endif
+}
+
+/**
+ * egg_screen_exec_environment:
+ * @screen: A #GdkScreen
+ *
+ * Description: Modifies the current program environment to
+ * ensure that $DISPLAY is set such that a launched application
+ * inheriting this environment would appear on @screen.
+ *
+ * Returns: a newly-allocated %NULL-terminated array of strings or
+ * %NULL on error. Use g_strfreev() to free it.
+ **/
+char **
+egg_screen_exec_environment (GdkScreen *screen)
+{
+ char **retval = NULL;
+ int i;
+#ifdef HAVE_GTK_MULTIHEAD
+ int display_index = -1;
+
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+
+ for (i = 0; environ [i]; i++)
+ if (!strncmp (environ [i], "DISPLAY", 7))
+ display_index = i;
+
+ if (display_index == -1)
+ display_index = i++;
+#else
+ for (i = 0; environ [i]; i++);
+#endif
+
+ retval = g_new (char *, i + 1);
+
+ for (i = 0; environ [i]; i++)
+#ifdef HAVE_GTK_MULTIHEAD
+ if (i == display_index)
+ retval [i] = egg_screen_exec_display_string (screen);
+ else
+#endif
+ retval [i] = g_strdup (environ [i]);
+
+ retval [i] = NULL;
+
+ return retval;
+}
+
+/**
+ * egg_screen_execute_async:
+ * @screen: A #GdkScreen
+ * @dir: Directory in which child should be executed, or %NULL for current
+ * directory
+ * @argc: Number of arguments
+ * @argv: Argument vector to exec child
+ *
+ * Description: Like gnome_execute_async(), but ensures that the child
+ * is launched in an environment such that if it calls XOpenDisplay()
+ * the resulting display would have @screen as the default screen.
+ *
+ * Returns: process id of child, or %-1 on error.
+ **/
+int
+egg_screen_execute_async (GdkScreen *screen,
+ const char *dir,
+ int argc,
+ char * const argv [])
+{
+#ifdef HAVE_GTK_MULTIHEAD
+ char **envp = NULL;
+ int envc = 0;
+ int retval;
+
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
+
+ if (gdk_screen_get_default () != screen) {
+ envc = 1;
+ envp = g_new0 (char *, 2);
+ envp [0] = egg_screen_exec_display_string (screen);
+ }
+
+ retval = gnome_execute_async_with_env (dir, argc, argv, envc, envp);
+
+ g_strfreev (envp);
+
+ return retval;
+#else
+ return gnome_execute_async (dir, argc, argv);
+#endif
+}
+
+/**
+ * egg_screen_execute_shell:
+ * @screen: A #GdkScreen.
+ * @dir: Directory in which child should be executed, or %NULL for current
+ * directory
+ * @commandline: Shell command to execute
+ *
+ * Description: Like gnome_execute_shell(), but ensures that the child
+ * is launched in an environment such that if it calls XOpenDisplay()
+ * the resulting display would have @screen as the default screen.
+ *
+ * Returns: process id of shell, or %-1 on error.
+ **/
+int
+egg_screen_execute_shell (GdkScreen *screen,
+ const char *dir,
+ const char *command)
+{
+#ifdef HAVE_GTK_MULTIHEAD
+ int retval = -1;
+
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
+
+ if (gdk_screen_get_default () == screen)
+ retval = gnome_execute_shell (dir, command);
+
+ else {
+ char *exec;
+ char *display;
+
+ display = egg_screen_exec_display_string (screen);
+ exec = g_strconcat (display, " ", command, NULL);
+
+ retval = gnome_execute_shell (dir, exec);
+
+ g_free (display);
+ g_free (exec);
+ }
+
+ return retval;
+#else
+ return gnome_execute_shell (dir, command);
+#endif
+}
+
+/**
+ * egg_screen_execute_command_line_async:
+ * @screen: A #GdkScreen.
+ * @command_line: a command line
+ * @error: return location for errors
+ *
+ * Description: Like g_spawn_command_line_async(), but ensures that
+ * the child is launched in an environment such that if it calls
+ * XOpenDisplay() the resulting display would have @screen as the
+ * default screen.
+ *
+ * Returns: %TRUE on success, %FALSE if error is set.
+ **/
+gboolean
+egg_screen_execute_command_line_async (GdkScreen *screen,
+ const char *command,
+ GError **error)
+{
+#ifdef HAVE_GTK_MULTIHEAD
+ gboolean retval;
+ char **argv = NULL;
+ char **envp = NULL;
+
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
+ g_return_val_if_fail (command != NULL, FALSE);
+
+ if (!g_shell_parse_argv (command, NULL, &argv, error))
+ return FALSE;
+
+ if (gdk_screen_get_default () != screen)
+ envp = egg_screen_exec_environment (screen);
+
+ retval = g_spawn_async (g_get_home_dir (),
+ argv, envp, G_SPAWN_SEARCH_PATH,
+ NULL, NULL, NULL, error);
+ g_strfreev (argv);
+ g_strfreev (envp);
+
+ return retval;
+#else
+ return g_spawn_command_line_async (command, error);
+#endif
+}
diff --git a/libnautilus-private/egg-screen-exec.h b/libnautilus-private/egg-screen-exec.h
new file mode 100644
index 000000000..65a6df021
--- /dev/null
+++ b/libnautilus-private/egg-screen-exec.h
@@ -0,0 +1,46 @@
+/* egg-screen-exec.h
+ *
+ * Copyright (C) 2002 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Mark McLoughlin <mark@skynet.ie>
+ */
+
+#ifndef __EGG_SCREEN_EXEC_H__
+#define __EGG_SCREEN_EXEC_H__
+
+#include <gdk/gdk.h>
+
+G_BEGIN_DECLS
+
+char *egg_screen_exec_display_string (GdkScreen *screen);
+char **egg_screen_exec_environment (GdkScreen *screen);
+
+int egg_screen_execute_async (GdkScreen *screen,
+ const char *dir,
+ int argc,
+ char * const argv []);
+int egg_screen_execute_shell (GdkScreen *screen,
+ const char *dir,
+ const char *command);
+gboolean egg_screen_execute_command_line_async (GdkScreen *screen,
+ const char *command,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __EGG_SCREEN_EXEC_H__ */
diff --git a/libnautilus-private/egg-screen-help.c b/libnautilus-private/egg-screen-help.c
new file mode 100644
index 000000000..fd8bb77cf
--- /dev/null
+++ b/libnautilus-private/egg-screen-help.c
@@ -0,0 +1,487 @@
+/* egg-screen-help.c
+ * Copyright (C) 2001 Sid Vicious
+ * Copyright (C) 2001 Jonathan Blandford <jrb@alum.mit.edu>
+ * Copyright (C) 2002 Sun Microsystems Inc.
+ * All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Cambridge, MA 02139, USA.
+ *
+ * Authors: Mark McLoughlin <mark@skynet.ie>
+ */
+
+#include <config.h>
+
+#include "egg-screen-help.h"
+
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <glib.h>
+#include <libgnome/gnome-help.h>
+#include <libgnome/gnome-program.h>
+#include <libgnome/gnome-i18n.h>
+
+#include "egg-screen-url.h"
+#include "egg-screen-exec.h"
+
+/******* START COPIED + PASTED CODE TO GO AWAY ******/
+
+/* The _with_env methods need to go into and
+ * be exposed from libgnome. They can then be
+ * removed from here.
+ */
+
+/**
+ * egg_help_display_uri_with_env:
+ * @help_uri: The URI to display.
+ * @envp: child's environment, or %NULL to inherit parent's.
+ * @error: return location for errors.
+ *
+ * Description: Like gnome_help_display_uri, except that the help viewer
+ * application is launched with its environment set to the contents of
+ * @envp.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise (in which case @error will
+ * contain the actual error).
+ **/
+gboolean
+egg_help_display_uri_with_env (const char *help_uri,
+ char **envp,
+ GError **error)
+{
+ GError *real_error;
+ gboolean retval;
+
+ real_error = NULL;
+ retval = egg_url_show_with_env (help_uri, envp, &real_error);
+
+ if (real_error != NULL)
+ g_propagate_error (error, real_error);
+
+ return retval;
+}
+
+static char *
+locate_help_file (const char *path, const char *doc_name)
+{
+ int i;
+ char *exts[] = { ".xml", ".docbook", ".sgml", ".html", "", NULL };
+ const GList *lang_list = gnome_i18n_get_language_list ("LC_MESSAGES");
+
+ for (;lang_list != NULL; lang_list = lang_list->next) {
+ const char *lang = lang_list->data;
+
+ /* This has to be a valid language AND a language with
+ * no encoding postfix. The language will come up without
+ * encoding next */
+ if (lang == NULL ||
+ strchr (lang, '.') != NULL)
+ continue;
+
+ for (i = 0; exts[i] != NULL; i++) {
+ char *name;
+ char *full;
+
+ name = g_strconcat (doc_name, exts[i], NULL);
+ full = g_build_filename (path, lang, name, NULL);
+ g_free (name);
+
+ if (g_file_test (full, G_FILE_TEST_EXISTS))
+ return full;
+
+ g_free (full);
+ }
+ }
+
+ return NULL;
+}
+
+/**
+ * egg_help_display_with_doc_id_with_env:
+ * @program: The current application object, or %NULL for the default one.
+ * @doc_id: The document identifier, or %NULL to default to the application ID
+ * (app_id) of the specified @program.
+ * @file_name: The name of the help document to display.
+ * @link_id: Can be %NULL. If set, refers to an anchor or section id within the
+ * requested document.
+ * @envp: child's environment, or %NULL to inherit parent's.
+ * @error: A #GError instance that will hold the specifics of any error which
+ * occurs during processing, or %NULL
+ *
+ * Description: Like gnome_help_display_with_doc_id(), except that the help
+ * viewer application is launched with its environment set to the contents
+ * of @envp.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise (in which case @error will
+ * contain the actual error).
+ **/
+gboolean
+egg_help_display_with_doc_id_with_env (GnomeProgram *program,
+ const char *doc_id,
+ const char *file_name,
+ const char *link_id,
+ char **envp,
+ GError **error)
+{
+ gchar *local_help_path;
+ gchar *global_help_path;
+ gchar *file;
+ struct stat local_help_st;
+ struct stat global_help_st;
+ gchar *uri;
+ gboolean retval;
+
+ g_return_val_if_fail (file_name != NULL, FALSE);
+
+ retval = FALSE;
+
+ local_help_path = NULL;
+ global_help_path = NULL;
+ file = NULL;
+ uri = NULL;
+
+ if (program == NULL)
+ program = gnome_program_get ();
+
+ if (doc_id == NULL)
+ doc_id = gnome_program_get_app_id (program);
+
+ /* Compute the local and global help paths */
+
+ local_help_path = gnome_program_locate_file (program,
+ GNOME_FILE_DOMAIN_APP_HELP,
+ "",
+ FALSE /* only_if_exists */,
+ NULL /* ret_locations */);
+
+ if (local_help_path == NULL) {
+ g_set_error (error,
+ GNOME_HELP_ERROR,
+ GNOME_HELP_ERROR_INTERNAL,
+ _("Unable to find the GNOME_FILE_DOMAIN_APP_HELP domain"));
+ goto out;
+ }
+
+ global_help_path = gnome_program_locate_file (program,
+ GNOME_FILE_DOMAIN_HELP,
+ "",
+ FALSE /* only_if_exists */,
+ NULL /* ret_locations */);
+ if (global_help_path == NULL) {
+ g_set_error (error,
+ GNOME_HELP_ERROR,
+ GNOME_HELP_ERROR_INTERNAL,
+ _("Unable to find the GNOME_FILE_DOMAIN_HELP domain."));
+ goto out;
+ }
+
+ /* Try to access the help paths, first the app-specific help path
+ * and then falling back to the global help path if the first one fails.
+ */
+
+ if (stat (local_help_path, &local_help_st) == 0) {
+ if (!S_ISDIR (local_help_st.st_mode)) {
+ g_set_error (error,
+ GNOME_HELP_ERROR,
+ GNOME_HELP_ERROR_NOT_FOUND,
+ _("Unable to show help as %s is not a directory. "
+ "Please check your installation."),
+ local_help_path);
+ goto out;
+ }
+
+ file = locate_help_file (local_help_path, file_name);
+ }
+
+ if (file == NULL) {
+ if (stat (global_help_path, &global_help_st) == 0) {
+ if (!S_ISDIR (global_help_st.st_mode)) {
+ g_set_error (error,
+ GNOME_HELP_ERROR,
+ GNOME_HELP_ERROR_NOT_FOUND,
+ _("Unable to show help as %s is not a directory. "
+ "Please check your installation."),
+ global_help_path);
+ goto out;
+ }
+ } else {
+ g_set_error (error,
+ GNOME_HELP_ERROR,
+ GNOME_HELP_ERROR_NOT_FOUND,
+ _("Unable to find the help files in either %s "
+ "or %s. Please check your installation"),
+ local_help_path,
+ global_help_path);
+ goto out;
+ }
+
+ if (!(local_help_st.st_dev == global_help_st.st_dev
+ && local_help_st.st_ino == global_help_st.st_ino))
+ file = locate_help_file (global_help_path, file_name);
+ }
+
+ if (file == NULL) {
+ g_set_error (error,
+ GNOME_HELP_ERROR,
+ GNOME_HELP_ERROR_NOT_FOUND,
+ _("Unable to find the help files in either %s "
+ "or %s. Please check your installation"),
+ local_help_path,
+ global_help_path);
+ goto out;
+ }
+
+ /* Now that we have a file name, try to display it in the help browser */
+
+ if (link_id)
+ uri = g_strconcat ("ghelp://", file, "?", link_id, NULL);
+ else
+ uri = g_strconcat ("ghelp://", file, NULL);
+
+ retval = egg_help_display_uri_with_env (uri, envp, error);
+
+ out:
+
+ g_free (local_help_path);
+ g_free (global_help_path);
+ g_free (file);
+ g_free (uri);
+
+ return retval;
+}
+
+/**
+ * egg_help_display_desktop_with_env:
+ * @program: The current application object, or %NULL for the default one.
+ * @doc_id: The name of the help file relative to the system's help domain
+ * (#GNOME_FILE_DOMAIN_HELP).
+ * @file_name: The name of the help document to display.
+ * @link_id: Can be %NULL. If set, refers to an anchor or section id within the
+ * requested document.
+ * @envp: child's environment, or %NULL to inherit parent's.
+ * @error: A #GError instance that will hold the specifics of any error which
+ * occurs during processing, or %NULL
+ *
+ * Description: Like gnome_help_display_desktop(), except that the help
+ * viewer application is launched with its environment set to the contents
+ * of @envp.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise (in which case @error will
+ * contain the actual error).
+ **/
+gboolean
+egg_help_display_desktop_with_env (GnomeProgram *program,
+ const char *doc_id,
+ const char *file_name,
+ const char *link_id,
+ char **envp,
+ GError **error)
+{
+ GSList *ret_locations, *li;
+ char *file;
+ gboolean retval;
+ char *url;
+
+ g_return_val_if_fail (doc_id != NULL, FALSE);
+ g_return_val_if_fail (file_name != NULL, FALSE);
+
+ if (program == NULL)
+ program = gnome_program_get ();
+
+ ret_locations = NULL;
+ gnome_program_locate_file (program,
+ GNOME_FILE_DOMAIN_HELP,
+ doc_id,
+ FALSE /* only_if_exists */,
+ &ret_locations);
+
+ if (ret_locations == NULL) {
+ g_set_error (error,
+ GNOME_HELP_ERROR,
+ GNOME_HELP_ERROR_NOT_FOUND,
+ _("Unable to find doc_id %s in the help path"),
+ doc_id);
+ return FALSE;
+ }
+
+ file = NULL;
+ for (li = ret_locations; li != NULL; li = li->next) {
+ char *path = li->data;
+
+ file = locate_help_file (path, file_name);
+ if (file != NULL)
+ break;
+ }
+
+ g_slist_foreach (ret_locations, (GFunc)g_free, NULL);
+ g_slist_free (ret_locations);
+
+ if (file == NULL) {
+ g_set_error (error,
+ GNOME_HELP_ERROR,
+ GNOME_HELP_ERROR_NOT_FOUND,
+ _("Help document %s/%s not found"),
+ doc_id,
+ file_name);
+ return FALSE;
+ }
+
+ if (link_id != NULL) {
+ url = g_strconcat ("ghelp://", file, "?", link_id, NULL);
+ } else {
+ url = g_strconcat ("ghelp://", file, NULL);
+ }
+
+ g_free (file);
+
+ retval = egg_help_display_uri_with_env (url, envp, error);
+
+ return retval;
+}
+/******* END COPIED + PASTED CODE TO GO AWAY ******/
+
+/**
+ * egg_screen_help_display:
+ * @screen: a #GdkScreen.
+ * @file_name: The name of the help document to display.
+ * @link_id: Can be %NULL. If set, refers to an anchor or section id within the
+ * requested document.
+ * @error: A #GError instance that will hold the specifics of any error which
+ * occurs during processing, or %NULL
+ *
+ * Description: Like gnome_help_display(), but ensures that the help viewer
+ * application appears on @screen.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise (in which case @error will
+ * contain the actual error).
+ **/
+gboolean
+egg_screen_help_display (GdkScreen *screen,
+ const char *file_name,
+ const char *link_id,
+ GError **error)
+{
+ return egg_screen_help_display_with_doc_id (
+ screen, NULL, NULL, file_name, link_id, error);
+}
+
+/**
+ * egg_screen_help_display_with_doc_id
+ * @screen: a #GdkScreen.
+ * @program: The current application object, or %NULL for the default one.
+ * @doc_id: The document identifier, or %NULL to default to the application ID
+ * (app_id) of the specified @program.
+ * @file_name: The name of the help document to display.
+ * @link_id: Can be %NULL. If set, refers to an anchor or section id within the
+ * requested document.
+ * @error: A #GError instance that will hold the specifics of any error which
+ * occurs during processing, or %NULL
+ *
+ * Description: Like gnome_help_display_with_doc_id(), but ensures that the help
+ * viewer application appears on @screen.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise (in which case @error will
+ * contain the actual error).
+ **/
+gboolean
+egg_screen_help_display_with_doc_id (GdkScreen *screen,
+ GnomeProgram *program,
+ const char *doc_id,
+ const char *file_name,
+ const char *link_id,
+ GError **error)
+{
+ gboolean retval;
+ char **env;
+
+ env = egg_screen_exec_environment (screen);
+
+ retval = egg_help_display_with_doc_id_with_env (
+ program, doc_id, file_name, link_id, env, error);
+
+ g_strfreev (env);
+
+ return retval;
+}
+
+/**
+ * egg_screen_help_display_desktop
+ * @screen: a #GdkScreen.
+ * @program: The current application object, or %NULL for the default one.
+ * @doc_id: The name of the help file relative to the system's help domain
+ * (#GNOME_FILE_DOMAIN_HELP).
+ * @file_name: The name of the help document to display.
+ * @link_id: Can be %NULL. If set, refers to an anchor or section id within the
+ * requested document.
+ * @error: A #GError instance that will hold the specifics of any error which
+ * occurs during processing, or %NULL
+ *
+ * Description: Like gnome_help_display_desktop(), but ensures that the help
+ * viewer application appears on @screen.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise (in which case @error will
+ * contain the actual error).
+ **/
+gboolean
+egg_screen_help_display_desktop (GdkScreen *screen,
+ GnomeProgram *program,
+ const char *doc_id,
+ const char *file_name,
+ const char *link_id,
+ GError **error)
+{
+ gboolean retval;
+ char **env;
+
+ env = egg_screen_exec_environment (screen);
+
+ retval = egg_help_display_desktop_with_env (
+ program, doc_id, file_name, link_id, env, error);
+
+ g_strfreev (env);
+
+ return retval;
+}
+
+/**
+ * egg_screen_help_display_uri
+ * @screen: a #GdkScreen.
+ * @help_uri: The URI to display.
+ * @error: A #GError instance that will hold the specifics of any error which
+ * occurs during processing, or %NULL
+ *
+ * Description: Like gnome_help_display_uri(), but ensures that the help viewer
+ * application appears on @screen.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise (in which case @error will
+ * contain the actual error).
+ **/
+gboolean
+egg_screen_help_display_uri (GdkScreen *screen,
+ const char *help_uri,
+ GError **error)
+{
+ gboolean retval;
+ char **env;
+
+ env = egg_screen_exec_environment (screen);
+
+ retval = egg_help_display_uri_with_env (help_uri, env, error);
+
+ g_strfreev (env);
+
+ return retval;
+}
diff --git a/libnautilus-private/egg-screen-help.h b/libnautilus-private/egg-screen-help.h
new file mode 100644
index 000000000..5be7e9749
--- /dev/null
+++ b/libnautilus-private/egg-screen-help.h
@@ -0,0 +1,75 @@
+/* egg-screen-help.h
+ *
+ * Copyright (C) 2002 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Mark McLoughlin <mark@skynet.ie>
+ */
+
+#ifndef __EGG_SCREEN_HELP_H__
+#define __EGG_SCREEN_HELP_H__
+
+#include <glib.h>
+#include <gdk/gdk.h>
+#include <libgnome/gnome-program.h>
+
+G_BEGIN_DECLS
+
+/* Destined for libgnome.
+ */
+gboolean egg_help_display_uri_with_env (const char *help_uri,
+ char **envp,
+ GError **error);
+gboolean egg_help_display_with_doc_id_with_env (GnomeProgram *program,
+ const char *doc_id,
+ const char *file_name,
+ const char *link_id,
+ char **envp,
+ GError **error);
+gboolean egg_help_display_desktop_with_env (GnomeProgram *program,
+ const char *doc_id,
+ const char *file_name,
+ const char *link_id,
+ char **envp,
+ GError **error);
+
+/* Destined for libgnomeui.
+ */
+gboolean egg_screen_help_display (GdkScreen *screen,
+ const char *file_name,
+ const char *link_id,
+ GError **error);
+gboolean egg_screen_help_display_with_doc_id (GdkScreen *screen,
+ GnomeProgram *program,
+ const char *doc_id,
+ const char *file_name,
+ const char *link_id,
+ GError **error);
+gboolean egg_screen_help_display_desktop (GdkScreen *screen,
+ GnomeProgram *program,
+ const char *doc_id,
+ const char *file_name,
+ const char *link_id,
+ GError **error);
+gboolean egg_screen_help_display_uri (GdkScreen *screen,
+ const char *help_uri,
+ GError **error);
+
+
+G_END_DECLS
+
+#endif /* __EGG_SCREEN_HELP_H__ */
diff --git a/libnautilus-private/egg-screen-url.c b/libnautilus-private/egg-screen-url.c
new file mode 100644
index 000000000..729fa5d78
--- /dev/null
+++ b/libnautilus-private/egg-screen-url.c
@@ -0,0 +1,183 @@
+/* egg-screen-url.c
+ * Copyright (C) 1998, James Henstridge <james@daa.com.au>
+ * Copyright (C) 1999, 2000 Red Hat, Inc.
+ * Copyright (C) 2002, Sun Microsystems Inc.
+ * All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Cambridge, MA 02139, USA.
+ *
+ * Authors: Mark McLoughlin <mark@skynet.ie>
+ */
+
+#include <config.h>
+
+#include "egg-screen-url.h"
+
+#include <string.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <gconf/gconf-client.h>
+#include <libgnome/gnome-url.h>
+
+#include "egg-screen-exec.h"
+
+/******* START COPIED + PASTED CODE TO GO AWAY ******/
+
+#define URL_HANDLER_DIR "/desktop/gnome/url-handlers/"
+#define DEFAULT_HANDLER_PATH "/desktop/gnome/url-handlers/unknown/command"
+
+/* This needs to be exposed from libgnome and
+ * removed from here.
+ */
+
+/**
+ * egg_url_show_with_env:
+ * @url: The url to display. Should begin with the protocol to use (e.g.
+ * "http:", "ghelp:", etc)
+ * @envp: child's environment, or %NULL to inherit parent's.
+ * @error: Used to store any errors that result from trying to display the @url.
+ *
+ * Description: Like gnome_url_show(), except that the viewer application
+ * is launched with its environment set to the contents of @envp.
+ *
+ * Returns: %TRUE if everything went fine, %FALSE otherwise (in which case
+ * @error will contain the actual error).
+ **/
+gboolean
+egg_url_show_with_env (const char *url,
+ char **envp,
+ GError **error)
+{
+ GConfClient *client;
+ gint i;
+ gchar *pos, *template;
+ int argc;
+ char **argv;
+ gboolean ret;
+
+ g_return_val_if_fail (url != NULL, FALSE);
+
+ pos = strchr (url, ':');
+
+ client = gconf_client_get_default ();
+
+ if (pos != NULL) {
+ gchar *protocol, *path;
+
+ g_return_val_if_fail (pos >= url, FALSE);
+
+ protocol = g_new (gchar, pos - url + 1);
+ strncpy (protocol, url, pos - url);
+ protocol[pos - url] = '\0';
+ g_ascii_strdown (protocol, -1);
+
+ path = g_strconcat (URL_HANDLER_DIR, protocol, "/command", NULL);
+ template = gconf_client_get_string (client, path, NULL);
+
+ if (template == NULL) {
+ gchar* template_temp;
+
+ template_temp = gconf_client_get_string (client,
+ DEFAULT_HANDLER_PATH,
+ NULL);
+
+ /* Retry to get the right url handler */
+ template = gconf_client_get_string (client, path, NULL);
+
+ if (template == NULL)
+ template = template_temp;
+ else
+ g_free (template_temp);
+
+ }
+
+ g_free (path);
+ g_free (protocol);
+
+ } else {
+ /* no ':' ? this shouldn't happen. Use default handler */
+ template = gconf_client_get_string (client,
+ DEFAULT_HANDLER_PATH,
+ NULL);
+ }
+
+ g_object_unref (G_OBJECT (client));
+
+ if (!g_shell_parse_argv (template,
+ &argc,
+ &argv,
+ error)) {
+ g_free (template);
+ return FALSE;
+ }
+
+ g_free (template);
+
+ for (i = 0; i < argc; i++) {
+ char *arg;
+
+ if (strcmp (argv[i], "%s") != 0)
+ continue;
+
+ arg = argv[i];
+ argv[i] = g_strdup (url);
+ g_free (arg);
+ }
+
+ /* This can return some errors */
+ ret = g_spawn_async (NULL /* working directory */,
+ argv,
+ envp,
+ G_SPAWN_SEARCH_PATH /* flags */,
+ NULL /* child_setup */,
+ NULL /* data */,
+ NULL /* child_pid */,
+ error);
+
+ g_strfreev (argv);
+
+ return ret;
+}
+/******* END COPIED + PASTED CODE TO GO AWAY ******/
+
+/**
+ * egg_screen_url_show:
+ * @screen: a #GdkScreen.
+ * @url: The url to display. Should begin with the protocol to use (e.g.
+ * "http:", "ghelp:", etc)
+ * @error: Used to store any errors that result from trying to display the @url.
+ *
+ * Description: Like gnome_url_show(), but ensures that the viewer application
+ * appears on @screen.
+ *
+ * Returns: %TRUE if everything went fine, %FALSE otherwise (in which case
+ * @error will contain the actual error).
+ **/
+gboolean
+egg_screen_url_show (GdkScreen *screen,
+ const char *url,
+ GError **error)
+{
+ char **env;
+ gboolean retval;
+
+ env = egg_screen_exec_environment (screen);
+
+ retval = egg_url_show_with_env (url, env, error);
+
+ g_strfreev (env);
+
+ return retval;
+}
diff --git a/libnautilus-private/egg-screen-url.h b/libnautilus-private/egg-screen-url.h
new file mode 100644
index 000000000..7771b0abf
--- /dev/null
+++ b/libnautilus-private/egg-screen-url.h
@@ -0,0 +1,44 @@
+/* egg-screen-url.h
+ *
+ * Copyright (C) 2002 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Mark McLoughlin <mark@skynet.ie>
+ */
+
+#ifndef __EGG_SCREEN_URL_H__
+#define __EGG_SCREEN_URL_H__
+
+#include <gdk/gdk.h>
+
+G_BEGIN_DECLS
+
+/* Destined for libgnome.
+ */
+gboolean egg_url_show_with_env (const char *url,
+ char **envp,
+ GError **error);
+
+/* Destined for libgnomeui.
+ */
+gboolean egg_screen_url_show (GdkScreen *screen,
+ const char *url,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __EGG_SCREEN_URL_H__ */
diff --git a/libnautilus-private/nautilus-directory-background.c b/libnautilus-private/nautilus-directory-background.c
index e13429c3c..fa7e956c0 100644
--- a/libnautilus-private/nautilus-directory-background.c
+++ b/libnautilus-private/nautilus-directory-background.c
@@ -81,6 +81,9 @@ desktop_background_realized (NautilusIconContainer *icon_container, void *discon
g_object_set_data (G_OBJECT (background), "icon_container", (gpointer) icon_container);
+ g_object_set_data (G_OBJECT (background), "screen",
+ gtk_widget_get_screen (GTK_WIDGET (icon_container)));
+
nautilus_file_update_desktop_pixmaps (background);
}
@@ -422,16 +425,19 @@ nautilus_file_background_receive_gconf_changes (EelBackground *background)
* (copied from gnome-source/control-panels/capplets/background-properties/render-background.c)
*/
static GdkPixmap *
-make_root_pixmap (gint width, gint height)
+make_root_pixmap (GdkScreen *screen, gint width, gint height)
{
Display *display;
- char *display_name;
+ const char *display_name;
Pixmap result;
GdkPixmap *gdk_pixmap;
+ int screen_num;
+
+ screen_num = gdk_screen_get_number (screen);
gdk_flush ();
- display_name = DisplayString (GDK_DISPLAY ());
+ display_name = gdk_display_get_name (gdk_screen_get_display (screen));
display = XOpenDisplay (display_name);
if (display == NULL) {
@@ -443,15 +449,15 @@ make_root_pixmap (gint width, gint height)
XSetCloseDownMode (display, RetainPermanent);
result = XCreatePixmap (display,
- DefaultRootWindow (display),
+ RootWindow (display, screen_num),
width, height,
- DefaultDepthOfScreen (DefaultScreenOfDisplay (GDK_DISPLAY())));
+ DefaultDepth (display, screen_num));
XCloseDisplay (display);
gdk_pixmap = gdk_pixmap_foreign_new (result);
gdk_drawable_set_colormap (GDK_DRAWABLE (gdk_pixmap),
- gdk_drawable_get_colormap (gdk_get_default_root_window ()));
+ gdk_drawable_get_colormap (gdk_screen_get_root_window (screen)));
return gdk_pixmap;
}
@@ -464,21 +470,26 @@ make_root_pixmap (gint width, gint height)
* (copied from gnome-source/control-panels/capplets/background-properties/render-background.c)
*/
static void
-set_root_pixmap (GdkPixmap *pixmap)
+set_root_pixmap (GdkPixmap *pixmap, GdkScreen *screen)
{
- int result;
- gint format;
- gulong nitems;
- gulong bytes_after;
- guchar *data_esetroot;
- Pixmap pixmap_id;
- Atom type;
+ int result;
+ gint format;
+ gulong nitems;
+ gulong bytes_after;
+ guchar *data_esetroot;
+ Pixmap pixmap_id;
+ Atom type;
+ Display *display;
+ int screen_num;
+
+ screen_num = gdk_screen_get_number (screen);
data_esetroot = NULL;
+ display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
- XGrabServer (GDK_DISPLAY());
+ XGrabServer (display);
- result = XGetWindowProperty (GDK_DISPLAY(), GDK_ROOT_WINDOW(),
+ result = XGetWindowProperty (display, RootWindow (display, screen_num),
gdk_x11_get_xatom_by_name ("ESETROOT_PMAP_ID"),
0L, 1L, False, XA_PIXMAP,
&type, &format, &nitems, &bytes_after,
@@ -487,7 +498,7 @@ set_root_pixmap (GdkPixmap *pixmap)
if (data_esetroot != NULL) {
if (result == Success && type == XA_PIXMAP && format == 32 && nitems == 1) {
gdk_error_trap_push ();
- XKillClient(GDK_DISPLAY(), *(Pixmap *)data_esetroot);
+ XKillClient (display, *(Pixmap *)data_esetroot);
gdk_flush ();
gdk_error_trap_pop ();
}
@@ -496,21 +507,21 @@ set_root_pixmap (GdkPixmap *pixmap)
pixmap_id = GDK_WINDOW_XWINDOW (pixmap);
- XChangeProperty (GDK_DISPLAY(), GDK_ROOT_WINDOW(),
+ XChangeProperty (display, RootWindow (display, screen_num),
gdk_x11_get_xatom_by_name ("ESETROOT_PMAP_ID"), XA_PIXMAP,
32, PropModeReplace,
(guchar *) &pixmap_id, 1);
- XChangeProperty (GDK_DISPLAY(), GDK_ROOT_WINDOW(),
+ XChangeProperty (display, RootWindow (display, screen_num),
gdk_x11_get_xatom_by_name ("_XROOTPMAP_ID"), XA_PIXMAP,
32, PropModeReplace,
(guchar *) &pixmap_id, 1);
- XSetWindowBackgroundPixmap (GDK_DISPLAY (), GDK_ROOT_WINDOW (), pixmap_id);
- XClearWindow (GDK_DISPLAY (), GDK_ROOT_WINDOW ());
+ XSetWindowBackgroundPixmap (display, RootWindow (display, screen_num), pixmap_id);
+ XClearWindow (display, RootWindow (display, screen_num));
- XUngrabServer (GDK_DISPLAY());
+ XUngrabServer (display);
- XFlush(GDK_DISPLAY());
+ XFlush (display);
}
static void
@@ -521,6 +532,7 @@ image_loading_done_callback (EelBackground *background, gboolean successful_load
GdkGC *gc;
GdkPixmap *pixmap;
GdkWindow *background_window;
+ GdkScreen *screen;
if (GPOINTER_TO_INT (disconnect_signal)) {
g_signal_handlers_disconnect_by_func
@@ -529,10 +541,13 @@ image_loading_done_callback (EelBackground *background, gboolean successful_load
disconnect_signal);
}
- width = gdk_screen_width ();
- height = gdk_screen_height ();
+ screen = g_object_get_data (G_OBJECT (background), "screen");
+ if (screen == NULL)
+ return;
+ width = gdk_screen_get_width (screen);
+ height = gdk_screen_get_height (screen);
- pixmap = make_root_pixmap (width, height);
+ pixmap = make_root_pixmap (screen, width, height);
if (pixmap == NULL) {
return;
}
@@ -541,7 +556,7 @@ image_loading_done_callback (EelBackground *background, gboolean successful_load
eel_background_draw_to_drawable (background, pixmap, gc, 0, 0, width, height, width, height);
g_object_unref (gc);
- set_root_pixmap (pixmap);
+ set_root_pixmap (pixmap, screen);
background_window = background_get_desktop_background_window (background);
if (background_window != NULL &&
diff --git a/libnautilus-private/nautilus-dnd.c b/libnautilus-private/nautilus-dnd.c
index 0e88b2f8d..1eb7e2dd6 100644
--- a/libnautilus-private/nautilus-dnd.c
+++ b/libnautilus-private/nautilus-dnd.c
@@ -69,16 +69,11 @@
void
nautilus_drag_init (NautilusDragInfo *drag_info,
const GtkTargetEntry *drag_types,
- int drag_type_count,
- GdkBitmap *stipple)
+ int drag_type_count)
{
drag_info->target_list = gtk_target_list_new (drag_types,
drag_type_count);
- if (stipple != NULL) {
- drag_info->stipple = g_object_ref (stipple);
- }
-
drag_info->drop_occured = FALSE;
drag_info->need_to_destroy = FALSE;
}
@@ -89,10 +84,6 @@ nautilus_drag_finalize (NautilusDragInfo *drag_info)
gtk_target_list_unref (drag_info->target_list);
nautilus_drag_destroy_selection_list (drag_info->selection_list);
- if (drag_info->stipple != NULL) {
- g_object_unref (drag_info->stipple);
- }
-
g_free (drag_info);
}
diff --git a/libnautilus-private/nautilus-dnd.h b/libnautilus-private/nautilus-dnd.h
index 6b46eb69a..04e8cd9ea 100644
--- a/libnautilus-private/nautilus-dnd.h
+++ b/libnautilus-private/nautilus-dnd.h
@@ -81,9 +81,6 @@ typedef struct {
*/
GList *selection_list;
- /* Stipple for drawing icon shadows during DnD. */
- GdkBitmap *stipple;
-
/* has the drop occured ? */
gboolean drop_occured;
@@ -106,8 +103,7 @@ typedef void (* NautilusDragEachSelectedItemIterator) (NautilusDragEachSelecte
void nautilus_drag_init (NautilusDragInfo *drag_info,
const GtkTargetEntry *drag_types,
- int drag_type_count,
- GdkBitmap *stipple);
+ int drag_type_count);
void nautilus_drag_finalize (NautilusDragInfo *drag_info);
NautilusDragSelectionItem *nautilus_drag_selection_item_new (void);
void nautilus_drag_destroy_selection_list (GList *selection_list);
diff --git a/libnautilus-private/nautilus-icon-canvas-item.c b/libnautilus-private/nautilus-icon-canvas-item.c
index 9884b1374..1ed466a56 100644
--- a/libnautilus-private/nautilus-icon-canvas-item.c
+++ b/libnautilus-private/nautilus-icon-canvas-item.c
@@ -912,6 +912,7 @@ draw_stretch_handles (NautilusIconCanvasItem *item, GdkDrawable *drawable,
GdkGC *gc;
char *knob_filename;
GdkPixbuf *knob_pixbuf;
+ GdkBitmap *stipple;
int knob_width, knob_height;
if (!item->details->show_stretch_handles) {
@@ -924,9 +925,12 @@ draw_stretch_handles (NautilusIconCanvasItem *item, GdkDrawable *drawable,
knob_pixbuf = gdk_pixbuf_new_from_file (knob_filename, NULL);
knob_width = gdk_pixbuf_get_width (knob_pixbuf);
knob_height = gdk_pixbuf_get_height (knob_pixbuf);
+
+ stipple = eel_stipple_bitmap_for_screen (
+ gdk_drawable_get_screen (GDK_DRAWABLE (drawable)));
/* first draw the box */
- gdk_gc_set_stipple (gc, eel_stipple_bitmap ());
+ gdk_gc_set_stipple (gc, stipple);
gdk_gc_set_fill (gc, GDK_STIPPLED);
gdk_draw_rectangle
(drawable, gc, FALSE,
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index a1d342b07..660627f18 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -206,10 +206,6 @@ enum {
};
static guint signals[LAST_SIGNAL];
-/* Bitmap for stippled selection rectangles. */
-static GdkBitmap *stipple;
-static char stipple_bits[] = { 0x02, 0x01 };
-
/* Functions dealing with NautilusIcons. */
static void
@@ -2482,6 +2478,7 @@ static void
realize (GtkWidget *widget)
{
GtkWindow *window;
+ GdkBitmap *stipple;
GTK_WIDGET_CLASS (parent_class)->realize (widget);
@@ -2491,6 +2488,11 @@ realize (GtkWidget *widget)
g_assert (GTK_IS_WINDOW (gtk_widget_get_toplevel (widget)));
window = GTK_WINDOW (gtk_widget_get_toplevel (widget));
gtk_window_set_focus (window, widget);
+
+ stipple = eel_stipple_bitmap_for_screen (
+ gdk_drawable_get_screen (GDK_DRAWABLE (widget->window)));
+
+ nautilus_icon_dnd_set_stipple (NAUTILUS_ICON_CONTAINER (widget), stipple);
}
static void
@@ -3471,10 +3473,6 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class)
widget_class->style_set = style_set;
widget_class->expose_event = expose_event;
- /* Initialize the stipple bitmap. */
-
- stipple = gdk_bitmap_create_from_data (NULL, stipple_bits, 2, 2);
-
eel_preferences_add_auto_enum (NAUTILUS_PREFERENCES_CLICK_POLICY,
&click_policy_auto_value);
@@ -3518,7 +3516,7 @@ nautilus_icon_container_instance_init (NautilusIconContainer *container)
container->details = details;
/* Set up DnD. */
- nautilus_icon_dnd_init (container, stipple);
+ nautilus_icon_dnd_init (container, NULL);
/* Make sure that we find out if the icons change. */
g_signal_connect_object
diff --git a/libnautilus-private/nautilus-icon-dnd.c b/libnautilus-private/nautilus-icon-dnd.c
index 7b5037286..7f0639424 100644
--- a/libnautilus-private/nautilus-icon-dnd.c
+++ b/libnautilus-private/nautilus-icon-dnd.c
@@ -98,7 +98,7 @@ create_selection_shadow (NautilusIconContainer *container,
return NULL;
}
- stipple = container->details->dnd_info->drag_info.stipple;
+ stipple = container->details->dnd_info->stipple;
g_return_val_if_fail (stipple != NULL, NULL);
canvas = EEL_CANVAS (container);
@@ -1385,6 +1385,21 @@ drag_data_received_callback (GtkWidget *widget,
}
void
+nautilus_icon_dnd_set_stipple (NautilusIconContainer *container,
+ GdkBitmap *stipple)
+{
+ if (stipple != NULL) {
+ g_object_ref (stipple);
+ }
+
+ if (container->details->dnd_info->stipple != NULL) {
+ g_object_unref (container->details->dnd_info->stipple);
+ }
+
+ container->details->dnd_info->stipple = stipple;
+}
+
+void
nautilus_icon_dnd_init (NautilusIconContainer *container,
GdkBitmap *stipple)
{
@@ -1394,7 +1409,7 @@ nautilus_icon_dnd_init (NautilusIconContainer *container,
container->details->dnd_info = g_new0 (NautilusIconDndInfo, 1);
nautilus_drag_init (&container->details->dnd_info->drag_info,
- drag_types, G_N_ELEMENTS (drag_types), stipple);
+ drag_types, G_N_ELEMENTS (drag_types));
/* Set up the widget as a drag destination.
* (But not a source, as drags starting from this widget will be
@@ -1421,6 +1436,9 @@ nautilus_icon_dnd_init (NautilusIconContainer *container,
g_signal_connect (container, "drag_leave",
G_CALLBACK (drag_leave_callback), NULL);
+ if (stipple != NULL) {
+ container->details->dnd_info->stipple = g_object_ref (stipple);
+ }
}
void
@@ -1431,6 +1449,10 @@ nautilus_icon_dnd_fini (NautilusIconContainer *container)
if (container->details->dnd_info != NULL) {
stop_auto_scroll (container);
+ if (container->details->dnd_info->stipple != NULL) {
+ g_object_unref (container->details->dnd_info->stipple);
+ }
+
nautilus_drag_finalize (&container->details->dnd_info->drag_info);
container->details->dnd_info = NULL;
}
diff --git a/libnautilus-private/nautilus-icon-dnd.h b/libnautilus-private/nautilus-icon-dnd.h
index b088e1b1d..63637eb79 100644
--- a/libnautilus-private/nautilus-icon-dnd.h
+++ b/libnautilus-private/nautilus-icon-dnd.h
@@ -36,6 +36,9 @@ typedef struct {
/* inherited drag info context */
NautilusDragInfo drag_info;
+ /* Stipple for drawing icon shadows during DnD. */
+ GdkBitmap *stipple;
+
/* Shadow for the icons being dragged. */
EelCanvasItem *shadow;
} NautilusIconDndInfo;
@@ -44,6 +47,8 @@ typedef struct {
void nautilus_icon_dnd_init (NautilusIconContainer *container,
GdkBitmap *stipple);
void nautilus_icon_dnd_fini (NautilusIconContainer *container);
+void nautilus_icon_dnd_set_stipple (NautilusIconContainer *container,
+ GdkBitmap *stipple);
void nautilus_icon_dnd_begin_drag (NautilusIconContainer *container,
GdkDragAction actions,
gint button,
diff --git a/libnautilus-private/nautilus-program-chooser.c b/libnautilus-private/nautilus-program-chooser.c
index 98aa1a542..fa931286b 100644
--- a/libnautilus-private/nautilus-program-chooser.c
+++ b/libnautilus-private/nautilus-program-chooser.c
@@ -32,6 +32,7 @@
#include "nautilus-mime-actions.h"
#include "nautilus-program-choosing.h"
#include "nautilus-view-identifier.h"
+#include "egg-screen-help.h"
#include <eel/eel-gnome-extensions.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-gtk-macros.h>
@@ -180,15 +181,13 @@ help_cb (GtkWidget *button, NautilusProgramChooser *program_chooser)
break;
}
- gnome_help_display_desktop (NULL,
- "user-guide",
- "wgosnautilus.xml",
- section,
- &error);
+ egg_screen_help_display_desktop (
+ gtk_window_get_screen (GTK_WINDOW (program_chooser)),
+ NULL, "user-guide", "wgosnautilus.xml", section, &error);
if (error) {
GtkWidget *err_dialog;
- err_dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (button)),
+ err_dialog = gtk_message_dialog_new (GTK_WINDOW (program_chooser),
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
@@ -961,10 +960,14 @@ set_default_for_item (ProgramFilePair *pair)
}
static void
-launch_mime_capplet (NautilusFile *file)
+launch_mime_capplet (NautilusFile *file,
+ GtkDialog *parent_dialog)
{
+ GdkScreen *screen;
char *command, *tmp, *mime_type, *file_name;
+ screen = gtk_window_get_screen (GTK_WINDOW (parent_dialog));
+
tmp = nautilus_file_get_mime_type (file);
mime_type = g_shell_quote (tmp);
g_free (tmp);
@@ -973,7 +976,8 @@ launch_mime_capplet (NautilusFile *file)
g_free (tmp);
command = g_strconcat (FILE_TYPES_CAPPLET_NAME, " ", mime_type, " ", file_name, NULL);
- nautilus_launch_application_from_command (FILE_TYPES_CAPPLET_NAME, command, NULL, FALSE);
+ nautilus_launch_application_from_command (screen, FILE_TYPES_CAPPLET_NAME, command, NULL, FALSE);
+
g_free (command);
g_free (file_name);
g_free (mime_type);
@@ -985,7 +989,7 @@ launch_mime_capplet_on_ok (GtkDialog *dialog, int response, gpointer callback_da
g_assert (GTK_IS_DIALOG (dialog));
if (response == GTK_RESPONSE_YES) {
- launch_mime_capplet (callback_data);
+ launch_mime_capplet (callback_data, dialog);
}
gtk_object_destroy (GTK_OBJECT (dialog));
}
@@ -998,7 +1002,7 @@ launch_mime_capplet_and_close_dialog (GtkButton *button, gpointer callback_data)
g_assert (GTK_IS_BUTTON (button));
file_pair = get_selected_program_file_pair (NAUTILUS_PROGRAM_CHOOSER (callback_data));
- launch_mime_capplet (file_pair->file);
+ launch_mime_capplet (file_pair->file, GTK_DIALOG (callback_data));
gtk_dialog_response (GTK_DIALOG (callback_data),
GTK_RESPONSE_DELETE_EVENT);
}
diff --git a/libnautilus-private/nautilus-program-choosing.c b/libnautilus-private/nautilus-program-choosing.c
index d43ef76ea..1d7b11767 100644
--- a/libnautilus-private/nautilus-program-choosing.c
+++ b/libnautilus-private/nautilus-program-choosing.c
@@ -29,6 +29,7 @@
#include "nautilus-mime-actions.h"
#include "nautilus-program-chooser.h"
#include "nautilus-global-preferences.h"
+#include "egg-screen-exec.h"
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gnome-extensions.h>
#include <eel/eel-vfs-extensions.h>
@@ -539,8 +540,9 @@ nautilus_launch_application (GnomeVFSMimeApplication *application,
NautilusFile *file,
GtkWindow *parent_window)
{
- char *parameter;
- char *uri_scheme, *uri;
+ GdkScreen *screen;
+ char *parameter;
+ char *uri_scheme, *uri;
uri_scheme = nautilus_file_get_uri_scheme (file);
@@ -586,7 +588,10 @@ nautilus_launch_application (GnomeVFSMimeApplication *application,
}
g_free (uri_scheme);
- nautilus_launch_application_from_command (application->name,
+ screen = gtk_window_get_screen (parent_window);
+
+ nautilus_launch_application_from_command (screen,
+ application->name,
application->command,
parameter,
application->requires_terminal);
@@ -607,7 +612,8 @@ nautilus_launch_application (GnomeVFSMimeApplication *application,
* @parameter: Passed as a parameter to the application as is.
*/
void
-nautilus_launch_application_from_command (const char *name,
+nautilus_launch_application_from_command (GdkScreen *screen,
+ const char *name,
const char *command_string,
const char *parameter,
gboolean use_terminal)
@@ -624,18 +630,19 @@ nautilus_launch_application_from_command (const char *name,
}
if (use_terminal) {
- eel_gnome_open_terminal (full_command);
+ eel_gnome_open_terminal_on_screen (full_command, screen);
} else {
- eel_gnome_shell_execute (full_command);
+ eel_gnome_shell_execute_on_screen (full_command, screen);
}
g_free (full_command);
}
void
-nautilus_launch_desktop_file (const char *desktop_file_uri,
- const GList *parameter_uris,
- GtkWindow *parent_window)
+nautilus_launch_desktop_file (GdkScreen *screen,
+ const char *desktop_file_uri,
+ const GList *parameter_uris,
+ GtkWindow *parent_window)
{
GError *error;
GnomeDesktopItem *ditem;
@@ -644,6 +651,7 @@ nautilus_launch_desktop_file (const char *desktop_file_uri,
char *local_path, *message;
const GList *p;
int total, count;
+ char **envp;
/* strip the leading command specifier */
if (eel_str_has_prefix (desktop_file_uri, NAUTILUS_DESKTOP_COMMAND_SPECIFIER)) {
@@ -721,6 +729,8 @@ nautilus_launch_desktop_file (const char *desktop_file_uri,
parent_window);
}
}
+
+ envp = egg_screen_exec_environment (screen);
/* we append local paths only if all parameters are local */
if (count == total) {
@@ -730,10 +740,9 @@ nautilus_launch_desktop_file (const char *desktop_file_uri,
}
error = NULL;
- gnome_desktop_item_launch (ditem, (GList *) parameter_uris,
- flags,
- &error);
-
+ gnome_desktop_item_launch_with_env (ditem, (GList *) parameter_uris,
+ flags, envp,
+ &error);
if (error != NULL) {
message = g_strconcat (_("There was an error launching the application.\n\n"
"Details: "), error->message, NULL);
@@ -747,4 +756,5 @@ nautilus_launch_desktop_file (const char *desktop_file_uri,
}
gnome_desktop_item_unref (ditem);
+ g_strfreev (envp);
}
diff --git a/libnautilus-private/nautilus-program-choosing.h b/libnautilus-private/nautilus-program-choosing.h
index 8df61f63b..65c0bd333 100644
--- a/libnautilus-private/nautilus-program-choosing.h
+++ b/libnautilus-private/nautilus-program-choosing.h
@@ -56,12 +56,14 @@ void nautilus_cancel_choose_component_for_file (NautilusFile
void nautilus_launch_application (GnomeVFSMimeApplication *application,
NautilusFile *file,
GtkWindow *parent_window);
-void nautilus_launch_application_from_command (const char *name,
+void nautilus_launch_application_from_command (GdkScreen *screen,
+ const char *name,
const char *command_string,
const char *parameter,
gboolean use_terminal);
-void nautilus_launch_desktop_file (const char *desktop_file_uri,
- const GList *parameter_uris,
- GtkWindow *parent_window);
+void nautilus_launch_desktop_file (GdkScreen *screen,
+ const char *desktop_file_uri,
+ const GList *parameter_uris,
+ GtkWindow *parent_window);
#endif /* NAUTILUS_PROGRAM_CHOOSING_H */
diff --git a/libnautilus-private/update-from-egg.sh b/libnautilus-private/update-from-egg.sh
new file mode 100755
index 000000000..9be68a9b4
--- /dev/null
+++ b/libnautilus-private/update-from-egg.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+function die() {
+ echo $*
+ exit 1
+}
+
+if test -z "$EGGDIR"; then
+ echo "Must set EGGDIR"
+ exit 1
+fi
+
+if test -z "$EGGFILES"; then
+ echo "Must set EGGFILES"
+ exit 1
+fi
+
+for FILE in $EGGFILES; do
+ if cmp -s $EGGDIR/$FILE $FILE; then
+ echo "File $FILE is unchanged"
+ else
+ cp $EGGDIR/$FILE $FILE || die "Could not move $EGGDIR/$FILE to $FILE"
+ echo "Updated $FILE"
+ fi
+done