diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-04-06 02:06:14 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-04-06 02:06:14 +0800 |
commit | 00bd6433ec804c048128b37357d9a156ed982ba0 (patch) | |
tree | 389dd7efb0d32703941776e4f8024309d38f9eae | |
parent | 4c72a0ddd929854a4799fe59ddb9289bbbe7f1cc (diff) | |
download | gsoc2013-epiphany-00bd6433ec804c048128b37357d9a156ed982ba0.tar gsoc2013-epiphany-00bd6433ec804c048128b37357d9a156ed982ba0.tar.gz gsoc2013-epiphany-00bd6433ec804c048128b37357d9a156ed982ba0.tar.bz2 gsoc2013-epiphany-00bd6433ec804c048128b37357d9a156ed982ba0.tar.lz gsoc2013-epiphany-00bd6433ec804c048128b37357d9a156ed982ba0.tar.xz gsoc2013-epiphany-00bd6433ec804c048128b37357d9a156ed982ba0.tar.zst gsoc2013-epiphany-00bd6433ec804c048128b37357d9a156ed982ba0.zip |
Track the active window.
2004-04-05 Christian Persch <chpe@cvs.gnome.org>
* src/ephy-session.c: (window_focus_in_event_cb),
(impl_attach_window), (ephy_session_set_property),
(ephy_session_get_property), (ephy_session_class_init):
Track the active window.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/ephy-session.c | 66 |
2 files changed, 74 insertions, 0 deletions
@@ -1,5 +1,13 @@ 2004-04-05 Christian Persch <chpe@cvs.gnome.org> + * src/ephy-session.c: (window_focus_in_event_cb), + (impl_attach_window), (ephy_session_set_property), + (ephy_session_get_property), (ephy_session_class_init): + + Track the active window. + +2004-04-05 Christian Persch <chpe@cvs.gnome.org> + * data/glade/epiphany.glade: * data/glade/print.glade: diff --git a/src/ephy-session.c b/src/ephy-session.c index 3bf4d46f8..8fd43f5bf 100644 --- a/src/ephy-session.c +++ b/src/ephy-session.c @@ -65,6 +65,12 @@ static void ephy_session_class_init (EphySessionClass *klass); static void ephy_session_iface_init (EphyExtensionIface *iface); static void ephy_session_init (EphySession *session); +enum +{ + PROP_0, + PROP_ACTIVE_WINDOW +}; + static GObjectClass *parent_class = NULL; GType @@ -177,6 +183,25 @@ tabs_reordered_cb (GtkWidget *notebook, ephy_session_save (session, SESSION_CRASHED); } +static gboolean +window_focus_in_event_cb (EphyWindow *window, + GdkEventFocus *event, + EphySession *session) +{ + LOG ("focus-in-event for window %p", window) + + g_return_val_if_fail (g_list_find (session->priv->windows, window) != NULL, FALSE); + + /* move the active window to the front of the list */ + session->priv->windows = g_list_remove (session->priv->windows, window); + session->priv->windows = g_list_prepend (session->priv->windows, window); + + g_object_notify (G_OBJECT (session), "active-window"); + + /* propagate event */ + return FALSE; +} + static void impl_attach_window (EphyExtension *extension, EphyWindow *window) @@ -189,6 +214,9 @@ impl_attach_window (EphyExtension *extension, session->priv->windows = g_list_append (session->priv->windows, window); ephy_session_save (session, SESSION_CRASHED); + g_signal_connect (window, "focus-in-event", + G_CALLBACK (window_focus_in_event_cb), session); + notebook = ephy_window_get_notebook (window); g_signal_connect (notebook, "tab_added", G_CALLBACK (tab_added_cb), session); @@ -274,6 +302,33 @@ ephy_session_iface_init (EphyExtensionIface *iface) } static void +ephy_session_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + /* no writeable properties */ +} + +static void +ephy_session_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + EphySession *session = EPHY_SESSION (object); + + switch (prop_id) + { + case PROP_ACTIVE_WINDOW: + g_value_set_object (value, ephy_session_get_active_window (session)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void ephy_session_class_init (EphySessionClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); @@ -282,6 +337,17 @@ ephy_session_class_init (EphySessionClass *class) object_class->dispose = ephy_session_dispose; object_class->finalize = ephy_session_finalize; + object_class->get_property = ephy_session_get_property; + object_class->set_property = ephy_session_set_property; + + g_object_class_install_property + (object_class, + PROP_ACTIVE_WINDOW, + g_param_spec_object ("active-window", + "Active Window", + "The active window", + EPHY_TYPE_WINDOW, + G_PARAM_READABLE)); g_type_class_add_private (object_class, sizeof (EphySessionPrivate)); } |