nautilus: Add nautilus extension

Import nautilus-open-terminal.
parent 9dec32b2
......@@ -171,6 +171,35 @@ if test -z "$GTK_BUILDER_CONVERT"; then
AC_MSG_ERROR([gtk-builder-convert not found])
fi
# ******************
# Nautilus extension
# ******************
AC_ARG_WITH([nautilus-extension],
[AS_HELP_STRING([--without-nautilus-extension],[Disable nautilus extension])],
[],
[with_nautilus_extension=yes])
if test "$with_nautilus_extension" = "yes"; then
NAUTILUS_REQUIRED=3.0.0
PKG_CHECK_MODULES([NAUTILUS],[
libnautilus-extension >= $NAUTILUS_REQUIRED
gio-2.0
gio-unix-2.0
gconf-2.0
gtk+-$GTK_API_VERSION])
AC_ARG_WITH([nautilus-dir],
[AS_HELP_STRING([--with-nautilus-dir=PATH],[Nautilus extensions directory])],
[nautilusextensiondir="$withval"],
[nautilusextensiondir='${libdir}/nautilus/extensions-3.0'])
AC_SUBST([nautilusextensiondir])
fi
AM_CONDITIONAL([WITH_NAUTILUS_EXTENSION],[test "$with_nautilus_extension" = "yes"])
# ***********
# Compilation
# ***********
......@@ -223,9 +252,11 @@ echo "
gnome-terminal-$VERSION:
prefix: ${prefix}
DBus service dir: ${dbusservicedir}
source code location: ${srcdir}
compiler: ${CC}
DBus service dir: ${dbusservicedir}
Nautilus extension: ${with_nautilus_extension}
Nautilus extension dir: ${nautilusextensiondir}
using smclient: ${with_smclient}
"
......@@ -3,6 +3,10 @@ NULL =
bin_PROGRAMS = gnome-terminal-client gnome-terminal
libexec_PROGRAMS = gnome-terminal-server
if WITH_NAUTILUS_EXTENSION
nautilusextension_LTLIBRARIES = libterminal-nautilus.la
endif # WITH_NAUTILUS_EXTENSION
# Terminal server
dbusservice_DATA = org.gnome.Terminal.Factory0.service
......@@ -16,7 +20,7 @@ BUILT_SOURCES = \
terminal-gdbus-generated.h \
$(NULL)
gnome_terminal_server_SOURCES= \
gnome_terminal_server_SOURCES = \
eggshell.c \
eggshell.h \
profile-editor.c \
......@@ -186,7 +190,7 @@ gnome_terminal_client_LDADD = \
# Legacy terminal client
gnome_terminal_SOURCES= \
gnome_terminal_SOURCES = \
terminal.c \
terminal-debug.c \
terminal-debug.h \
......@@ -247,6 +251,41 @@ gnome_terminal_SOURCES += eggsmclient-osx.c
endif
endif
# Nautilus extension
libterminal_nautilus_la_SOURCES = \
nautilus.c \
terminal-defines.h \
terminal-intl.h \
terminal-nautilus.c \
terminal-nautilus.h \
$(NULL)
nodist_libterminal_nautilus_la_SOURCES = \
terminal-gdbus-generated.c \
terminal-gdbus-generated.h \
$(NULL)
libterminal_nautilus_la_CPPFLAGS = \
-DTERMINAL_COMPILATION \
-DTERM_DATADIR="\"$(datadir)\"" \
-DTERM_LOCALEDIR="\"$(datadir)/locale\"" \
-DTERM_PKGDATADIR="\"$(pkgdatadir)\"" \
-DGDK_MULTIHEAD_SAFE \
$(AM_CPPFLAGS)
libterminal_nautilus_la_CFLAGS = \
$(NAUTILUS_CFLAGS) \
$(AM_CFLAGS)
libterminal_nautilus_la_LDFLAGS = \
-module -avoid-version \
-export-symbols $(srcdir)/nautilus.symbols \
$(AM_LDFLAGS)
libterminal_nautilus_la_LIBADD = \
$(NAUTILUS_LIBS)
# Pref migrator
migrationdir = $(libexecdir)/GConf/gsettings
......@@ -308,6 +347,7 @@ EXTRA_DIST = \
terminal-type-builtins.c.template \
terminal-type-builtins.h.template \
extra-strings.c \
nautilus.symbols \
$(about_DATA) \
$(uimanager_DATA) \
$(builder_in_files) \
......
......@@ -378,8 +378,6 @@ parse_arguments (int *argcp,
}
}
data->working_directory = g_get_current_dir ();
/* Need to save this here before calling gtk_init! */
data->startup_id = g_strdup (g_getenv ("DESKTOP_STARTUP_ID"));
......@@ -391,6 +389,9 @@ parse_arguments (int *argcp,
}
g_option_context_free (context);
if (data->working_directory == NULL)
data->working_directory = g_get_current_dir ();
/* Do this here so that gdk_display is initialized */
if (data->startup_id == NULL)
data->startup_id = slowly_and_stupidly_obtain_timestamp ();
......@@ -444,25 +445,46 @@ build_exec_options_variant (OptionData *data)
{
GVariantBuilder builder;
char **envv;
const char *pwd, *working_directory;
char path[PATH_MAX];
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
if (data->working_directory)
g_variant_builder_add (&builder, "{sv}",
"cwd", g_variant_new_bytestring (data->working_directory));
envv = g_get_environ ();
if (envv) {
envv = g_environ_unsetenv (envv, "DESKTOP_STARTUP_ID");
envv = g_environ_unsetenv (envv, "GIO_LAUNCHED_DESKTOP_FILE_PID");
envv = g_environ_unsetenv (envv, "GIO_LAUNCHED_DESKTOP_FILE");
g_variant_builder_add (&builder, "{sv}",
"environ",
g_variant_new_bytestring_array ((const char * const *) envv, -1));
g_strfreev (envv);
envv = g_environ_unsetenv (envv, "DESKTOP_STARTUP_ID");
envv = g_environ_unsetenv (envv, "GIO_LAUNCHED_DESKTOP_FILE_PID");
envv = g_environ_unsetenv (envv, "GIO_LAUNCHED_DESKTOP_FILE");
g_variant_builder_add (&builder, "{sv}",
"environ",
g_variant_new_bytestring_array ((const char * const *) envv, -1));
/* If $PWD points to the CWD, transmit $PWD instead so as
* not follow symlinks! See bug #502146.
*/
pwd = g_environ_getenv (envv, "PWD");
if (pwd) {
char *s;
GError *err = NULL;
if ((s = g_file_read_link (pwd, &err)) == NULL)
g_print ("Failed to readlink %s: %s\n", pwd, err->message);
else
g_print ("Resolved: %s\n", s);
}
if (pwd != NULL && data->working_directory != NULL &&
readlink (pwd, path, sizeof (path)) != -1) {
working_directory = pwd;
} else {
working_directory = data->working_directory;
}
g_print ("Transmit pwd = %s (working_directory %s)\n", working_directory, data->working_directory);
g_variant_builder_add (&builder, "{sv}",
"cwd", g_variant_new_bytestring (working_directory));
g_strfreev (envv);
return g_variant_builder_end (&builder);
}
......
/*
* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 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 General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Author: Christian Neumair <chris@gnome-de.org>
*/
#include "config.h"
#include "terminal-nautilus.h"
#include <gconf/gconf-client.h>
#include <glib/gi18n-lib.h>
void nautilus_module_initialize (GTypeModule *module);
void nautilus_module_shutdown (void);
void nautilus_module_list_types (const GType **types, int *num_types);
static GType type_list[1];
void
nautilus_module_initialize (GTypeModule *module)
{
terminal_nautilus_register_type (module);
type_list[0] = TERMINAL_TYPE_NAUTILUS;
bindtextdomain (GETTEXT_PACKAGE, TERM_LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
gconf_client_add_dir(gconf_client_get_default(),
"/desktop/gnome/lockdown",
0,
NULL);
}
void
nautilus_module_shutdown (void)
{
}
void
nautilus_module_list_types (const GType **types,
int *num_types)
{
*types = type_list;
*num_types = G_N_ELEMENTS (type_list);
}
nautilus_module_initialize
nautilus_module_shutdown
nautilus_module_list_types
......@@ -81,8 +81,6 @@ struct _TerminalApp
{
TerminalFactorySkeleton parent_instance;
GDBusObjectManagerServer *object_manager;
GList *windows;
GtkWidget *new_profile_dialog;
GtkWidget *manage_profiles_dialog;
......
This diff is collapsed.
/*
* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 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 General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Author: Christian Neumair <chris@gnome-de.org>
*/
#ifndef TERMINAL_NAUTILUS_H
#define TERMINAL_NAUTILUS_H
#include <glib-object.h>
G_BEGIN_DECLS
#define TERMINAL_TYPE_NAUTILUS (terminal_nautilus_get_type ())
#define TERMINAL_NAUTILUS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TERMINAL_TYPE_NAUTILUS, TerminalNautilus))
#define TERMINAL_TERMINAL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), TERMINAL_TYPE_NAUTILUS, TerminalNautilusClass))
#define TERMINAL_IS_NAUTILUS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TERMINAL_TYPE_NAUTILUS))
#define TERMINAL_IS_TERMINAL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TERMINAL_TYPE_NAUTILUS))
#define TERMINAL_TERMINAL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TERMINAL_TYPE_NAUTILUS, TerminalNautilusClass))
typedef struct _TerminalNautilus TerminalNautilus;
typedef struct _TerminalNautilusClass TerminalNautilusClass;
struct _TerminalNautilus {
GObject parent_instance;
};
struct _TerminalNautilusClass {
GObjectClass parent_class;
};
GType terminal_nautilus_get_type (void);
void terminal_nautilus_register_type (GTypeModule *module);
G_END_DECLS
#endif /* TERMINAL_NAUTILUS_H */
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