diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rwxr-xr-x | embed/find-dialog.c | 54 |
2 files changed, 59 insertions, 2 deletions
@@ -1,3 +1,10 @@ +2003-06-17 Christian Persch <chpe@cvs.gnome.org> + + * 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 <xan@masilla.org> * 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,9 +206,11 @@ 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); @@ -215,6 +218,50 @@ sync_embed (FindDialog *dialog, GParamSpec *pspec, gpointer data) } 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) { dialog->priv = g_new0 (FindDialogPrivate, 1); @@ -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); |