aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-shell.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-01-26 05:52:27 +0800
committerChristian Persch <chpe@src.gnome.org>2006-01-26 05:52:27 +0800
commitdd06e70a33a386b716fedd68393885f45a343b68 (patch)
tree97e77dd243f3d714f0571a62b4db7c53cb17d2aa /src/ephy-shell.c
parent48828a1977fc21c6fc6d03fa6003a081bf14b017 (diff)
downloadgsoc2013-epiphany-dd06e70a33a386b716fedd68393885f45a343b68.tar
gsoc2013-epiphany-dd06e70a33a386b716fedd68393885f45a343b68.tar.gz
gsoc2013-epiphany-dd06e70a33a386b716fedd68393885f45a343b68.tar.bz2
gsoc2013-epiphany-dd06e70a33a386b716fedd68393885f45a343b68.tar.lz
gsoc2013-epiphany-dd06e70a33a386b716fedd68393885f45a343b68.tar.xz
gsoc2013-epiphany-dd06e70a33a386b716fedd68393885f45a343b68.tar.zst
gsoc2013-epiphany-dd06e70a33a386b716fedd68393885f45a343b68.zip
libnm-glib be-gone! Use NetworkManager directly via DBUS, by importing the
2006-01-25 Christian Persch <chpe@cvs.gnome.org> * configure.ac: * data/epiphany.schemas.in: * embed/mozilla/Makefile.am: * embed/mozilla/mozilla-embed-single.cpp: * lib/ephy-prefs.h: * src/Makefile.am: * src/ephy-net-monitor.c: * src/ephy-net-monitor.h: * src/ephy-shell.c: (ephy_shell_sync_network_status), (impl_get_embed_single), (ephy_shell_dispose), (ephy_shell_get_net_monitor), (_ephy_shell_create_instance), (_ephy_shell_startup): * src/ephy-shell.h: libnm-glib be-gone! Use NetworkManager directly via DBUS, by importing the excellent net-monitor extension directly into Epiphany. Code by Jean-François Rameau.
Diffstat (limited to 'src/ephy-shell.c')
-rw-r--r--src/ephy-shell.c77
1 files changed, 71 insertions, 6 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 62b2788d6..810f3ca8b 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2004 Marco Pesenti Gritti
- * Copyright (C) 2003, 2004 Christian Persch
+ * Copyright (C) 2003, 2004, 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
@@ -54,7 +54,9 @@
#include <dirent.h>
#include <unistd.h>
-#define AUTOMATION_IID "OAFIID:GNOME_Epiphany_Automation"
+#ifdef ENABLE_NETWORK_MANAGER
+#include "ephy-net-monitor.h"
+#endif
#define EPHY_SHELL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SHELL, EphyShellPrivate))
@@ -66,13 +68,17 @@ struct _EphyShellPrivate
EggToolbarsModel *toolbars_model;
EggToolbarsModel *fs_toolbars_model;
EphyExtensionsManager *extensions_manager;
+#ifdef ENABLE_NETWORK_MANAGER
+ EphyNetMonitor *net_monitor;
+#endif
GtkWidget *bme;
GtkWidget *history_window;
GObject *pdm_dialog;
GObject *prefs_dialog;
GObject *print_setup_dialog;
GList *del_on_exit;
- gboolean embed_single_connected;
+
+ guint embed_single_connected : 1;
};
EphyShell *ephy_shell = NULL;
@@ -83,7 +89,7 @@ static void ephy_shell_dispose (GObject *object);
static void ephy_shell_finalize (GObject *object);
static GObject *impl_get_embed_single (EphyEmbedShell *embed_shell);
-static GObjectClass *parent_class = NULL;
+static GObjectClass *parent_class;
GType
ephy_shell_get_type (void)
@@ -209,15 +215,38 @@ ephy_shell_add_sidebar_cb (EphyEmbedSingle *embed_single,
return TRUE;
}
+#ifdef ENABLE_NETWORK_MANAGER
+
+static void
+ephy_shell_sync_network_status (EphyNetMonitor *net_monitor,
+ GParamSpec *pspec,
+ EphyShell *shell)
+{
+ EphyShellPrivate *priv = shell->priv;
+ EphyEmbedSingle *single;
+ gboolean net_status;
+
+ if (!priv->embed_single_connected) return;
+
+ single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (EPHY_EMBED_SHELL (shell)));
+
+ net_status = ephy_net_monitor_get_net_status (net_monitor);
+ ephy_embed_single_set_network_status (single, net_status);
+}
+
+#endif /* ENABLE_NETWORK_MANAGER */
+
static GObject*
impl_get_embed_single (EphyEmbedShell *embed_shell)
{
EphyShell *shell = EPHY_SHELL (embed_shell);
+ EphyShellPrivate *priv = shell->priv;
GObject *embed_single;
embed_single = EPHY_EMBED_SHELL_CLASS (parent_class)->get_embed_single (embed_shell);
- if (embed_single != NULL && shell->priv->embed_single_connected == FALSE)
+ if (embed_single != NULL &&
+ priv->embed_single_connected == FALSE)
{
g_signal_connect_object (embed_single, "new-window",
G_CALLBACK (ephy_shell_new_window_cb),
@@ -227,7 +256,13 @@ impl_get_embed_single (EphyEmbedShell *embed_shell)
G_CALLBACK (ephy_shell_add_sidebar_cb),
shell, G_CONNECT_AFTER);
- shell->priv->embed_single_connected = TRUE;
+#ifdef ENABLE_NETWORK_MANAGER
+ /* Now we need the net monitor */
+ ephy_shell_get_net_monitor (shell);
+ ephy_shell_sync_network_status (priv->net_monitor, NULL, shell);
+#endif
+
+ priv->embed_single_connected = TRUE;
}
return embed_single;
@@ -333,6 +368,17 @@ ephy_shell_dispose (GObject *object)
priv->bookmarks = NULL;
}
+#ifdef ENABLE_NETWORK_MANAGER
+ if (priv->net_monitor != NULL)
+ {
+ LOG ("Unref net monitor");
+ g_signal_handlers_disconnect_by_func
+ (priv->net_monitor, G_CALLBACK (ephy_shell_sync_network_status), shell);
+ g_object_unref (priv->net_monitor);
+ priv->net_monitor = NULL;
+ }
+#endif /* ENABLE_NETWORK_MANAGER */
+
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -673,6 +719,25 @@ ephy_shell_get_extensions_manager (EphyShell *es)
return G_OBJECT (es->priv->extensions_manager);
}
+GObject *
+ephy_shell_get_net_monitor (EphyShell *shell)
+{
+#ifdef ENABLE_NETWORK_MANAGER
+ EphyShellPrivate *priv = shell->priv;
+
+ if (priv->net_monitor == NULL)
+ {
+ priv->net_monitor = ephy_net_monitor_new ();
+ g_signal_connect (priv->net_monitor, "notify::network-status",
+ G_CALLBACK (ephy_shell_sync_network_status), shell);
+ }
+
+ return G_OBJECT (priv->net_monitor);
+#else
+ return NULL;
+#endif /* ENABLE_NETWORK_MANAGER */
+}
+
static void
toolwindow_show_cb (GtkWidget *widget, EphyShell *es)
{