aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-07-20 19:05:16 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-07-20 19:05:16 +0800
commit370874c6ca4c695eeba57ec7f7d059830287e637 (patch)
tree83c191b8b9d5607404f405ec58511f383a6b0537 /src
parentba9c622c3574f82c1662aa9f0c3d676a217a1066 (diff)
downloadgsoc2013-epiphany-370874c6ca4c695eeba57ec7f7d059830287e637.tar
gsoc2013-epiphany-370874c6ca4c695eeba57ec7f7d059830287e637.tar.gz
gsoc2013-epiphany-370874c6ca4c695eeba57ec7f7d059830287e637.tar.bz2
gsoc2013-epiphany-370874c6ca4c695eeba57ec7f7d059830287e637.tar.lz
gsoc2013-epiphany-370874c6ca4c695eeba57ec7f7d059830287e637.tar.xz
gsoc2013-epiphany-370874c6ca4c695eeba57ec7f7d059830287e637.tar.zst
gsoc2013-epiphany-370874c6ca4c695eeba57ec7f7d059830287e637.zip
Rework find implementation to integrate better with type ahead and to
2003-07-20 Marco Pesenti Gritti <marco@it.gnome.org> * embed/ephy-embed.c: (ephy_embed_find_set_properties), (ephy_embed_find_next): * embed/ephy-embed.h: * embed/find-dialog.c: (update_navigation_controls), (impl_show), (find_dialog_class_init), (set_properties), (sync_page_change), (sync_embed), (find_dialog_init), (find_dialog_finalize), (find_dialog_go_next), (find_dialog_go_prev), (find_close_button_clicked_cb), (find_next_button_clicked_cb), (find_prev_button_clicked_cb), (find_entry_changed_cb), (find_check_toggled_cb): * embed/find-dialog.h: * embed/mozilla/EphyWrapper.cpp: * embed/mozilla/EphyWrapper.h: * embed/mozilla/Makefile.am: * embed/mozilla/mozilla-embed.cpp: * lib/ephy-dialog.h: * src/ephy-window.c: (ephy_window_find): * src/ephy-window.h: * src/window-commands.c: (window_cmd_edit_find), (window_cmd_edit_find_next), (window_cmd_edit_find_prev): Rework find implementation to integrate better with type ahead and to simplify the code. Do not try to set menus sensitivity because mozilla doesnt provide an api for it and it breaks with type ahead. * lib/ephy-dialog.c: (ephy_dialog_class_init), (ephy_dialog_finalize), (dialog_destroy_cb), (impl_construct), (ephy_dialog_construct): Remove no more used destruct crap.
Diffstat (limited to 'src')
-rw-r--r--src/ephy-window.c55
-rw-r--r--src/ephy-window.h2
-rw-r--r--src/window-commands.c22
3 files changed, 22 insertions, 57 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 2fda4cf13..1f58e3bb3 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -703,32 +703,6 @@ setup_window (EphyWindow *window)
}
static void
-sync_find_dialog (FindDialog *dialog, GParamSpec *spec, EphyWindow *window)
-{
- EggActionGroup *action_group;
- EggAction *action;
- FindNavigationFlags flags;
- gboolean can_go_prev = FALSE, can_go_next = FALSE;
-
- flags = find_dialog_get_navigation_flags (dialog);
-
- if (flags & FIND_CAN_GO_PREV)
- {
- can_go_prev = TRUE;
- }
- if (flags & FIND_CAN_GO_NEXT)
- {
- can_go_next = TRUE;
- }
-
- action_group = window->priv->action_group;
- action = egg_action_group_get_action (action_group, "EditFindPrev");
- g_object_set (action, "sensitive", can_go_prev, NULL);
- action = egg_action_group_get_action (action_group, "EditFindNext");
- g_object_set (action, "sensitive", can_go_next, NULL);
-}
-
-static void
sync_tab_address (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
{
const char *address;
@@ -1855,31 +1829,26 @@ ephy_window_notebook_switch_page_cb (GtkNotebook *notebook,
update_tabs_menu_sensitivity (window);
}
-EphyDialog *
-ephy_window_get_find_dialog (EphyWindow *window)
+void
+ephy_window_find (EphyWindow *window)
{
EphyDialog *dialog;
EphyEmbed *embed;
- if (window->priv->find_dialog)
+ if (window->priv->find_dialog == NULL)
{
- return window->priv->find_dialog;
- }
-
- embed = ephy_window_get_active_embed (window);
- g_return_val_if_fail (GTK_IS_WINDOW(window), NULL);
- dialog = find_dialog_new_with_parent (GTK_WIDGET(window),
- embed);
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (GTK_IS_WINDOW(window));
- sync_find_dialog (FIND_DIALOG (dialog), NULL, window);
- g_signal_connect_object (dialog, "notify::embed",
- G_CALLBACK (sync_find_dialog), window, 0);
- g_signal_connect_object (dialog, "notify::navigation",
- G_CALLBACK (sync_find_dialog), window, 0);
+ dialog = find_dialog_new_with_parent (GTK_WIDGET(window),
+ embed);
+ window->priv->find_dialog = dialog;
- window->priv->find_dialog = dialog;
+ g_object_add_weak_pointer(G_OBJECT (dialog),
+ (gpointer *) &window->priv->find_dialog);
+ }
- return dialog;
+ ephy_dialog_show (window->priv->find_dialog);
}
static void
diff --git a/src/ephy-window.h b/src/ephy-window.h
index 092c30020..d1eeb1d20 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -112,7 +112,7 @@ Toolbar *ephy_window_get_toolbar (EphyWindow *window);
/* Dialogs */
-EphyDialog *ephy_window_get_find_dialog (EphyWindow *window);
+void ephy_window_find (EphyWindow *window);
void ephy_window_print (EphyWindow *window);
diff --git a/src/window-commands.c b/src/window-commands.c
index 53b134eef..b53ebc709 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -23,7 +23,6 @@
#include "ephy-shell.h"
#include "ephy-debug.h"
#include "window-commands.h"
-#include "find-dialog.h"
#include "print-dialog.h"
#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
@@ -61,12 +60,7 @@ void
window_cmd_edit_find (EggAction *action,
EphyWindow *window)
{
- EphyDialog *dialog;
- dialog = ephy_window_get_find_dialog (window);
-
- g_object_ref (dialog);
-
- ephy_dialog_show (dialog);
+ ephy_window_find (window);
}
void
@@ -476,22 +470,24 @@ void
window_cmd_edit_find_next (EggAction *action,
EphyWindow *window)
{
- EphyDialog *dialog;
+ EphyEmbed *embed;
- dialog = ephy_window_get_find_dialog (window);
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
- find_dialog_go_next (FIND_DIALOG(dialog), FALSE);
+ ephy_embed_find_next (embed, FALSE);
}
void
window_cmd_edit_find_prev (EggAction *action,
EphyWindow *window)
{
- EphyDialog *dialog;
+ EphyEmbed *embed;
- dialog = ephy_window_get_find_dialog (window);
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (embed != NULL);
- find_dialog_go_prev (FIND_DIALOG(dialog), FALSE);
+ ephy_embed_find_next (embed, TRUE);
}
void