From 8c10e78e46c4427326cc9cb7162aa65346048102 Mon Sep 17 00:00:00 2001 From: David Bordoley Date: Mon, 31 Mar 2003 15:40:10 +0000 Subject: Update to reflect changes in EphyTopicSelector api. Wrap the topic 2003-03-30 David Bordoley * src/bookmarks/ephy-bookmark-properties.c: (build_ui): Update to reflect changes in EphyTopicSelector api. Wrap the topic selector in a GtkScrolledWindow. * src/bookmarks/ephy-bookmarks-editor.c: (cmd_add_topic), (cmd_rename), (cmd_open_bookmarks_in_tabs), (cmd_open_bookmarks_in_browser), (cmd_delete), (cmd_bookmark_properties), (cmd_select_all), (ephy_bookmarks_editor_dispose), (keyword_node_selected_cb), (ephy_bookmarks_editor_construct), (ephy_bookmarks_editor_update_menu): Update to reflect changes in EphyNodeView api. Wrap bm_view and key_view in GtkScrolledWindows. s/_Open In New Window/_Open in New Window and s/Open In New _Tabs/Open in New _Tab. * src/bookmarks/ephy-new-bookmark.c: (build_editing_table): Update to reflect changes in EphyTopicSelector api. Wrap the topic selector in a GtkScrolledWindow. * src/bookmarks/ephy-node-view.c: (ephy_node_view_get_type), (ephy_node_view_construct), (ephy_node_view_new), (ephy_node_view_add_column), (ephy_node_view_add_icon_column), (ephy_node_view_get_selection), (ephy_node_view_has_focus), (ephy_node_view_set_browse_mode), (ephy_node_view_select_node), (ephy_node_view_enable_drag_dest), (ephy_node_view_enable_drag_source), (ephy_node_view_set_hinted), (ephy_node_view_edit): * src/bookmarks/ephy-node-view.h: Inherit from GtkTreeView instead of GtkScrolledWindow and change methods to reflect the change. Allow for better/easier keynav. Return a GtkWidget from ephy_node_view_new to be consistent with GTK. * src/bookmarks/ephy-topics-selector.c: (ephy_topics_selector_get_type), (mneumonic_activated), (ephy_topics_build_ui), (ephy_topics_selector_new): * src/bookmarks/ephy-topics-selector.h: Inherit from GtkTreeView instead of GtkScrolledWindow and change methods to reflect the change. Allow for better/easier keynav. --- src/bookmarks/ephy-node-view.c | 73 +++++++++++------------------------------- 1 file changed, 18 insertions(+), 55 deletions(-) (limited to 'src/bookmarks/ephy-node-view.c') diff --git a/src/bookmarks/ephy-node-view.c b/src/bookmarks/ephy-node-view.c index 964592f20..62184dd2e 100644 --- a/src/bookmarks/ephy-node-view.c +++ b/src/bookmarks/ephy-node-view.c @@ -17,7 +17,6 @@ * */ -#include #include #include #include @@ -60,8 +59,6 @@ struct EphyNodeViewPrivate EphyNodeFilter *filter; - GtkWidget *treeview; - EphyTreeModelNodeColumn default_sort_column_id; GtkTargetList *drag_targets; @@ -107,7 +104,7 @@ ephy_node_view_get_type (void) (GInstanceInitFunc) ephy_node_view_init }; - ephy_node_view_type = g_type_register_static (GTK_TYPE_SCROLLED_WINDOW, + ephy_node_view_type = g_type_register_static (GTK_TYPE_TREE_VIEW, "EphyNodeView", &our_info, 0); } @@ -388,32 +385,28 @@ ephy_node_view_construct (EphyNodeView *view) G_CALLBACK (node_from_sort_iter_cb), view, 0); - view->priv->treeview = gtk_tree_view_new_with_model - (GTK_TREE_MODEL (view->priv->sortmodel)); - gtk_widget_show (view->priv->treeview); - g_signal_connect_object (G_OBJECT (view->priv->treeview), + gtk_tree_view_set_model (GTK_TREE_VIEW (view), GTK_TREE_MODEL (view->priv->sortmodel)); + g_signal_connect_object (G_OBJECT (view), "button_press_event", G_CALLBACK (ephy_node_view_button_press_cb), view, 0); - g_signal_connect_object (G_OBJECT (view->priv->treeview), + g_signal_connect_object (G_OBJECT (view), "row_activated", G_CALLBACK (ephy_node_view_row_activated_cb), view, 0); - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view->priv->treeview)); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); g_signal_connect_object (G_OBJECT (selection), "changed", G_CALLBACK (ephy_node_view_selection_changed_cb), view, 0); - - gtk_container_add (GTK_CONTAINER (view), view->priv->treeview); } -EphyNodeView * +GtkWidget * ephy_node_view_new (EphyNode *root, EphyNodeFilter *filter) { @@ -421,11 +414,6 @@ ephy_node_view_new (EphyNode *root, view = EPHY_NODE_VIEW (g_object_new (EPHY_TYPE_NODE_VIEW, "filter", filter, - "hadjustment", NULL, - "vadjustment", NULL, - "hscrollbar_policy", GTK_POLICY_AUTOMATIC, - "vscrollbar_policy", GTK_POLICY_AUTOMATIC, - "shadow_type", GTK_SHADOW_IN, "root", root, NULL)); @@ -433,7 +421,7 @@ ephy_node_view_new (EphyNode *root, g_return_val_if_fail (view->priv != NULL, NULL); - return view; + return GTK_WIDGET (view); } static int @@ -599,7 +587,7 @@ ephy_node_view_add_column (EphyNodeView *view, gtk_tree_view_column_set_sizing (gcolumn, GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_column_set_title (gcolumn, title); - gtk_tree_view_append_column (GTK_TREE_VIEW (view->priv->treeview), + gtk_tree_view_append_column (GTK_TREE_VIEW (view), gcolumn); if (sortable) { @@ -623,7 +611,7 @@ ephy_node_view_add_icon_column (EphyNodeView *view, NULL); gtk_tree_view_column_set_sizing (gcolumn, GTK_TREE_VIEW_COLUMN_AUTOSIZE); - gtk_tree_view_append_column (GTK_TREE_VIEW (view->priv->treeview), + gtk_tree_view_append_column (GTK_TREE_VIEW (view), gcolumn); } @@ -667,7 +655,7 @@ ephy_node_view_get_selection (EphyNodeView *view) GtkTreeSelection *selection; selection = gtk_tree_view_get_selection - (GTK_TREE_VIEW (view->priv->treeview)); + (GTK_TREE_VIEW (view)); gtk_tree_selection_selected_foreach (selection, (GtkTreeSelectionForeachFunc) get_selection, @@ -679,27 +667,10 @@ ephy_node_view_get_selection (EphyNodeView *view) void ephy_node_view_select_all (EphyNodeView *view) { - GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view->priv->treeview)); + GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); gtk_tree_selection_select_all (sel); } -gboolean -ephy_node_view_has_focus (EphyNodeView *view) -{ - GtkWidget *window; - GtkWidget *focused_widget; - - window = gtk_widget_get_toplevel (view->priv->treeview); - focused_widget = gtk_window_get_focus (GTK_WINDOW(window)); - - if (view->priv->treeview == focused_widget) - { - return TRUE; - } - - return FALSE; -} - void ephy_node_view_remove (EphyNodeView *view) { @@ -720,7 +691,7 @@ ephy_node_view_set_browse_mode (EphyNodeView *view) { GtkTreeSelection *selection; - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view->priv->treeview)); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE); } @@ -734,7 +705,7 @@ ephy_node_view_select_node (EphyNodeView *view, GtkTreeSelection *selection; GtkTreePath *path; - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view->priv->treeview)); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); g_return_if_fail (node != NULL); @@ -752,7 +723,7 @@ ephy_node_view_select_node (EphyNodeView *view, &iter, &iter2); path = gtk_tree_model_get_path (GTK_TREE_MODEL (view->priv->sortmodel), &iter); - gtk_tree_view_set_cursor (GTK_TREE_VIEW (view->priv->treeview), + gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), path, NULL, FALSE); gtk_tree_path_free (path); } @@ -865,7 +836,7 @@ ephy_node_view_enable_drag_dest (EphyNodeView *view, g_return_if_fail (view != NULL); - treeview = view->priv->treeview; + treeview = GTK_WIDGET (view); gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (treeview), types, n_types, @@ -890,7 +861,7 @@ ephy_node_view_enable_drag_source (EphyNodeView *view, g_return_if_fail (view != NULL); - treeview = view->priv->treeview; + treeview = GTK_WIDGET (view); egg_tree_multi_drag_add_drag_support (GTK_TREE_VIEW (treeview)); @@ -903,14 +874,6 @@ ephy_node_view_enable_drag_source (EphyNodeView *view, prop_id); } -void -ephy_node_view_set_hinted (EphyNodeView *view, gboolean hinted) -{ - g_return_if_fail (view != NULL); - - gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view->priv->treeview), hinted); -} - void ephy_node_view_edit (EphyNodeView *view) { @@ -921,7 +884,7 @@ ephy_node_view_edit (EphyNodeView *view) g_return_if_fail (view->priv->editable_renderer != NULL); selection = gtk_tree_view_get_selection - (GTK_TREE_VIEW (view->priv->treeview)); + (GTK_TREE_VIEW (view)); rows = gtk_tree_selection_get_selected_rows (selection, &model); if (rows == NULL) return; @@ -929,7 +892,7 @@ ephy_node_view_edit (EphyNodeView *view) "editable", TRUE, NULL); - gtk_tree_view_set_cursor (GTK_TREE_VIEW (view->priv->treeview), + gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), (GtkTreePath *)rows->data, view->priv->editable_column, TRUE); -- cgit v1.2.3