aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-window.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2003-06-15 17:35:48 +0800
committerChristian Persch <chpe@src.gnome.org>2003-06-15 17:35:48 +0800
commit94a825c3865eacb771b64dd93ea7b0dff3c9db49 (patch)
tree87b012c17af788ad3aac39769ecc95f665e74095 /src/ephy-window.c
parent53471bc2f89c2844c7bb81b41575ee253c1f6516 (diff)
downloadgsoc2013-epiphany-94a825c3865eacb771b64dd93ea7b0dff3c9db49.tar
gsoc2013-epiphany-94a825c3865eacb771b64dd93ea7b0dff3c9db49.tar.gz
gsoc2013-epiphany-94a825c3865eacb771b64dd93ea7b0dff3c9db49.tar.bz2
gsoc2013-epiphany-94a825c3865eacb771b64dd93ea7b0dff3c9db49.tar.lz
gsoc2013-epiphany-94a825c3865eacb771b64dd93ea7b0dff3c9db49.tar.xz
gsoc2013-epiphany-94a825c3865eacb771b64dd93ea7b0dff3c9db49.tar.zst
gsoc2013-epiphany-94a825c3865eacb771b64dd93ea7b0dff3c9db49.zip
Make prev/next navigation capability an object property, and sync on embed
2003-06-15 Christian Persch <chpe@cvs.gnome.org> * embed/find-dialog.h: * embed/find-dialog.c: (set_navigation_flags), (ephy_find_dialog_get_property), (find_dialog_class_init), (sync_embed), (find_get_info), (impl_show), (find_dialog_finalize), (find_dialog_go_next), (find_dialog_go_prev), (find_entry_changed_cb), (find_check_toggled_cb), (find_dialog_get_navigation_flags): Make prev/next navigation capability an object property, and sync on embed changes. * embed/find-dialog.c: (find_dialog_new_with_parent): * embed/ephy-embed-dialog.c: (ephy_embed_dialog_class_init), (ephy_embed_dialog_new), (ephy_embed_dialog_new_with_parent), (ephy_embed_dialog_set_embed): * embed/print-dialog.c: (print_dialog_new), (print_dialog_new_with_parent): s/EphyEmbed/embed/ for the object property name. * src/ephy-window.h: * src/ephy-window.c: (sync_find_dialog), (update_find_control), (ephy_window_switch_page_cb), (find_dialog_search_cb), (ephy_window_get_find_dialog): * src/window-commands.c: (window_cmd_edit_find_next), (window_cmd_edit_find_prev): Sync on the find dialog on nav capability and embed changes instead of explicit updating.
Diffstat (limited to 'src/ephy-window.c')
-rw-r--r--src/ephy-window.c79
1 files changed, 34 insertions, 45 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c
index aea9399f0..aec447159 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -514,6 +514,32 @@ 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;
@@ -756,8 +782,6 @@ sync_tab_visibility (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
if (window->priv->closing) return;
- LOG ("sync tab visibility window %p tab %p", window, tab)
-
tabs = ephy_window_get_tabs (window);
for (l = tabs; l != NULL; l = l->next)
{
@@ -1139,6 +1163,9 @@ ephy_window_finalize (GObject *object)
if (window->priv->find_dialog)
{
+ g_signal_handlers_disconnect_by_func (window->priv->find_dialog,
+ G_CALLBACK (sync_find_dialog),
+ window);
g_object_unref (G_OBJECT (window->priv->find_dialog));
}
@@ -1546,25 +1573,6 @@ update_favorites_control (EphyWindow *window)
ephy_favorites_menu_update (window->priv->fav_menu);
}
-static void
-update_find_control (EphyWindow *window)
-{
- gboolean can_go_next, can_go_prev;
-
- if (window->priv->find_dialog)
- {
- can_go_next = find_dialog_can_go_next
- (FIND_DIALOG(window->priv->find_dialog));
- can_go_prev = find_dialog_can_go_prev
- (FIND_DIALOG(window->priv->find_dialog));
-/*
- ephy_bonobo_set_sensitive (BONOBO_UI_COMPONENT(window->ui_component),
- EDIT_FIND_NEXT_CMD_PATH, can_go_next);
- ephy_bonobo_set_sensitive (BONOBO_UI_COMPONENT(window->ui_component),
- EDIT_FIND_PREV_CMD_PATH, can_go_prev);*/
- }
-}
-
void
ephy_window_update_control (EphyWindow *window,
ControlID control)
@@ -1573,9 +1581,6 @@ ephy_window_update_control (EphyWindow *window,
switch (control)
{
- case FindControl:
- update_find_control (window);
- break;
case FavoritesControl:
update_favorites_control (window);
break;
@@ -1585,17 +1590,6 @@ ephy_window_update_control (EphyWindow *window,
}
}
-void
-ephy_window_update_all_controls (EphyWindow *window)
-{
- g_return_if_fail (IS_EPHY_WINDOW (window));
-
- if (ephy_window_get_active_tab (window) != NULL)
- {
- update_find_control (window);
- }
-}
-
EphyTab *
ephy_window_get_active_tab (EphyWindow *window)
{
@@ -1698,16 +1692,9 @@ ephy_window_notebook_switch_page_cb (GtkNotebook *notebook,
update_embed_dialogs (window, tab);
/* update window controls */
- ephy_window_update_all_controls (window);
update_tabs_menu_sensitivity (window);
}
-static void
-find_dialog_search_cb (FindDialog *dialog, EphyWindow *window)
-{
- ephy_window_update_control (window, FindControl);
-}
-
EphyDialog *
ephy_window_get_find_dialog (EphyWindow *window)
{
@@ -1724,9 +1711,11 @@ ephy_window_get_find_dialog (EphyWindow *window)
dialog = find_dialog_new_with_parent (GTK_WIDGET(window),
embed);
- g_signal_connect (dialog, "search",
- G_CALLBACK (find_dialog_search_cb),
- 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);
window->priv->find_dialog = dialog;