From c33c109a185dcb6b363c72189ba1201b2f593cfd Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Tue, 17 Jun 2003 20:41:21 +0000 Subject: Re-enable the next/prev buttons on page change. 2003-06-17 Christian Persch * embed/find-dialog.c: (sync_page_change), (unset_old_embed), (sync_embed), (find_dialog_init), (find_dialog_finalize): Re-enable the next/prev buttons on page change. --- ChangeLog | 7 +++++++ embed/find-dialog.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 40d364216..0ff73ad00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-06-17 Christian Persch + + * embed/find-dialog.c: (sync_page_change), (unset_old_embed), + (sync_embed), (find_dialog_init), (find_dialog_finalize): + + Re-enable the next/prev buttons on page change. + 2003-06-17 Xan Lopez * embed/find-dialog.c: (find_get_info): diff --git a/embed/find-dialog.c b/embed/find-dialog.c index 6f41a70ee..5e6c844a8 100755 --- a/embed/find-dialog.c +++ b/embed/find-dialog.c @@ -60,6 +60,7 @@ struct FindDialogPrivate GtkWidget *window; gboolean constructed; FindNavigationFlags nav_flags; + EphyEmbed *old_embed; }; enum @@ -205,15 +206,61 @@ ensure_constructed (FindDialog *dialog) } static void -sync_embed (FindDialog *dialog, GParamSpec *pspec, gpointer data) +sync_page_change (EphyEmbed *embed, FindDialog *dialog) { - LOG ("EphyEmbed changed") + g_return_if_fail (IS_EPHY_EMBED (embed)); + + if (dialog->priv->constructed == FALSE) return; set_navigation_flags (dialog, FIND_CAN_GO_PREV | FIND_CAN_GO_NEXT); find_get_info (EPHY_DIALOG (dialog)); } +static void +unset_old_embed (FindDialog *dialog) +{ + if (dialog->priv->old_embed != NULL) + { + g_signal_handlers_disconnect_by_func (dialog->priv->old_embed, + G_CALLBACK (sync_page_change), + dialog); + g_object_remove_weak_pointer (G_OBJECT (dialog->priv->old_embed), + (gpointer *)&dialog->priv->old_embed); + + dialog->priv->old_embed = NULL; + } +} + +static void +sync_embed (FindDialog *dialog, GParamSpec *pspec, gpointer data) +{ + EphyEmbed *embed; + + unset_old_embed (dialog); + + embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG (dialog)); + g_return_if_fail (IS_EPHY_EMBED (embed)); + dialog->priv->old_embed = embed; + + g_signal_connect (G_OBJECT (embed), "ge_location", + G_CALLBACK (sync_page_change), dialog); + + g_object_add_weak_pointer (G_OBJECT (embed), + (gpointer *)&dialog->priv->old_embed); + + if (dialog->priv->constructed) + { + set_navigation_flags (dialog, FIND_CAN_GO_PREV | FIND_CAN_GO_NEXT); + + find_get_info (EPHY_DIALOG (dialog)); + } + else + { + set_navigation_flags (dialog, 0); + } +} + static void find_dialog_init (FindDialog *dialog) { @@ -222,6 +269,7 @@ find_dialog_init (FindDialog *dialog) dialog->priv->properties = NULL; dialog->priv->nav_flags = 0; dialog->priv->constructed = FALSE; + dialog->priv->old_embed = NULL; g_signal_connect_object (dialog, "notify::embed", G_CALLBACK (sync_embed), NULL, 0); @@ -335,6 +383,8 @@ find_dialog_finalize (GObject *object) g_return_if_fail (dialog->priv != NULL); + unset_old_embed (dialog); + g_free (dialog->priv); G_OBJECT_CLASS (parent_class)->finalize (object); -- cgit