aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-topics-selector.c
diff options
context:
space:
mode:
authorDavid Bordoley <bordoley@msu.edu>2003-03-27 21:39:33 +0800
committerDave Bordoley <Bordoley@src.gnome.org>2003-03-27 21:39:33 +0800
commitd5be47a8e46ac8a35e41f296a95bb5ddcf7365e8 (patch)
tree397fc387ec6374fd9641709fdc9947de1ccf3621 /src/bookmarks/ephy-topics-selector.c
parent1ee9df3c80f558d2e05c7204ef8d682bba938886 (diff)
downloadgsoc2013-epiphany-d5be47a8e46ac8a35e41f296a95bb5ddcf7365e8.tar
gsoc2013-epiphany-d5be47a8e46ac8a35e41f296a95bb5ddcf7365e8.tar.gz
gsoc2013-epiphany-d5be47a8e46ac8a35e41f296a95bb5ddcf7365e8.tar.bz2
gsoc2013-epiphany-d5be47a8e46ac8a35e41f296a95bb5ddcf7365e8.tar.lz
gsoc2013-epiphany-d5be47a8e46ac8a35e41f296a95bb5ddcf7365e8.tar.xz
gsoc2013-epiphany-d5be47a8e46ac8a35e41f296a95bb5ddcf7365e8.tar.zst
gsoc2013-epiphany-d5be47a8e46ac8a35e41f296a95bb5ddcf7365e8.zip
Reorganize the menus a bit. Unifiy topic/bookmarks rename/delete items.
2003-03-27 David Bordoley <bordoley@msu.edu> * data/ui/epiphany-bookmark-editor-ui.xml.in: * src/bookmarks/ephy-bookmarks-editor.c: (cmd_rename), (cmd_delete), (cmd_cut), (cmd_copy), (cmd_paste), (cmd_select_all), (keyword_node_key_pressed_cb), (keyword_node_show_popup_cb), (ephy_bookmarks_editor_construct): Reorganize the menus a bit. Unifiy topic/bookmarks rename/delete items. Add text editting menu items to the edit menu. Add a topic context menu. * src/bookmarks/ephy-node-view.[c-h]: (ephy_node_view_select_all), (ephy_node_view_has_focus): New functions. * src/bookmarks/ephy-topics-selector.c: (set_sort_column_id), (topic_clicked), (ephy_topics_build_ui): Sort topics case insensitively. Add/remove topics using a single click.
Diffstat (limited to 'src/bookmarks/ephy-topics-selector.c')
-rw-r--r--src/bookmarks/ephy-topics-selector.c42
1 files changed, 39 insertions, 3 deletions
diff --git a/src/bookmarks/ephy-topics-selector.c b/src/bookmarks/ephy-topics-selector.c
index 4bfbe3681..97023550c 100644
--- a/src/bookmarks/ephy-topics-selector.c
+++ b/src/bookmarks/ephy-topics-selector.c
@@ -23,7 +23,9 @@
#include <gtk/gtkliststore.h>
#include <gtk/gtkcellrenderertoggle.h>
#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtktreeselection.h>
#include <gtk/gtktreeview.h>
+#include <gdk/gdkkeysyms.h>
static void ephy_topics_selector_class_init (EphyTopicsSelectorClass *klass);
static void ephy_topics_selector_init (EphyTopicsSelector *editor);
@@ -295,6 +297,39 @@ ephy_topics_selector_apply (EphyTopicsSelector *editor)
while (gtk_tree_model_iter_next (model, &iter));
}
+static gboolean
+set_sort_column_id (GtkListStore *model)
+{
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model),
+ COL_TOPIC,
+ GTK_SORT_ASCENDING);
+ return FALSE;
+}
+
+static gboolean
+topic_clicked (GtkTreeView *tree_view,
+ GdkEventButton *event,
+ EphyTopicsSelector *selector)
+{
+ GtkTreePath *path;
+
+ if (event->window != gtk_tree_view_get_bin_window (tree_view))
+ return FALSE;
+
+ if (gtk_tree_view_get_path_at_pos (tree_view,
+ (gint) event->x,
+ (gint) event->y,
+ &path, NULL,
+ NULL, NULL))
+ {
+ gchar *path_str = gtk_tree_path_to_string (path);
+ topic_toggled (NULL, path_str, selector);
+ g_free(path_str);
+ }
+
+ return FALSE;
+}
+
static void
ephy_topics_build_ui (EphyTopicsSelector *editor)
{
@@ -308,13 +343,12 @@ ephy_topics_build_ui (EphyTopicsSelector *editor)
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
+ g_idle_add ((GSourceFunc) set_sort_column_id, model);
gtk_widget_show (treeview);
g_object_unref (model);
/* Has topic column */
renderer = gtk_cell_renderer_toggle_new ();
- g_signal_connect (renderer, "toggled",
- G_CALLBACK (topic_toggled), editor);
column = gtk_tree_view_column_new_with_attributes
("", renderer, "active", COL_HAS_TOPIC, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
@@ -323,7 +357,9 @@ ephy_topics_build_ui (EphyTopicsSelector *editor)
column = gtk_tree_view_column_new_with_attributes
("Description", renderer, "text", COL_TOPIC, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
-
+
+ g_signal_connect (G_OBJECT (treeview), "button_press_event",
+ G_CALLBACK (topic_clicked), editor);
fill_model (editor);
gtk_container_add (GTK_CONTAINER (editor), treeview);