aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-01-03 05:34:53 +0800
committerChristian Persch <chpe@src.gnome.org>2006-01-03 05:34:53 +0800
commitc13881a0251b12e7c0d9bfc02a30d3d2b413725c (patch)
treeabc13b4b5ed11544526f4c1242528a4d0d196c6f
parent6dabfeeef03a5890d0ebffab4382ade94f6b7c32 (diff)
downloadgsoc2013-epiphany-c13881a0251b12e7c0d9bfc02a30d3d2b413725c.tar
gsoc2013-epiphany-c13881a0251b12e7c0d9bfc02a30d3d2b413725c.tar.gz
gsoc2013-epiphany-c13881a0251b12e7c0d9bfc02a30d3d2b413725c.tar.bz2
gsoc2013-epiphany-c13881a0251b12e7c0d9bfc02a30d3d2b413725c.tar.lz
gsoc2013-epiphany-c13881a0251b12e7c0d9bfc02a30d3d2b413725c.tar.xz
gsoc2013-epiphany-c13881a0251b12e7c0d9bfc02a30d3d2b413725c.tar.zst
gsoc2013-epiphany-c13881a0251b12e7c0d9bfc02a30d3d2b413725c.zip
R data/GNOME_Epiphany_Automation.server.in: A data/epiphany-service.xml: A
2006-01-02 Christian Persch <chpe@cvs.gnome.org> * Makefile.am: * autogen.sh: * configure.ac: R data/GNOME_Epiphany_Automation.server.in: * data/Makefile.am: A data/epiphany-service.xml: A data/org.gnome.Epiphany.service.in: * doc/reference/Makefile.am: R idl/.cvsignore: R idl/EphyAutomation.idl: R idl/Makefile.am: * lib/Makefile.am: R lib/ephy-dbus.c: R lib/ephy-dbus.h: * lib/ephy-file-helpers.c: (ephy_file_launch_application): * src/Makefile.am: A src/ephy-activation.c: A src/ephy-activation.h: A src/ephy-dbus.c: A src/ephy-dbus.h: * src/ephy-main.c: (main): * src/ephy-shell.c: (ephy_shell_init), (open_urls), (dbus_g_proxy_finalized_cb), (ephy_shell_startup), (ephy_shell_dispose): Bonobo is dead; long live the Bonobos! Patch by Gustavo Gama, bug #322463.
-rw-r--r--ChangeLog30
-rw-r--r--Makefile.am4
-rwxr-xr-xautogen.sh2
-rw-r--r--configure.ac77
-rw-r--r--data/GNOME_Epiphany_Automation.server.in20
-rw-r--r--data/Makefile.am15
-rw-r--r--data/epiphany-service.xml25
-rw-r--r--data/org.gnome.Epiphany.service.in3
-rw-r--r--doc/reference/Makefile.am2
-rw-r--r--idl/.cvsignore9
-rw-r--r--idl/EphyAutomation.idl31
-rw-r--r--idl/Makefile.am2
-rw-r--r--lib/Makefile.am12
-rw-r--r--lib/ephy-file-helpers.c11
-rw-r--r--src/Makefile.am43
-rw-r--r--src/ephy-activation.c153
-rw-r--r--src/ephy-activation.h55
-rw-r--r--src/ephy-dbus.c (renamed from lib/ephy-dbus.c)263
-rw-r--r--src/ephy-dbus.h (renamed from lib/ephy-dbus.h)16
-rw-r--r--src/ephy-main.c2
-rw-r--r--src/ephy-shell.c195
21 files changed, 581 insertions, 389 deletions
diff --git a/ChangeLog b/ChangeLog
index 0d2902da4..93e086129 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2006-01-02 Christian Persch <chpe@cvs.gnome.org>
+
+ * Makefile.am:
+ * autogen.sh:
+ * configure.ac:
+ R data/GNOME_Epiphany_Automation.server.in:
+ * data/Makefile.am:
+ A data/epiphany-service.xml:
+ A data/org.gnome.Epiphany.service.in:
+ * doc/reference/Makefile.am:
+ R idl/.cvsignore:
+ R idl/EphyAutomation.idl:
+ R idl/Makefile.am:
+ * lib/Makefile.am:
+ R lib/ephy-dbus.c:
+ R lib/ephy-dbus.h:
+ * lib/ephy-file-helpers.c: (ephy_file_launch_application):
+ * src/Makefile.am:
+ A src/ephy-activation.c:
+ A src/ephy-activation.h:
+ A src/ephy-dbus.c:
+ A src/ephy-dbus.h:
+ * src/ephy-main.c: (main):
+ * src/ephy-shell.c: (ephy_shell_init), (open_urls),
+ (dbus_g_proxy_finalized_cb), (ephy_shell_startup),
+ (ephy_shell_dispose):
+
+ Bonobo is dead; long live the Bonobos!
+ Patch by Gustavo Gama, bug #322463.
+
2006-01-01 Christian Persch <chpe@cvs.gnome.org>
* configure.ac:
diff --git a/Makefile.am b/Makefile.am
index 00a602a7e..517dc3ada 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = lib embed idl src plugins data po help doc
+SUBDIRS = lib embed src plugins data po help doc
ACLOCAL_AMFLAGS = -I m4
@@ -21,4 +21,4 @@ DISTCLEANFILES = \
intltool-update \
gnome-doc-utils.make
-DISTCHECK_CONFIGURE_FLAGS = --enable-dbus --enable-python --enable-gtk-doc --disable-schemas-install --disable-scrollkeeper --with-gecko=$(MOZILLA)
+DISTCHECK_CONFIGURE_FLAGS = --enable-python --enable-gtk-doc --disable-schemas-install --disable-scrollkeeper --with-gecko=$(MOZILLA)
diff --git a/autogen.sh b/autogen.sh
index 52161ccba..d1411d2bd 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -17,4 +17,4 @@ which gnome-autogen.sh || {
exit 1
}
-REQUIRED_AUTOMAKE_VERSION=1.9 USE_GNOME2_MACROS=1 . gnome-autogen.sh
+REQUIRED_AUTOMAKE_VERSION=1.9 USE_GNOME2_MACROS=1 . /opt/gnome-2.14/bin/gnome-autogen.sh
diff --git a/configure.ac b/configure.ac
index d290ed889..8ca154a7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
# Copyright (C) 2000-2004 Marco Pesenti Gritti
-# Copyright (C) 2003, 2004, 2005 Christian Persch
+# Copyright (C) 2003, 2004, 2005, 2006 Christian Persch
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@@ -32,26 +32,11 @@ AM_INIT_AUTOMAKE([1.9 dist-bzip2 no-dist-gzip check-news])
AM_MAINTAINER_MODE
-AC_PROG_INTLTOOL([0.29])
-
-GLIB_REQUIRED=2.8.0
-GTK_REQUIRED=2.8.3
-LIBXML_REQUIRED=2.6.12
-LIBXSLT_REQUIRED=1.1.7
-LIBGLADE_REQUIRED=2.3.1
-LIBGNOMEVFS_REQUIRED=2.9.2
-LIBGNOMEUI_REQUIRED=2.6.0
-GNOME_DESKTOP_REQUIRED=2.9.91
-LIBSTARTUP_NOTIFICATION_REQUIRED=0.5
-LIBGNOMEPRINT_REQUIRED=2.4.0
-LIBGNOMEPRINTUI_REQUIRED=2.4.0
-DBUS_GLIB_REQUIRED=0.35
-
AC_ENABLE_SHARED([yes])
AC_ENABLE_STATIC([no])
AC_LIBTOOL_DLOPEN
-AM_PROG_LIBTOOL
+AC_PROG_LIBTOOL
AC_ISC_POSIX
AC_PROG_CC
@@ -61,6 +46,10 @@ AC_HEADER_STDC
AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
+IT_PROG_INTLTOOL([0.34.1])
+
+PKG_PROG_PKG_CONFIG
+
GNOME_DEBUG_CHECK
GNOME_COMPILE_WARNINGS([maximum])
GNOME_CXX_WARNINGS
@@ -76,15 +65,18 @@ if test "x$enable_maintainer_mode" = "xyes"; then
MOZILLA_WARN_CXXFLAGS="-Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth $MOZILLA_WARN_CXXFLAGS"
fi
-AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
-if $PKG_CONFIG --atleast-version $LIBSTARTUP_NOTIFICATION_REQUIRED libstartup-notification-1.0; then
- echo "Building with libstartup-notification"
- AC_DEFINE([HAVE_STARTUP_NOTIFICATION],[1],[Define to enable startup notification support])
- STARTUP_NOTIFICATION_PACKAGE=libstartup-notification-1.0
-else
- echo "***** WARNING: Building without libstartup-notification"
- STARTUP_NOTIFICATION_PACKAGE=
-fi
+GLIB_REQUIRED=2.8.0
+GTK_REQUIRED=2.8.3
+LIBXML_REQUIRED=2.6.12
+LIBXSLT_REQUIRED=1.1.7
+LIBGLADE_REQUIRED=2.3.1
+LIBGNOMEVFS_REQUIRED=2.9.2
+LIBGNOMEUI_REQUIRED=2.6.0
+GNOME_DESKTOP_REQUIRED=2.9.91
+LIBSTARTUP_NOTIFICATION_REQUIRED=0.5
+LIBGNOMEPRINT_REQUIRED=2.4.0
+LIBGNOMEPRINTUI_REQUIRED=2.4.0
+DBUS_GLIB_REQUIRED=0.35
PKG_CHECK_MODULES([DEPENDENCIES], [\
glib-2.0 >= $GLIB_REQUIRED \
@@ -97,53 +89,39 @@ PKG_CHECK_MODULES([DEPENDENCIES], [\
gnome-vfs-module-2.0 \
gconf-2.0 \
gnome-desktop-2.0 >= $GNOME_DESKTOP_REQUIRED \
- $STARTUP_NOTIFICATION_PACKAGE \
+ libstartup-notification-1.0 >= $LIBSTARTUP_NOTIFICATION_REQUIRED \
libgnomeprint-2.2 >= $LIBGNOMEPRINT_REQUIRED \
libgnomeprintui-2.2 >= $LIBGNOMEPRINTUI_REQUIRED \
])
AC_SUBST([DEPENDENCIES_CFLAGS])
AC_SUBST([DEPENDENCIES_LIBS])
+# ****
+# DBUS
+# ****
+
PKG_CHECK_MODULES([DBUS],[dbus-glib-1 >= $DBUS_GLIB_REQUIRED])
AC_SUBST([DBUS_CFLAGS])
AC_SUBST([DBUS_LIBS])
AC_PATH_PROG([DBUS_BINDING_TOOL],[dbus-binding-tool],[no])
-if test x"$DBUS_BINDING_TOOL" = xno; then
+if test "$DBUS_BINDING_TOOL" = "no"; then
AC_MSG_ERROR([dbus-binding-tool not found])
fi
-AM_CONDITIONAL([ENABLE_DBUS],[false])
-
-PKG_CHECK_MODULES([BONOBO],[bonobo-activation-2.0 ORBit-2.0])
-AC_SUBST([BONOBO_CFLAGS])
-AC_SUBST([BONOBO_LIBS])
-
-ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`"
-AC_SUBST([ORBIT_IDL])
-
-LIBBONOBO_IDL="`$PKG_CONFIG --variable=idldir libbonobo-2.0`"
-AC_SUBST([LIBBONOBO_IDL])
-
-BONOBO_ACTIVATION_IDL="`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`"
-AC_SUBST([BONOBO_ACTIVATION_IDL])
-
# *****
# GConf
# *****
-# Specify the gconf configuration source,
-# default to xml::$(sysconfdir)/gconf/gconf.xml.defaults
+AM_GCONF_SOURCE_2
AC_PATH_PROG([GCONFTOOL], [gconftool-2], [no])
-if test x"$GCONFTOOL" = xno; then
- AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
+if test "$GCONFTOOL" = "no"; then
+ AC_MSG_ERROR([gconftool-2 not found])
fi
-AM_GCONF_SOURCE_2
-
# ******************
# Portability checks
# ******************
@@ -641,7 +619,6 @@ data/art/Makefile
data/ui/Makefile
doc/Makefile
doc/reference/Makefile
-idl/Makefile
lib/Makefile
lib/egg/Makefile
lib/widgets/Makefile
diff --git a/data/GNOME_Epiphany_Automation.server.in b/data/GNOME_Epiphany_Automation.server.in
deleted file mode 100644
index 05b831039..000000000
--- a/data/GNOME_Epiphany_Automation.server.in
+++ /dev/null
@@ -1,20 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:GNOME_Epiphany_Automation_Factory" type="exe" location="epiphany">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" value="Epiphany automation"/>
- <oaf_attribute name="description" type="string" value="Epiphany automation factory"/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Epiphany_Automation" type="factory" location="OAFIID:GNOME_Epiphany_Automation_Factory">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/Unknown:1.0"/>
- <item value="IDL:GNOME/EpiphanyAutomation:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" _value="Epiphany automation"/>
- <oaf_attribute name="description" type="string" value="Epiphany automation"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/data/Makefile.am b/data/Makefile.am
index 2dfdd64ab..a5c2bcba9 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -25,10 +25,6 @@ default-prefs.js: $(default_prefs_files)
default_prefsdir = $(pkgdatadir)
default_prefs_DATA = default-prefs.js
-server_in_files = GNOME_Epiphany_Automation.server.in
-server_DATA = GNOME_Epiphany_Automation.server
-serverdir = $(libdir)/bonobo/servers
-
desktop_in_files = epiphany.desktop.in.in bme.desktop.in.in
desktopdir = $(datadir)/applications
desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop)
@@ -58,6 +54,16 @@ xsl_DATA = \
epiphany-bookmarks-html.xsl \
ephy-xml2ini.xsl
+# Dbus service file
+servicedir = $(datadir)/dbus-1/services
+service_in_files = org.gnome.Epiphany.service.in
+service_DATA = $(service_in_files:.service.in=.service)
+
+# Rule to make the service file with bindir expanded
+$(service_DATA): $(service_in_files) Makefile
+ @sed -e "s|\@bindir\@|$(bindir)|" $< > $@
+
+
install-data-local: $(schema_DATA)
if GCONF_SCHEMAS_INSTALL
if test -z "$(DESTDIR)" ; then \
@@ -78,6 +84,7 @@ EXTRA_DIST = \
$(pkgconfig_DATA) \
$(default_prefs_in_FILES) \
$(xsl_DATA) \
+ $(service_DATA) \
$(m4data_DATA) \
check-mime.py \
generate-font-schemas.py
diff --git a/data/epiphany-service.xml b/data/epiphany-service.xml
new file mode 100644
index 000000000..2e21799a9
--- /dev/null
+++ b/data/epiphany-service.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node name="/org/gnome/Epiphany">
+ <interface name="org.gnome.Epiphany">
+ <method name="loadSession">
+ <arg type="s"/>
+ <arg type="u"/>
+ </method>
+ <method name="loadUrl">
+ <arg type="s"/>
+ <arg type="b"/>
+ <arg type="b"/>
+ <arg type="b"/>
+ <arg type="u"/>
+ </method>
+ <method name="openBookmarksEditor">
+ <arg type="u"/>
+ </method>
+ <method name="importBookmarks">
+ <arg type="s"/>
+ </method>
+ <method name="addBookmark">
+ <arg type="s"/>
+ </method>
+ </interface>
+</node>
diff --git a/data/org.gnome.Epiphany.service.in b/data/org.gnome.Epiphany.service.in
new file mode 100644
index 000000000..003ec0c66
--- /dev/null
+++ b/data/org.gnome.Epiphany.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.gnome.Epiphany
+Exec=@bindir@/epiphany
diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
index 589b66106..81d5b7bec 100644
--- a/doc/reference/Makefile.am
+++ b/doc/reference/Makefile.am
@@ -154,7 +154,6 @@ GTKDOC_CFLAGS = -I$(top_srcdir)/src \
-I$(top_builddir)/lib/egg \
$(DEPENDENCIES_CFLAGS) \
$(GECKO_CFLAGS) \
- $(BONOBO_CFLAGS) \
$(DBUS_CFLAGS)
GTKDOC_LIBS = \
@@ -168,7 +167,6 @@ GTKDOC_LIBS = \
$(top_builddir)/lib/egg/libegg.la \
$(GECKO_LIBS) \
$(DEPENDENCIES_LIBS) \
- $(BONOBO_LIBS) \
$(DBUS_LIBS)
$(INTLLIBS)
diff --git a/idl/.cvsignore b/idl/.cvsignore
deleted file mode 100644
index 4e21436af..000000000
--- a/idl/.cvsignore
+++ /dev/null
@@ -1,9 +0,0 @@
-Makefile
-Makefile.in
-.deps
-.libs
-*-common.c
-*-skels.c
-*-stubs.c
-*.h
-*_idl_stamp
diff --git a/idl/EphyAutomation.idl b/idl/EphyAutomation.idl
deleted file mode 100644
index c3e21c347..000000000
--- a/idl/EphyAutomation.idl
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <Bonobo.idl>
-
-module GNOME {
-
- interface EphyAutomation : Bonobo::Unknown {
- void loadurl (in string url,
- in boolean fullscreen,
- in boolean open_in_existing_tab,
- in boolean open_in_new_tab);
-
- void addBookmark (in string url);
-
- void importBookmarks (in string filename);
-
- void loadSession (in string filename);
-
- void openBookmarksEditor ();
-
- void loadUrlWithStartupId (in string url,
- in boolean fullscreen,
- in boolean open_in_existing_tab,
- in boolean open_in_new_tab,
- in unsigned long startup_id);
-
- void loadSessionWithStartupId (in string filename,
- in unsigned long startup_id);
-
- void openBookmarksEditorWithStartupId (in unsigned long startup_id);
- };
-};
-
diff --git a/idl/Makefile.am b/idl/Makefile.am
deleted file mode 100644
index 72d3d4fec..000000000
--- a/idl/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-EXTRA_DIST = \
- EphyAutomation.idl
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 44a9e3a7f..97b2832fc 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -28,13 +28,11 @@ NOINST_H_FILES = \
TYPES_H_FILES = \
ephy-adblock.h \
- ephy-dbus.h \
ephy-node.h \
ephy-state.h
INST_H_FILES = \
ephy-adblock.h \
- ephy-dbus.h \
ephy-dialog.h \
ephy-loader.h \
ephy-node.h \
@@ -44,7 +42,6 @@ INST_H_FILES = \
libephymisc_la_SOURCES = \
eel-gconf-extensions.c \
ephy-adblock.c \
- ephy-dbus.c \
ephy-debug.c \
ephy-dialog.c \
ephy-dnd.c \
@@ -78,12 +75,10 @@ libephymisc_la_CPPFLAGS = \
$(AM_CPPFLAGS)
libephymisc_la_CFLAGS = \
- $(DEPENDENCIES_CFLAGS) \
- $(DBUS_CFLAGS) \
+ $(DEPENDENCIES_CFLAGS) \
$(AM_CFLAGS)
-libephymisc_la_LIBADD = \
- $(DBUS_LIBS)
+libephymisc_la_LIBADD =
BUILT_SOURCES = \
ephy-lib-type-builtins.c \
@@ -152,4 +147,5 @@ stamp-ephy-lib-type-builtins.h: $(TYPES_H_FILES)
&& echo timestamp > $(@F)
EXTRA_DIST = \
- ephy-marshal.list
+ ephy-marshal.list \
+ epiphany-service.xml
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index 6f1472654..f9a665db9 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -43,12 +43,10 @@
#undef GNOME_DISABLE_DEPRECATED
#include <libgnome/gnome-desktop-item.h>
-#ifdef HAVE_STARTUP_NOTIFICATION
#define SN_API_NOT_YET_FROZEN
#include <libsn/sn.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
-#endif
#define EPHY_UUID "0d82d98f-7079-401c-abff-203fcde1ece3"
#define EPHY_UUID_ENVVAR "EPHY_UNIQUE"
@@ -560,7 +558,6 @@ my_gdk_spawn_make_environment_for_screen (GdkScreen *screen,
return retval;
}
-#ifdef HAVE_STARTUP_NOTIFICATION
static void
sn_error_trap_push (SnDisplay *display,
Display *xdisplay)
@@ -728,8 +725,6 @@ add_startup_timeout (GdkScreen *screen,
}
}
-#endif /* HAVE_STARTUP_NOTIFICATION */
-
gboolean
ephy_file_launch_application (GnomeVFSMimeApplication *application,
const char *parameter,
@@ -740,10 +735,8 @@ ephy_file_launch_application (GnomeVFSMimeApplication *application,
char *uri;
char **envp;
GnomeVFSResult result;
-#ifdef HAVE_STARTUP_NOTIFICATION
SnLauncherContext *sn_context;
SnDisplay *sn_display;
-#endif
g_return_val_if_fail (application != NULL, FALSE);
g_return_val_if_fail (parameter != NULL, FALSE);
@@ -756,7 +749,6 @@ ephy_file_launch_application (GnomeVFSMimeApplication *application,
screen = gdk_screen_get_default ();
envp = my_gdk_spawn_make_environment_for_screen (screen, NULL);
-#ifdef HAVE_STARTUP_NOTIFICATION
sn_display = sn_display_new (gdk_display,
sn_error_trap_push,
sn_error_trap_pop);
@@ -807,11 +799,9 @@ ephy_file_launch_application (GnomeVFSMimeApplication *application,
} else {
sn_context = NULL;
}
-#endif /* HAVE_STARTUP_NOTIFICATION */
result = gnome_vfs_mime_application_launch_with_env (application, uris, envp);
-#ifdef HAVE_STARTUP_NOTIFICATION
if (sn_context != NULL) {
if (result != GNOME_VFS_OK) {
sn_launcher_context_complete (sn_context); /* end sequence */
@@ -824,7 +814,6 @@ ephy_file_launch_application (GnomeVFSMimeApplication *application,
}
sn_display_unref (sn_display);
-#endif /* HAVE_STARTUP_NOTIFICATION */
g_strfreev (envp);
g_list_foreach (uris, (GFunc) g_free,NULL);
diff --git a/src/Makefile.am b/src/Makefile.am
index 0f6f645f8..960dc9bc8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,19 +11,6 @@ bin_PROGRAMS = epiphany
CXXLD = $(CXX)
LINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
-CORBA_SOURCE = \
- EphyAutomation-common.c \
- EphyAutomation-stubs.c \
- EphyAutomation-skels.c \
- EphyAutomation.h
-
-idls = $(top_srcdir)/idl/EphyAutomation.idl
-
-idl_flags = -I$(LIBBONOBO_IDL) -I$(BONOBO_ACTIVATION_IDL)
-
-$(CORBA_SOURCE): $(idls) $(ORBIT_IDL)
- $(ORBIT_IDL) $(idl_flags) $(idls)
-
headerdir = $(prefix)/include/epiphany/@EPIPHANY_MAJOR@/epiphany
header_DATA = \
ephy-type-builtins.h \
@@ -31,7 +18,7 @@ header_DATA = \
NOINST_H_FILES = \
ephy-action-helper.h \
- ephy-automation.h \
+ ephy-activation.h \
ephy-encoding-dialog.h \
ephy-encoding-menu.h \
ephy-find-toolbar.h \
@@ -55,6 +42,7 @@ NOINST_H_FILES = \
window-commands.h
INST_H_FILES = \
+ ephy-dbus.h \
ephy-extension.h \
ephy-extensions-manager.h \
ephy-link.h \
@@ -66,12 +54,13 @@ INST_H_FILES = \
ephy-window.h
libephymain_la_SOURCES = \
- $(CORBA_SOURCE) \
$(TYPES_SOURCE) \
+ ephy-activation.c \
ephy-action-helper.c \
- ephy-automation.c \
ephy-completion-model.c \
ephy-completion-model.h \
+ ephy-dbus.c \
+ ephy-dbus.h \
ephy-encoding-dialog.c \
ephy-encoding-menu.c \
ephy-extension.c \
@@ -129,7 +118,6 @@ libephymain_la_CPPFLAGS = \
libephymain_la_CFLAGS = \
$(DEPENDENCIES_CFLAGS) \
- $(BONOBO_CFLAGS) \
$(DBUS_CFLAGS) \
$(AM_CFLAGS)
@@ -175,6 +163,7 @@ libpyphany_la_CPPFLAGS = \
libpyphany_la_CFLAGS = \
$(DEPENDENCIES_CFLAGS) \
$(NO_STRICT_ALIASING_CFLAGS) \
+ $(DBUS_CFLAGS) \
$(PYGTK_CFLAGS) \
$(AM_CFLAGS)
@@ -183,7 +172,6 @@ libpyphany_la_LDFLAGS = \
libpyphany_la_LIBADD = \
$(DEPENDENCIES_LIBS) \
- $(BONOBO_LIBS) \
$(PYTHON_LIB_LOC) $(PYTHON_LIBS) \
$(PYTHON_EXTRA_LIBS) \
$(PYGTK_LIBS)
@@ -201,7 +189,7 @@ epiphany_CPPFLAGS = \
epiphany_CFLAGS = \
$(DEPENDENCIES_CFLAGS) \
- $(BONOBO_LIBS) \
+ $(DBUS_CFLAGS) \
$(AM_CFLAGS)
epiphany_LDFLAGS = -R$(MOZILLA_HOME) -dlopen self
@@ -217,7 +205,6 @@ epiphany_LDADD = \
$(top_builddir)/lib/egg/libegg.la \
$(GECKO_LIBS) \
$(DEPENDENCIES_LIBS) \
- $(BONOBO_LIBS) \
$(DBUS_LIBS) \
$(INTLLIBS)
@@ -239,8 +226,10 @@ EXTRA_DIST = \
endif
BUILT_SOURCES = \
- $(CORBA_SOURCE) \
- $(TYPES_SOURCE)
+ $(TYPES_SOURCE) \
+ ephy-dbus-client-bindings.h \
+ ephy-dbus-server-bindings.h
+
TYPES_SOURCE = \
ephy-type-builtins.c \
@@ -300,6 +289,12 @@ epiphany.c: epiphany.defs epiphany.override
--override $*.override \
--prefix py$* $(<F) ) > $@
+ephy-dbus-server-bindings.h: $(top_builddir)/data/epiphany-service.xml
+ $(DBUS_BINDING_TOOL) --prefix=ephy_activation --mode=glib-server $< > $@
+
+ephy-dbus-client-bindings.h: $(top_builddir)/data/epiphany-service.xml
+ $(DBUS_BINDING_TOOL) --prefix=ephy_activation --mode=glib-client $< > $@
+
CLEANFILES = $(stamp_files) $(BUILT_SOURCES)
DISTCLEANFILES = $(stamp_files) $(BUILT_SOURCES)
MAINTAINERCLEANFILES = $(stamp_files) $(BUILT_SOURCES)
@@ -351,7 +346,6 @@ BINDING_HEADERS_SRCDIR_IGNORE_IN = \
embed/ephy-encodings.h \
embed/print-dialog.h \
lib/eel-gconf-extensions.h \
- lib/ephy-dbus.h \
lib/ephy-debug.h \
lib/ephy-dnd.h \
lib/ephy-file-chooser.h \
@@ -404,8 +398,9 @@ BINDING_HEADERS_SRCDIR_IGNORE_IN = \
src/bookmarks/ephy-topic-action-group.h \
src/bookmarks/ephy-topic-factory-action.h \
src/ephy-action-helper.h \
- src/ephy-automation.h \
+ src/ephy-activation.h \
src/ephy-completion-model.h \
+ src/ephy-dbus.h \
src/ephy-encoding-dialog.h \
src/ephy-encoding-menu.h \
src/ephy-find-toolbar.h \
diff --git a/src/ephy-activation.c b/src/ephy-activation.c
new file mode 100644
index 000000000..b677a09b6
--- /dev/null
+++ b/src/ephy-activation.c
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2005 Gustavo Gama
+ *
+ * This program 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 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id:
+ */
+
+#include "ephy-activation.h"
+#include "ephy-debug.h"
+#include "ephy-shell.h"
+#include "ephy-session.h"
+#include "ephy-bookmarks-import.h"
+#include "eel-gconf-extensions.h"
+#include "ephy-prefs.h"
+#include "ephy-gui.h"
+
+gboolean
+ephy_activation_load_url (EphyDbus *ephy_dbus,
+ char *url,
+ gboolean fullscreen,
+ gboolean open_in_existing_tab,
+ gboolean open_in_new_tab,
+ guint startup_id)
+{
+ EphyNewTabFlags flags = 0;
+ EphyWindow *window;
+ EphySession *session;
+ guint32 user_time = (guint32) startup_id;
+
+ session = EPHY_SESSION (ephy_shell_get_session (ephy_shell));
+ g_return_val_if_fail (session != NULL, FALSE);
+
+ if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL))
+ {
+ url = "";
+ }
+
+ window = ephy_session_get_active_window (session);
+
+ if (open_in_existing_tab && window != NULL)
+ {
+ ephy_gui_window_update_user_time (GTK_WIDGET (window),
+ user_time);
+ ephy_window_load_url (window, url);
+ return TRUE;
+ }
+
+ if (*url == '\0')
+ {
+ flags |= EPHY_NEW_TAB_HOME_PAGE;
+ }
+ else
+ {
+ flags |= EPHY_NEW_TAB_OPEN_PAGE;
+ }
+
+ if (open_in_new_tab)
+ {
+ flags |= EPHY_NEW_TAB_IN_EXISTING_WINDOW |
+ EPHY_NEW_TAB_JUMP;
+ }
+ else
+ {
+ flags |= EPHY_NEW_TAB_IN_NEW_WINDOW;
+ }
+
+ if (fullscreen)
+ {
+ flags |= EPHY_NEW_TAB_FULLSCREEN_MODE;
+ }
+
+ ephy_shell_new_tab_full (ephy_shell, window, NULL, url, flags,
+ EPHY_EMBED_CHROME_ALL, FALSE, user_time);
+
+ return TRUE;
+}
+
+gboolean
+ephy_activation_add_bookmark (EphyDbus *ephy_dbus,
+ char *url)
+{
+ ephy_bookmarks_add (ephy_shell_get_bookmarks (ephy_shell),
+ url /* title */, url);
+ return TRUE;
+}
+
+gboolean
+ephy_activation_import_bookmarks (EphyDbus *ephy_dbus,
+ char *filename)
+{
+ ephy_bookmarks_import (ephy_shell_get_bookmarks (ephy_shell),
+ filename);
+ return TRUE;
+}
+
+gboolean
+ephy_activation_load_session (EphyDbus *ephy_dbus,
+ char *session_name,
+ guint startup_id,
+ GError **error)
+{
+ EphySession *session;
+ guint32 user_time = (guint32) startup_id;
+
+ session = EPHY_SESSION (ephy_shell_get_session (ephy_shell));
+ ephy_session_load (session, session_name, user_time);
+ return TRUE;
+}
+
+gboolean
+ephy_activation_open_bookmarks_editor (EphyDbus *ephy_dbus,
+ guint startup_id)
+{
+ GtkWidget *editor;
+ guint32 user_time = (guint32) startup_id;
+
+ if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING))
+ {
+ return FALSE;
+ }
+ editor = ephy_shell_get_bookmarks_editor (ephy_shell);
+ ephy_gui_window_update_user_time (editor, user_time);
+ gtk_window_present (GTK_WINDOW (editor));
+ return TRUE;
+}
+
+
+void
+ephy_activation_general_purpose_reply (DBusGProxy *proxy,
+ GError *error,
+ gpointer user_data)
+{
+ g_object_unref (proxy);
+ if (error != NULL)
+ {
+ g_warning ("An error occured while calling remote method: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+}
diff --git a/src/ephy-activation.h b/src/ephy-activation.h
new file mode 100644
index 000000000..4e701e57a
--- /dev/null
+++ b/src/ephy-activation.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2005 Gustavo Gama
+ *
+ * This program 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 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef EPHY_ACTIVATION_H
+#define EPHY_ACTIVATION_H
+
+#include "ephy-dbus.h"
+
+G_BEGIN_DECLS
+
+/* activation handlers */
+gboolean ephy_activation_load_url (EphyDbus *ephy_dbus,
+ char *url,
+ gboolean fullscreen,
+ gboolean open_in_existing_tab,
+ gboolean open_in_new_tab,
+ guint startup_id);
+
+gboolean ephy_activation_add_bookmark (EphyDbus *ephy_dbus,
+ char *url);
+
+gboolean ephy_activation_import_bookmarks (EphyDbus *ephy_dbus,
+ char *filename);
+
+gboolean ephy_activation_load_session (EphyDbus *ephy_dbus,
+ char *session_name,
+ guint user_time,
+ GError **error);
+
+gboolean ephy_activation_open_bookmarks_editor (EphyDbus *ephy_dbus,
+ guint user_time);
+
+/* async reply handlers */
+void ephy_activation_general_purpose_reply (DBusGProxy *proxy,
+ GError *error,
+ gpointer user_data);
+
+G_END_DECLS
+
+#endif
diff --git a/lib/ephy-dbus.c b/src/ephy-dbus.c
index 50bf5fb25..2d3734137 100644
--- a/lib/ephy-dbus.c
+++ b/src/ephy-dbus.c
@@ -14,23 +14,26 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
*/
#include "config.h"
#include "ephy-dbus.h"
-#include "ephy-lib-type-builtins.h"
+#include "ephy-type-builtins.h"
#include "ephy-marshal.h"
#include "ephy-debug.h"
+#include "ephy-activation.h"
+#include "ephy-dbus-server-bindings.h"
+
+#include <string.h>
+#include <dbus/dbus-glib-bindings.h>
#define EPHY_DBUS_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_DBUS, EphyDbusPrivate))
struct _EphyDbusPrivate
{
- DBusConnection *session_bus;
- DBusConnection *system_bus;
+ DBusGConnection *session_bus;
+ DBusGConnection *system_bus;
guint reconnect_timeout_id;
};
@@ -45,18 +48,6 @@ static guint signals[LAST_SIGNAL] = { 0 };
static GObjectClass *parent_class = NULL;
-/* Epiphany's DBUS identification */
-static const char epiphany_dbus_service[] = "org.gnome.Epiphany";
-static const char epiphany_dbus_object_path[] = "/org/gnome/Epiphany";
-
-/* This function is called by DBUS when a message directed at the
- * Epiphany's object path arrives (provided we're the registered instance!)
- * it routes the message to the correct handler
- */
-static DBusHandlerResult path_message_func (DBusConnection *connection,
- DBusMessage *message,
- gpointer data);
-
/* Filter signals form session bus */
static DBusHandlerResult session_filter_func (DBusConnection *connection,
DBusMessage *message,
@@ -66,16 +57,15 @@ static DBusHandlerResult system_filter_func (DBusConnection *connection,
DBusMessage *message,
void *user_data);
+/* Handler for NetworkManager's "DevicesChanged" signals */
+static void ephy_dbus_nm_devices_changed_cb (DBusGProxy *proxy,
+ const char *string,
+ EphyDbus *ephy_dbus);
+
/* Both connect to their respective bus */
static void ephy_dbus_connect_to_session_bus (EphyDbus *dbus);
static void ephy_dbus_connect_to_system_bus (EphyDbus *dbus);
-static DBusObjectPathVTable call_vtable = {
- NULL,
- path_message_func,
- NULL,
-};
-
/* implementation of the DBUS helpers */
static gboolean
@@ -110,7 +100,7 @@ session_filter_func (DBusConnection *connection,
DBusMessage *message,
void *user_data)
{
- EphyDbus *dbus = EPHY_DBUS (user_data);
+ EphyDbus *ephy_dbus = EPHY_DBUS (user_data);
if (dbus_message_is_signal (message,
DBUS_INTERFACE_LOCAL,
@@ -118,14 +108,14 @@ session_filter_func (DBusConnection *connection,
{
LOG ("EphyDbus disconnected from session bus");
- dbus_connection_unref (dbus->priv->session_bus);
- dbus->priv->session_bus = NULL;
+ dbus_g_connection_unref (ephy_dbus->priv->session_bus);
+ ephy_dbus->priv->session_bus = NULL;
- g_signal_emit (dbus, signals[DISCONNECTED], 0, EPHY_DBUS_SESSION);
+ g_signal_emit (ephy_dbus, signals[DISCONNECTED], 0, EPHY_DBUS_SESSION);
/* try to reconnect later ... */
- dbus->priv->reconnect_timeout_id =
- g_timeout_add (3000, (GSourceFunc) ephy_dbus_connect_to_session_bus_cb, dbus);
+ ephy_dbus->priv->reconnect_timeout_id =
+ g_timeout_add (3000, (GSourceFunc) ephy_dbus_connect_to_session_bus_cb, ephy_dbus);
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -138,7 +128,7 @@ system_filter_func (DBusConnection *connection,
DBusMessage *message,
void *user_data)
{
- EphyDbus *dbus = EPHY_DBUS (user_data);
+ EphyDbus *ephy_dbus = EPHY_DBUS (user_data);
LOG ("EphyDbus filtering message from system bus");
@@ -148,13 +138,13 @@ system_filter_func (DBusConnection *connection,
{
LOG ("EphyDbus disconnected from system bus");
- dbus_connection_unref (dbus->priv->system_bus);
- dbus->priv->system_bus = NULL;
+ dbus_g_connection_unref (ephy_dbus->priv->system_bus);
+ ephy_dbus->priv->system_bus = NULL;
- g_signal_emit (dbus, signals[DISCONNECTED], 0, EPHY_DBUS_SYSTEM);
+ g_signal_emit (ephy_dbus, signals[DISCONNECTED], 0, EPHY_DBUS_SYSTEM);
/* try to reconnect later ... */
- g_timeout_add (3000, ephy_dbus_connect_to_system_bus_cb, (gpointer)dbus);
+ g_timeout_add (3000, ephy_dbus_connect_to_system_bus_cb, (gpointer) ephy_dbus);
return DBUS_HANDLER_RESULT_HANDLED;
}
@@ -162,105 +152,164 @@ system_filter_func (DBusConnection *connection,
}
static void
-ephy_dbus_connect_to_system_bus (EphyDbus *dbus)
+ephy_dbus_connect_to_system_bus (EphyDbus *ephy_dbus)
{
- DBusConnection *bus;
- DBusError error;
+ DBusGProxy *proxy;
+ GError *error = NULL;
LOG ("EphyDbus connecting to system DBUS");
- dbus_error_init (&error);
- bus = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
- if (bus == NULL)
+ ephy_dbus->priv->system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+ if (ephy_dbus->priv->system_bus == NULL)
+ {
+ g_warning ("Unable to connect to system bus: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ if (dbus_g_connection_get_connection (ephy_dbus->priv->system_bus) == NULL)
{
- g_warning ("Failed to connect to the system D-BUS: %s", error.message);
- dbus_error_free (&error);
+ g_warning ("DBus connection is null");
return;
}
- dbus_connection_set_exit_on_disconnect (bus, FALSE);
- dbus_connection_setup_with_g_main (bus, NULL);
- dbus_connection_add_filter (bus, system_filter_func, dbus, NULL);
+ dbus_connection_add_filter
+ (dbus_g_connection_get_connection (ephy_dbus->priv->system_bus),
+ system_filter_func, ephy_dbus, NULL);
- dbus_bus_add_match (bus,
- "type='signal',interface='org.freedesktop.NetworkManager'",
- &error);
- if (dbus_error_is_set(&error)) {
- g_warning ("Couldn't register signal handler (system bus): %s: %s",
- error.name, error.message);
+ proxy = dbus_g_proxy_new_for_name (ephy_dbus->priv->system_bus,
+ DBUS_NETWORK_MANAGER_SERVICE,
+ DBUS_NETWORK_MANAGER_PATH,
+ DBUS_NETWORK_MANAGER_INTERFACE);
+
+ if (proxy == NULL)
+ {
+ g_warning ("Unable to get DBus proxy: %s", error->message);
+ g_error_free (error);
return;
}
- dbus->priv->system_bus = bus;
+ dbus_g_proxy_add_signal (proxy, "DevicesChanged", G_TYPE_STRING,
+ G_TYPE_INVALID);
+ dbus_g_proxy_connect_signal (proxy, "DevicesChanged",
+ G_CALLBACK (ephy_dbus_nm_devices_changed_cb),
+ ephy_dbus, NULL);
- g_signal_emit (dbus, signals[CONNECTED], 0, EPHY_DBUS_SYSTEM);
+ g_object_unref (proxy);
+
+ g_signal_emit (ephy_dbus, signals[CONNECTED], 0, EPHY_DBUS_SYSTEM);
}
static void
-ephy_dbus_connect_to_session_bus (EphyDbus *dbus)
+ephy_dbus_connect_to_session_bus (EphyDbus *ephy_dbus)
{
- DBusError error;
- DBusConnection *bus;
-
+ DBusGProxy *proxy;
+ GError *error = NULL;
+ int request_ret;
+
LOG ("EphyDbus connecting to session DBUS");
- dbus_error_init (&error);
- bus = dbus_bus_get (DBUS_BUS_SESSION, &error);
-
- if (!bus) {
- g_warning ("EphyDbus failed to connect to the session D-BUS: %s", error.message);
- dbus_error_free (&error);
+ /* Init the DBus connection */
+ ephy_dbus->priv->session_bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+ if (ephy_dbus->priv->session_bus == NULL)
+ {
+ g_warning("Unable to connect to session bus: %s", error->message);
+ g_error_free (error);
return;
}
- dbus_connection_set_exit_on_disconnect (bus, FALSE);
- dbus_connection_setup_with_g_main (bus, NULL);
-
- dbus_connection_add_filter (bus, session_filter_func, dbus, NULL);
-
- dbus_bus_request_name (bus, epiphany_dbus_service, 0, NULL);
- if (dbus_error_is_set (&error)) {
- g_warning ("EphyDbus failed to acquire epiphany service");
- dbus_error_free (&error);
- return;
+ dbus_connection_add_filter
+ (dbus_g_connection_get_connection (ephy_dbus->priv->session_bus),
+ session_filter_func, ephy_dbus, NULL);
+
+ dbus_g_object_type_install_info (EPHY_TYPE_DBUS,
+ &dbus_glib_ephy_activation_object_info);
+
+ /* Register DBUS path */
+ dbus_g_connection_register_g_object (ephy_dbus->priv->session_bus,
+ DBUS_EPHY_PATH,
+ G_OBJECT (ephy_dbus));
+
+ /* Register the service name, the constant here are defined in dbus-glib-bindings.h */
+ proxy = dbus_g_proxy_new_for_name (ephy_dbus->priv->session_bus,
+ DBUS_SERVICE_DBUS,
+ DBUS_PATH_DBUS,
+ DBUS_INTERFACE_DBUS);
+
+ org_freedesktop_DBus_request_name (proxy,
+ DBUS_EPHY_SERVICE,
+ DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT,
+ &request_ret, &error);
+
+ if (request_ret == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
+ {
+ ephy_dbus->is_session_service_owner = TRUE;
}
+ else
+ {
+ /* if the bus replied that an owner already exists, we set the
+ * owner flag and proceed -- it means there's another epiphany
+ * instance running and we should simply forward the requests to
+ * it; however if it's another return code, we should (at least)
+ * print a warning */
+ ephy_dbus->is_session_service_owner = FALSE;
+
+ if ((request_ret != DBUS_REQUEST_NAME_REPLY_EXISTS) &&
+ (error != NULL))
+ {
+ g_warning("Unable to register service: %s", error->message);
+ }
- dbus_connection_register_object_path (bus,
- epiphany_dbus_object_path,
- &call_vtable, dbus);
-
- dbus->priv->session_bus = bus;
+ }
+ if (error != NULL)
+ {
+ g_error_free (error);
+ }
+ LOG ("Instance is %ssession bus owner.", ephy_dbus->is_session_service_owner ? "" : "NOT ");
- g_signal_emit (dbus, signals[CONNECTED], 0, EPHY_DBUS_SESSION);
+ g_object_unref (proxy);
}
static void
-ephy_dbus_disconnect_bus (DBusConnection *bus)
+ephy_dbus_disconnect_bus (DBusGConnection *bus)
{
if (bus != NULL) {
- dbus_connection_close (bus);
- dbus_connection_unref (bus);
+ dbus_connection_close
+ (dbus_g_connection_get_connection (bus));
+ dbus_g_connection_unref (bus);
}
}
-static DBusHandlerResult
-path_message_func (DBusConnection *connection,
- DBusMessage *message,
- gpointer data)
+static void
+ephy_dbus_nm_devices_changed_cb (DBusGProxy *proxy,
+ const char *device,
+ EphyDbus *ephy_dbus)
{
- DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
- LOG ("EphyDbus filtering path messagefrom session bus");
-
- if (dbus_message_is_method_call (message, epiphany_dbus_service, "load"))
+ GError *error = NULL;
+ char *status;
+
+ /* query status from network manager */
+ dbus_g_proxy_call (proxy, "status", &error, G_TYPE_INVALID,
+ G_TYPE_STRING, &status,
+ G_TYPE_INVALID);
+ if (status != NULL)
{
- result = DBUS_HANDLER_RESULT_HANDLED;
+ g_warning ("NetworkManager's DBus \"status()\" call returned \"null\": %s",
+ error->message);
+ g_error_free (error);
+ return;
}
- return result;
+ if (strcmp ("connected", status) == 0)
+ {
+ /* change ephy's status to online */
+ }
+ else if (strcmp ("disconnected", status) == 0)
+ {
+ /* change ephy's status to offline */
+ }
}
-
/* Public methods */
void
@@ -291,11 +340,11 @@ ephy_dbus_shutdown (EphyDbus *dbus)
ephy_dbus_disconnect_bus (dbus->priv->system_bus);
}
-DBusConnection *
+DBusGConnection *
ephy_dbus_get_bus (EphyDbus *dbus,
EphyDbusBus kind)
{
- DBusConnection *bus = NULL;
+ DBusGConnection *bus = NULL;
g_return_val_if_fail (EPHY_IS_DBUS (dbus), NULL);
@@ -313,6 +362,28 @@ ephy_dbus_get_bus (EphyDbus *dbus,
return bus;
}
+DBusGProxy *
+ephy_dbus_get_proxy (EphyDbus *dbus,
+ EphyDbusBus kind)
+{
+ DBusGConnection *bus = NULL;
+
+ g_return_val_if_fail (EPHY_IS_DBUS (dbus), NULL);
+
+ bus = ephy_dbus_get_bus (dbus, kind);
+
+ if (bus == NULL)
+ {
+ g_warning ("Unable to get proxy for DBus's s bus.");
+ return NULL;
+ }
+
+ return dbus_g_proxy_new_for_name (bus,
+ DBUS_EPHY_SERVICE,
+ DBUS_EPHY_PATH,
+ DBUS_EPHY_INTERFACE);
+}
+
/* Class implementation */
static void
diff --git a/lib/ephy-dbus.h b/src/ephy-dbus.h
index e0c718694..eb6b64d83 100644
--- a/lib/ephy-dbus.h
+++ b/src/ephy-dbus.h
@@ -30,6 +30,16 @@
G_BEGIN_DECLS
+/* Epiphany's DBUS ids */
+#define DBUS_EPHY_SERVICE "org.gnome.Epiphany"
+#define DBUS_EPHY_PATH "/org/gnome/Epiphany"
+#define DBUS_EPHY_INTERFACE "org.gnome.Epiphany"
+
+/* NetworkManager's DBUS ids */
+#define DBUS_NETWORK_MANAGER_SERVICE "org.freedesktop.NetworkManager"
+#define DBUS_NETWORK_MANAGER_PATH "/org/freedesktop/NetworkManager"
+#define DBUS_NETWORK_MANAGER_INTERFACE "org.freedesktop.NetworkManager"
+
#define EPHY_TYPE_DBUS (ephy_dbus_get_type ())
#define EPHY_DBUS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_DBUS, EphyDbus))
#define EPHY_DBUS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_DBUS, EphyDbusClass))
@@ -50,6 +60,7 @@ typedef enum
struct _EphyDbus
{
GObject parent;
+ gboolean is_session_service_owner;
/*< private >*/
EphyDbusPrivate *priv;
@@ -72,7 +83,10 @@ void ephy_dbus_startup (EphyDbus *dbus);
void ephy_dbus_shutdown (EphyDbus *dbus);
-DBusConnection *ephy_dbus_get_bus (EphyDbus *dbus,
+DBusGConnection *ephy_dbus_get_bus (EphyDbus *dbus,
+ EphyDbusBus kind);
+
+DBusGProxy *ephy_dbus_get_proxy (EphyDbus *dbus,
EphyDbusBus kind);
G_END_DECLS
diff --git a/src/ephy-main.c b/src/ephy-main.c
index f9c7fd5b3..e7181b6d0 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -287,8 +287,6 @@ main (int argc, char *argv[])
gtk_about_dialog_set_url_hook (handle_url, NULL, NULL);
gtk_about_dialog_set_email_hook (handle_email, NULL, NULL);
- bonobo_activate ();
-
ephy_shell_new ();
g_assert (ephy_shell != NULL);
new_instance = ephy_shell_startup (ephy_shell, startup_flags,
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 7c088b452..b89b931c4 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -44,14 +44,14 @@
#include "egg-toolbars-model.h"
#include "ephy-toolbars-model.h"
#include "ephy-toolbar.h"
-#include "ephy-automation.h"
#include "print-dialog.h"
#include "ephy-prefs.h"
#include "ephy-gui.h"
#include "ephy-dbus.h"
+#include "ephy-dbus-client-bindings.h"
+#include "ephy-activation.h"
#include <string.h>
-#include <bonobo/bonobo-main.h>
#include <glib/gi18n.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkmain.h>
@@ -67,7 +67,6 @@
struct _EphyShellPrivate
{
- BonoboGenericFactory *automation_factory;
EphySession *session;
GObject *lockdown;
EphyBookmarks *bookmarks;
@@ -255,38 +254,6 @@ impl_get_embed_single (EphyEmbedShell *embed_shell)
return embed_single;
}
-static BonoboObject *
-ephy_automation_factory_cb (BonoboGenericFactory *this_factory,
- const char *iid,
- EphyShell *shell)
-{
- if (strcmp (iid, AUTOMATION_IID) == 0)
- {
- return BONOBO_OBJECT (g_object_new (EPHY_TYPE_AUTOMATION, NULL));
- }
-
- g_assert_not_reached ();
-
- return NULL;
-}
-
-static BonoboGenericFactory *
-ephy_automation_factory_new (EphyShell *shell)
-{
- BonoboGenericFactory *factory;
- GClosure *factory_closure;
-
- factory = g_object_new (bonobo_generic_factory_get_type (), NULL);
-
- factory_closure = g_cclosure_new
- (G_CALLBACK (ephy_automation_factory_cb), shell, NULL);
-
- bonobo_generic_factory_construct_noreg
- (factory, AUTOMATION_FACTORY_IID, factory_closure);
-
- return factory;
-}
-
static void
ephy_shell_init (EphyShell *shell)
{
@@ -299,9 +266,6 @@ ephy_shell_init (EphyShell *shell)
ephy_shell = shell;
g_object_add_weak_pointer (G_OBJECT(ephy_shell),
(gpointer *)ptr);
-
- /* Instantiate the automation factory */
- shell->priv->automation_factory = ephy_automation_factory_new (shell);
}
static char *
@@ -320,10 +284,9 @@ path_from_command_line_arg (const char *arg)
}
static void
-open_urls (GNOME_EphyAutomation automation,
+open_urls (DBusGProxy *proxy,
guint32 user_time,
const char **args,
- CORBA_Environment *ev,
gboolean new_tab,
gboolean existing_window,
gboolean fullscreen)
@@ -333,9 +296,10 @@ open_urls (GNOME_EphyAutomation automation,
if (args == NULL)
{
/* Homepage or resume */
- GNOME_EphyAutomation_loadUrlWithStartupId
- (automation, "", fullscreen,
- existing_window, new_tab, user_time, ev);
+ org_gnome_Epiphany_load_url_async
+ (proxy, "", fullscreen, existing_window, new_tab,
+ user_time, ephy_activation_general_purpose_reply,
+ NULL);
}
else
{
@@ -345,9 +309,10 @@ open_urls (GNOME_EphyAutomation automation,
path = path_from_command_line_arg (args[i]);
- GNOME_EphyAutomation_loadUrlWithStartupId
- (automation, path, fullscreen,
- existing_window, new_tab, user_time, ev);
+ org_gnome_Epiphany_load_url_async
+ (proxy, path, fullscreen, existing_window,
+ new_tab, user_time,
+ ephy_activation_general_purpose_reply, NULL);
g_free (path);
}
@@ -407,6 +372,13 @@ die_cb (GnomeClient* client,
}
static void
+dbus_g_proxy_finalized_cb (EphyShell *ephy_shell,
+ GObject *where_the_object_was)
+{
+ g_object_unref (ephy_shell);
+}
+
+static void
gnome_session_init (EphyShell *shell)
{
GnomeClient *client;
@@ -430,96 +402,77 @@ ephy_shell_startup (EphyShell *shell,
const char *string_arg,
GError **error)
{
- CORBA_Environment ev;
- GNOME_EphyAutomation automation;
- Bonobo_RegistrationResult result;
+ EphyDbus *ephy_dbus;
+ DBusGProxy *proxy;
ephy_ensure_dir_exists (ephy_dot_dir ());
- CORBA_exception_init (&ev);
-
- result = bonobo_activation_register_active_server
- (AUTOMATION_FACTORY_IID, BONOBO_OBJREF (shell->priv->automation_factory), NULL);
+ ephy_dbus = EPHY_DBUS (ephy_shell_get_dbus_service (shell));
+ g_assert (ephy_dbus != NULL);
- switch (result)
+ proxy = ephy_dbus_get_proxy (ephy_dbus, EPHY_DBUS_SESSION);
+ if (proxy == NULL)
{
- case Bonobo_ACTIVATION_REG_SUCCESS:
- break;
- case Bonobo_ACTIVATION_REG_ALREADY_ACTIVE:
- break;
- case Bonobo_ACTIVATION_REG_NOT_LISTED:
- g_set_error (error, EPHY_SHELL_ERROR,
- EPHY_SHELL_ERROR_MISSING_SERVER,
- _("Bonobo couldn't locate the GNOME_Epiphany_Automation.server "
- "file. You can use bonobo-activation-sysconf to configure "
- "the search path for bonobo server files."));
- break;
- case Bonobo_ACTIVATION_REG_ERROR:
- g_set_error (error, EPHY_SHELL_ERROR,
- EPHY_SHELL_ERROR_FACTORY_REG_FAILED,
- _("Epiphany can't be used now, due to an unexpected error "
- "from Bonobo when attempting to register the automation "
- "server"));
- break;
- default:
- g_assert_not_reached ();
+ g_warning ("Unable to get DBus proxy; aborting activation.");
+ gdk_notify_startup_complete ();
+ return FALSE;
}
+ g_object_ref (ephy_shell);
+ g_object_weak_ref (G_OBJECT (proxy),
+ (GWeakNotify) dbus_g_proxy_finalized_cb,
+ ephy_shell);
- if (result == Bonobo_ACTIVATION_REG_SUCCESS ||
- result == Bonobo_ACTIVATION_REG_ALREADY_ACTIVE)
+ if (ephy_dbus->is_session_service_owner == TRUE)
{
- automation = bonobo_activation_activate_from_id (AUTOMATION_IID,
- 0, NULL, &ev);
- if (CORBA_Object_is_nil (automation, &ev))
- {
- g_set_error (error, EPHY_SHELL_ERROR,
- EPHY_SHELL_ERROR_OBJECT_REG_FAILED,
- _("Epiphany can't be used now, due to an unexpected error "
- "from Bonobo when attempting to locate the automation "
- "object."));
- automation = NULL;
- goto done;
- }
+ LOG ("Instance is session service owner");
/* init the session manager up here so we can quit while the resume dialogue is on */
gnome_session_init (shell);
+ }
- if (flags & EPHY_SHELL_STARTUP_BOOKMARKS_EDITOR)
- {
- GNOME_EphyAutomation_openBookmarksEditorWithStartupId
- (automation, user_time, &ev);
- }
- else if (flags & EPHY_SHELL_STARTUP_SESSION)
- {
- GNOME_EphyAutomation_loadSessionWithStartupId
- (automation, string_arg, user_time, &ev);
- }
- else if (flags & EPHY_SHELL_STARTUP_IMPORT_BOOKMARKS)
- {
- GNOME_EphyAutomation_importBookmarks
- (automation, string_arg, &ev);
- }
- else if (flags & EPHY_SHELL_STARTUP_ADD_BOOKMARK)
- {
- GNOME_EphyAutomation_addBookmark
- (automation, string_arg, &ev);
- }
- else
+ if (flags & EPHY_SHELL_STARTUP_BOOKMARKS_EDITOR)
+ {
+ org_gnome_Epiphany_open_bookmarks_editor_async
+ (proxy, user_time,
+ ephy_activation_general_purpose_reply, ephy_shell);
+ }
+ else if (flags & EPHY_SHELL_STARTUP_SESSION)
+ {
+ org_gnome_Epiphany_load_session_async
+ (proxy, string_arg, user_time,
+ ephy_activation_general_purpose_reply, ephy_shell);
+ }
+ else if (flags & EPHY_SHELL_STARTUP_IMPORT_BOOKMARKS)
+ {
+ org_gnome_Epiphany_import_bookmarks_async
+ (proxy, string_arg,
+ ephy_activation_general_purpose_reply, ephy_shell);
+ }
+ else if (flags & EPHY_SHELL_STARTUP_ADD_BOOKMARK)
+ {
+ org_gnome_Epiphany_add_bookmark_async
+ (proxy, string_arg,
+ ephy_activation_general_purpose_reply, ephy_shell);
+ }
+ else
+ {
+ /* no need to open the homepage if autoresume returns TRUE;
+ * we already opened session windows */
+ if ((ephy_dbus->is_session_service_owner == FALSE) ||
+ (ephy_session_autoresume
+ (EPHY_SESSION (ephy_shell_get_session (ephy_shell)),
+ user_time) == FALSE))
{
- open_urls (automation, user_time, args, &ev,
+ open_urls (proxy, user_time, args,
flags & EPHY_SHELL_STARTUP_TABS,
flags & EPHY_SHELL_STARTUP_EXISTING_WINDOW,
flags & EPHY_SHELL_STARTUP_FULLSCREEN);
}
-
- bonobo_object_release_unref (automation, &ev);
}
-done:
- CORBA_exception_free (&ev);
+ dbus_g_connection_flush (ephy_dbus_get_bus (ephy_dbus, EPHY_DBUS_SESSION));
gdk_notify_startup_complete ();
-
- return !(result == Bonobo_ACTIVATION_REG_ALREADY_ACTIVE);
+ return ephy_dbus->is_session_service_owner;
}
static void
@@ -530,16 +483,6 @@ ephy_shell_dispose (GObject *object)
LOG ("EphyShell disposing");
- if (priv->automation_factory != NULL)
- {
- LOG ("Deregistering bonobo server");
- bonobo_activation_unregister_active_server
- (AUTOMATION_FACTORY_IID, BONOBO_OBJREF (priv->automation_factory));
-
- bonobo_object_unref (priv->automation_factory);
- priv->automation_factory = NULL;
- }
-
if (shell->priv->extensions_manager != NULL)
{
LOG ("Unref extension manager");