aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-04-15 23:59:55 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-04-15 23:59:55 +0800
commit7e61b74638a8d3858f1d019ecc4331b833b680ff (patch)
tree84e37a320bf3938f9045c875d9802cf7d94b1c29 /src
parenta1962faa29d9f42ed0dfeab8126767470c4be6e0 (diff)
downloadgsoc2013-epiphany-7e61b74638a8d3858f1d019ecc4331b833b680ff.tar
gsoc2013-epiphany-7e61b74638a8d3858f1d019ecc4331b833b680ff.tar.gz
gsoc2013-epiphany-7e61b74638a8d3858f1d019ecc4331b833b680ff.tar.bz2
gsoc2013-epiphany-7e61b74638a8d3858f1d019ecc4331b833b680ff.tar.lz
gsoc2013-epiphany-7e61b74638a8d3858f1d019ecc4331b833b680ff.tar.xz
gsoc2013-epiphany-7e61b74638a8d3858f1d019ecc4331b833b680ff.tar.zst
gsoc2013-epiphany-7e61b74638a8d3858f1d019ecc4331b833b680ff.zip
Hidden pref for middle click open url. Default off.
2003-04-15 Marco Pesenti Gritti <marco@it.gnome.org> * data/epiphany.schemas.in: * lib/ephy-prefs.h: * src/ephy-tab.c: (ephy_tab_init), (ephy_tab_dom_mouse_down_cb): Hidden pref for middle click open url. Default off. * src/bookmarks/ephy-bookmarks-editor.c: (ephy_bookmarks_editor_update_menu), (ephy_bookmarks_editor_dispose), (keyword_node_selected_cb), (keyword_node_show_popup_cb), (build_search_box), (menu_activate_cb), (ephy_bookmarks_editor_construct): * src/bookmarks/ephy-node-view.c: (cell_renderer_edited), (ephy_node_view_init), (ephy_node_view_edit), (ephy_node_view_is_editing): * src/bookmarks/ephy-node-view.h: Rework sensitivity updates and complete them with cut/copy/select all
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c97
-rw-r--r--src/bookmarks/ephy-node-view.c13
-rw-r--r--src/bookmarks/ephy-node-view.h2
-rw-r--r--src/ephy-tab.c24
4 files changed, 63 insertions, 73 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 7239f2d20..8434635d9 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -502,9 +502,30 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
gboolean key_selection, bmk_selection;
gboolean key_normal = FALSE;
gboolean bmk_multiple_selection;
+ gboolean cut, copy, select_all;
EggActionGroup *action_group;
EggAction *action;
GList *selected;
+ GtkWidget *focus_widget;
+
+ focus_widget = gtk_window_get_focus (GTK_WINDOW (editor));
+ if (GTK_IS_EDITABLE (focus_widget))
+ {
+ gboolean has_selection;
+
+ has_selection = gtk_editable_get_selection_bounds
+ (GTK_EDITABLE (focus_widget), NULL, NULL);
+
+ select_all = TRUE;
+ cut = has_selection;
+ copy = has_selection;
+ }
+ else
+ {
+ select_all = FALSE;
+ cut = FALSE;
+ copy = FALSE;
+ }
bmk_focus = gtk_widget_is_focus (editor->priv->bm_view);
key_focus = gtk_widget_is_focus (editor->priv->key_view);
@@ -560,37 +581,12 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
g_object_set (action, "sensitive", delete, NULL);
action = egg_action_group_get_action (action_group, "Properties");
g_object_set (action, "sensitive", properties, NULL);
-}
-
-static gboolean
-view_focus_cb (EphyNodeView *view,
- GdkEventFocus *event,
- EphyBookmarksEditor *editor)
-{
- ephy_bookmarks_editor_update_menu (editor);
-
- return FALSE;
-}
-
-static void
-add_focus_monitor (EphyBookmarksEditor *editor, GtkWidget *widget)
-{
- g_signal_connect (G_OBJECT (widget),
- "focus_in_event",
- G_CALLBACK (view_focus_cb),
- editor);
- g_signal_connect (G_OBJECT (widget),
- "focus_out_event",
- G_CALLBACK (view_focus_cb),
- editor);
-}
-
-static void
-remove_focus_monitor (EphyBookmarksEditor *editor, GtkWidget *widget)
-{
- g_signal_handlers_disconnect_by_func (G_OBJECT (widget),
- G_CALLBACK (view_focus_cb),
- editor);
+ action = egg_action_group_get_action (action_group, "Cut");
+ g_object_set (action, "sensitive", cut, NULL);
+ action = egg_action_group_get_action (action_group, "Copy");
+ g_object_set (action, "sensitive", copy, NULL);
+ action = egg_action_group_get_action (action_group, "SelectAll");
+ g_object_set (action, "sensitive", select_all, NULL);
}
static void
@@ -610,10 +606,6 @@ ephy_bookmarks_editor_dispose (GObject *object)
if (editor->priv->key_view != NULL)
{
- remove_focus_monitor (editor, editor->priv->key_view);
- remove_focus_monitor (editor, editor->priv->bm_view);
- remove_focus_monitor (editor, editor->priv->search_entry);
-
selection = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->key_view));
if (selection == NULL || selection->data == NULL)
{
@@ -639,15 +631,6 @@ ephy_bookmarks_editor_dispose (GObject *object)
G_OBJECT_CLASS (parent_class)->dispose (object);
}
-
-static void
-ephy_bookmarks_editor_node_selected_cb (EphyNodeView *view,
- EphyNode *node,
- EphyBookmarksEditor *editor)
-{
- ephy_bookmarks_editor_update_menu (editor);
-}
-
static void
bookmarks_filter (EphyBookmarksEditor *editor,
EphyNode *keyword)
@@ -710,8 +693,6 @@ keyword_node_selected_cb (EphyNodeView *view,
reset_search_entry (editor);
bookmarks_filter (editor, node);
}
-
- ephy_bookmarks_editor_update_menu (editor);
}
static void
@@ -721,6 +702,7 @@ keyword_node_show_popup_cb (GtkWidget *view, EphyBookmarksEditor *editor)
widget = egg_menu_merge_get_widget (editor->priv->ui_merge,
"/popups/EphyBookmarkKeywordPopup");
+ ephy_bookmarks_editor_update_menu (editor);
gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL, 2,
gtk_get_current_event_time ());
}
@@ -779,11 +761,10 @@ build_search_box (EphyBookmarksEditor *editor)
entry = gtk_entry_new ();
editor->priv->search_entry = entry;
gtk_widget_show (entry);
- add_focus_monitor (editor, entry);
g_signal_connect (G_OBJECT (entry), "changed",
G_CALLBACK (search_entry_changed_cb),
editor);
-
+
label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
str = g_strconcat ("<b>", _("_Search:"), "</b>", NULL);
@@ -833,12 +814,20 @@ node_dropped_cb (EphyNodeView *view, EphyNode *node,
}
static void
+menu_activate_cb (EphyNodeView *view,
+ EphyBookmarksEditor *editor)
+{
+ ephy_bookmarks_editor_update_menu (editor);
+}
+
+static void
ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
{
GtkTreeSelection *selection;
GtkWidget *hbox, *vbox;
GtkWidget *bm_view, *key_view;
GtkWidget *scrolled_window;
+ GtkWidget *menu;
EphyNode *node;
long selected_id;
EphyNode *selected_node;
@@ -885,6 +874,12 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
editor->priv->ui_merge = ui_merge;
editor->priv->action_group = action_group;
+ /* Update menu sensitivity before showing them */
+ menu = egg_menu_merge_get_widget (ui_merge, "/menu/FileMenu");
+ g_signal_connect (menu, "activate", G_CALLBACK (menu_activate_cb), editor);
+ menu = egg_menu_merge_get_widget (ui_merge, "/menu/EditMenu");
+ g_signal_connect (menu, "activate", G_CALLBACK (menu_activate_cb), editor);
+
hbox = gtk_hbox_new (FALSE, 6);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
gtk_container_add (GTK_CONTAINER (editor->priv->menu_dock), hbox);
@@ -921,7 +916,6 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
gtk_widget_set_size_request (key_view, 130, -1);
gtk_widget_show (key_view);
editor->priv->key_view = key_view;
- add_focus_monitor (editor, key_view);
g_signal_connect (G_OBJECT (key_view),
"key_press_event",
G_CALLBACK (key_pressed_cb),
@@ -974,7 +968,6 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
gtk_container_add (GTK_CONTAINER (scrolled_window), bm_view);
gtk_widget_show (bm_view);
editor->priv->bm_view = bm_view;
- add_focus_monitor (editor, bm_view);
g_signal_connect (G_OBJECT (bm_view),
"key_press_event",
G_CALLBACK (key_pressed_cb),
@@ -984,10 +977,6 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
G_CALLBACK (ephy_bookmarks_editor_node_activated_cb),
editor);
g_signal_connect (G_OBJECT (bm_view),
- "node_selected",
- G_CALLBACK (ephy_bookmarks_editor_node_selected_cb),
- editor);
- g_signal_connect (G_OBJECT (bm_view),
"show_popup",
G_CALLBACK (ephy_bookmarks_editor_show_popup_cb),
editor);
diff --git a/src/bookmarks/ephy-node-view.c b/src/bookmarks/ephy-node-view.c
index 1a2a0cf3d..dcadb13bc 100644
--- a/src/bookmarks/ephy-node-view.c
+++ b/src/bookmarks/ephy-node-view.c
@@ -62,6 +62,8 @@ struct EphyNodeViewPrivate
EphyTreeModelNodeColumn default_sort_column_id;
GtkTargetList *drag_targets;
+
+ gboolean editing;
};
enum
@@ -522,6 +524,8 @@ cell_renderer_edited (GtkCellRendererText *cell,
GtkTreeIter iter, iter2;
EphyNode *node;
+ view->priv->editing = FALSE;
+
g_object_set (G_OBJECT (view->priv->editable_renderer),
"editable", FALSE,
NULL);
@@ -622,6 +626,7 @@ ephy_node_view_init (EphyNodeView *view)
{
view->priv = g_new0 (EphyNodeViewPrivate, 1);
view->priv->editable_renderer = NULL;
+ view->priv->editing = TRUE;
}
static void
@@ -900,11 +905,19 @@ ephy_node_view_edit (EphyNodeView *view)
view->priv->editable_column,
TRUE);
+ view->priv->editing = TRUE;
+
g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
g_list_free (rows);
}
gboolean
+ephy_node_view_is_editing (EphyNodeView *view)
+{
+ return view->priv->editing;
+}
+
+gboolean
ephy_node_view_has_selection (EphyNodeView *view, gboolean *multiple)
{
GtkTreeSelection *selection;
diff --git a/src/bookmarks/ephy-node-view.h b/src/bookmarks/ephy-node-view.h
index 9aa91a876..f41b59489 100644
--- a/src/bookmarks/ephy-node-view.h
+++ b/src/bookmarks/ephy-node-view.h
@@ -92,6 +92,8 @@ void ephy_node_view_enable_drag_dest (EphyNodeView *view,
void ephy_node_view_edit (EphyNodeView *view);
+gboolean ephy_node_view_is_editing (EphyNodeView *view);
+
G_END_DECLS
#endif /* EPHY_NODE_VIEW_H */
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 256c48d2d..dea7707d5 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -113,10 +113,6 @@ static void
ephy_tab_size_to_cb (EphyEmbed *embed, gint width, gint height,
EphyTab *tab);
static gint
-ephy_tab_dom_mouse_click_cb (EphyEmbed *embed,
- EphyEmbedEvent *event,
- EphyTab *tab);
-static gint
ephy_tab_dom_mouse_down_cb (EphyEmbed *embed,
EphyEmbedEvent *event,
EphyTab *tab);
@@ -262,9 +258,6 @@ ephy_tab_init (EphyTab *tab)
g_signal_connect (embed, "ge_size_to",
GTK_SIGNAL_FUNC (ephy_tab_size_to_cb),
tab);
- g_signal_connect (embed, "ge_dom_mouse_click",
- GTK_SIGNAL_FUNC (ephy_tab_dom_mouse_click_cb),
- tab);
g_signal_connect (embed, "ge_dom_mouse_down",
GTK_SIGNAL_FUNC (ephy_tab_dom_mouse_down_cb),
tab);
@@ -881,14 +874,6 @@ ephy_tab_size_to_cb (EphyEmbed *embed, gint width, gint height,
}
}
-static gint
-ephy_tab_dom_mouse_click_cb (EphyEmbed *embed,
- EphyEmbedEvent *event,
- EphyTab *tab)
-{
- return FALSE;
-}
-
static void
ephy_tab_set_event (EphyTab *tab,
EphyEmbedEvent *event)
@@ -981,10 +966,11 @@ ephy_tab_dom_mouse_down_cb (EphyEmbed *embed,
ephy_shell_new_tab (ephy_shell, window, tab,
g_value_get_string (value), 0);
}
- else if (button == 1
- && !(context & EMBED_CONTEXT_LINK
- || context & EMBED_CONTEXT_EMAIL_LINK
- || context & EMBED_CONTEXT_INPUT))
+ else if (button == 1 &&
+ eel_gconf_get_boolean (CONF_INTERFACE_MIDDLE_CLICK_OPEN_URL) &&
+ !(context & EMBED_CONTEXT_LINK
+ || context & EMBED_CONTEXT_EMAIL_LINK
+ || context & EMBED_CONTEXT_INPUT))
{
/* paste url */
gtk_selection_convert (GTK_WIDGET (window),