diff options
author | David Bordoley <bordoley@msu.edu> | 2003-03-30 23:57:07 +0800 |
---|---|---|
committer | Dave Bordoley <Bordoley@src.gnome.org> | 2003-03-30 23:57:07 +0800 |
commit | a3638b15667bac68d1afe793ff6416c263d55328 (patch) | |
tree | 2492552f19c78f9da9d61431c41ba05c1cf2cd99 /src | |
parent | 33700d8d076cee88d0da1e12b4c27dfc0283139b (diff) | |
download | gsoc2013-epiphany-a3638b15667bac68d1afe793ff6416c263d55328.tar gsoc2013-epiphany-a3638b15667bac68d1afe793ff6416c263d55328.tar.gz gsoc2013-epiphany-a3638b15667bac68d1afe793ff6416c263d55328.tar.bz2 gsoc2013-epiphany-a3638b15667bac68d1afe793ff6416c263d55328.tar.lz gsoc2013-epiphany-a3638b15667bac68d1afe793ff6416c263d55328.tar.xz gsoc2013-epiphany-a3638b15667bac68d1afe793ff6416c263d55328.tar.zst gsoc2013-epiphany-a3638b15667bac68d1afe793ff6416c263d55328.zip |
Use hotkeys to navigate around the dialog.
2003-03-30 David Bordoley <bordoley@msu.edu>
* src/bookmarks/ephy-bookmark-properties.c: (build_ui):
* src/bookmarks/ephy-new-bookmark.c: (build_editing_table):
Use hotkeys to navigate around the dialog.
* src/bookmarks/ephy-topics-selector.c: (mneumonic_activated),
(ephy_topics_build_ui), (ephy_topics_selector_new):
Catch the mneumonic-activated signal and focus the currently
selected item in the list. If no items are selected, select the
first item.
* src/bookmarks/ephy-bookmarks-editor.c: (key_pressed_cb):
Change function to return a gboolean and return false
if we don't handle the key event (fixes keynav in the bme).
Diffstat (limited to 'src')
-rw-r--r-- | src/bookmarks/ephy-bookmark-properties.c | 41 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 6 | ||||
-rw-r--r-- | src/bookmarks/ephy-new-bookmark.c | 28 | ||||
-rw-r--r-- | src/bookmarks/ephy-topics-selector.c | 41 |
4 files changed, 72 insertions, 44 deletions
diff --git a/src/bookmarks/ephy-bookmark-properties.c b/src/bookmarks/ephy-bookmark-properties.c index 2096f139c..7a03a2d41 100644 --- a/src/bookmarks/ephy-bookmark-properties.c +++ b/src/bookmarks/ephy-bookmark-properties.c @@ -302,13 +302,7 @@ build_ui (EphyBookmarkProperties *editor) gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_widget_show (table); - - label = gtk_label_new (NULL); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - str = g_strconcat ("<b>", _("Title:"), "</b>", NULL); - gtk_label_set_markup (GTK_LABEL (label), str); - g_free (str); - gtk_widget_show (label); + entry = gtk_entry_new (); tmp = ephy_node_get_property_string (editor->priv->bookmark, EPHY_NODE_BMK_PROP_TITLE); @@ -319,15 +313,16 @@ build_ui (EphyBookmarkProperties *editor) editor->priv->title_entry = entry; gtk_widget_set_size_request (entry, 200, -1); gtk_widget_show (entry); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); - gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); - label = gtk_label_new (NULL); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - str = g_strconcat ("<b>", _("Location:"), "</b>", NULL); - gtk_label_set_markup (GTK_LABEL (label), str); + str = g_strconcat ("<b>", _("_Title:"), "</b>", NULL); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (label), str); g_free (str); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); + gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); + entry = gtk_entry_new (); tmp = ephy_node_get_property_string (editor->priv->bookmark, EPHY_NODE_BMK_PROP_LOCATION); @@ -337,21 +332,27 @@ build_ui (EphyBookmarkProperties *editor) gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); editor->priv->location_entry = entry; gtk_widget_show (entry); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); - gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); - label = gtk_label_new (NULL); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0); - str = g_strconcat ("<b>", _("Topics:"), "</b>", NULL); - gtk_label_set_markup (GTK_LABEL (label), str); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + str = g_strconcat ("<b>", _("_Location:"), "</b>", NULL); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (label), str); g_free (str); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); + gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); + topics_selector = ephy_topics_selector_new (editor->priv->bookmarks, editor->priv->bookmark); gtk_widget_show (topics_selector); editor->priv->topics_selector = topics_selector; - - gtk_widget_show (entry); + label = gtk_label_new (NULL); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0); + str = g_strconcat ("<b>", _("To_pics:"), "</b>", NULL); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (label), str); + g_free (str); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), topics_selector); + gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach (GTK_TABLE (table), topics_selector, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c index 20756fd97..e50f5659e 100644 --- a/src/bookmarks/ephy-bookmarks-editor.c +++ b/src/bookmarks/ephy-bookmarks-editor.c @@ -523,7 +523,7 @@ bookmarks_filter (EphyBookmarksEditor *editor, ephy_node_filter_done_changing (editor->priv->bookmarks_filter); } -static void +static gboolean key_pressed_cb (GtkWidget *widget, GdkEventKey *event, EphyNodeView *view) @@ -533,11 +533,13 @@ key_pressed_cb (GtkWidget *widget, case GDK_Delete: case GDK_KP_Delete: ephy_node_view_remove (view); - break; + return TRUE; default: break; } + + return FALSE; } static void diff --git a/src/bookmarks/ephy-new-bookmark.c b/src/bookmarks/ephy-new-bookmark.c index 116870c55..4217debc4 100644 --- a/src/bookmarks/ephy-new-bookmark.c +++ b/src/bookmarks/ephy-new-bookmark.c @@ -195,31 +195,33 @@ build_editing_table (EphyNewBookmark *editor) gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_widget_show (table); - label = gtk_label_new (NULL); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - str = g_strconcat ("<b>", _("Title:"), "</b>", NULL); - gtk_label_set_markup (GTK_LABEL (label), str); - g_free (str); - gtk_widget_show (label); + entry = gtk_entry_new (); gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); editor->priv->title_entry = entry; gtk_widget_set_size_request (entry, 200, -1); gtk_widget_show (entry); + label = gtk_label_new (NULL); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + str = g_strconcat ("<b>", _("_Title:"), "</b>", NULL); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (label), str); + g_free (str); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); + gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); + + topics_selector = ephy_topics_selector_new (editor->priv->bookmarks, NULL); + gtk_widget_show (topics_selector); + editor->priv->topics_selector = topics_selector; label = gtk_label_new (NULL); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0); - str = g_strconcat ("<b>", _("Topics:"), "</b>", NULL); - gtk_label_set_markup (GTK_LABEL (label), str); + str = g_strconcat ("<b>", _("To_pics:"), "</b>", NULL); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (label), str); g_free (str); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), topics_selector); gtk_widget_show (label); - topics_selector = ephy_topics_selector_new (editor->priv->bookmarks, NULL); - gtk_widget_show (topics_selector); - editor->priv->topics_selector = topics_selector; - - gtk_widget_show (entry); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach (GTK_TABLE (table), topics_selector, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); diff --git a/src/bookmarks/ephy-topics-selector.c b/src/bookmarks/ephy-topics-selector.c index 40f6a89b6..a7d8a3400 100644 --- a/src/bookmarks/ephy-topics-selector.c +++ b/src/bookmarks/ephy-topics-selector.c @@ -25,6 +25,7 @@ #include <gtk/gtkcellrenderertext.h> #include <gtk/gtktreeselection.h> #include <gtk/gtktreeview.h> +#include <gtk/gtkwindow.h> #include <gdk/gdkkeysyms.h> static void ephy_topics_selector_class_init (EphyTopicsSelectorClass *klass); @@ -43,6 +44,7 @@ struct EphyTopicsSelectorPrivate { EphyBookmarks *bookmarks; GtkTreeModel *model; + GtkWidget *treeview; EphyNode *bookmark; }; @@ -363,41 +365,60 @@ topic_key_pressed (GtkTreeView *tree_view, return FALSE; } +static gboolean +mneumonic_activated (GtkWidget *widget, + gboolean arg1, + EphyTopicsSelector *editor) +{ + GtkTreeIter iter; + GtkTreeSelection* sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (editor->priv->treeview)); + GtkWidget *window = gtk_widget_get_toplevel (GTK_WIDGET (editor->priv->treeview)); + + if ((sel == NULL) + && gtk_tree_model_get_iter_first (editor->priv->model, &iter)) + { + gtk_tree_selection_select_iter (sel, &iter); + } + + gtk_window_set_focus (GTK_WINDOW (window), GTK_WIDGET (editor->priv->treeview)); + + return TRUE; +} + static void ephy_topics_build_ui (EphyTopicsSelector *editor) { GtkListStore *model; - GtkWidget *treeview; GtkCellRenderer *renderer; GtkTreeViewColumn *column; model = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER); editor->priv->model = GTK_TREE_MODEL (model); - treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model)); - gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE); + editor->priv->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model)); + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (editor->priv->treeview), FALSE); g_idle_add ((GSourceFunc) set_sort_column_id, model); - gtk_widget_show (treeview); + gtk_widget_show (editor->priv->treeview); g_object_unref (model); /* Has topic column */ renderer = gtk_cell_renderer_toggle_new (); column = gtk_tree_view_column_new_with_attributes ("", renderer, "active", COL_HAS_TOPIC, NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column); + gtk_tree_view_append_column (GTK_TREE_VIEW (editor->priv->treeview), column); renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes ("Description", renderer, "text", COL_TOPIC, NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column); + gtk_tree_view_append_column (GTK_TREE_VIEW (editor->priv->treeview), column); - g_signal_connect (G_OBJECT (treeview), "key_press_event", + g_signal_connect (G_OBJECT (editor->priv->treeview), "key_press_event", G_CALLBACK (topic_key_pressed), editor); - g_signal_connect (G_OBJECT (treeview), "button_press_event", + g_signal_connect (G_OBJECT (editor->priv->treeview), "button_press_event", G_CALLBACK (topic_clicked), editor); fill_model (editor); - gtk_container_add (GTK_CONTAINER (editor), treeview); + gtk_container_add (GTK_CONTAINER (editor), editor->priv->treeview); } static void @@ -428,6 +449,8 @@ ephy_topics_selector_new (EphyBookmarks *bookmarks, NULL)); ephy_topics_build_ui (editor); + g_signal_connect (G_OBJECT (editor), "mnemonic-activate", + G_CALLBACK (mneumonic_activated), editor); return GTK_WIDGET (editor); } |