aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks
diff options
context:
space:
mode:
authorDavid Bordoley <bordoley@msu.edu>2003-03-31 23:40:10 +0800
committerDave Bordoley <Bordoley@src.gnome.org>2003-03-31 23:40:10 +0800
commit8c10e78e46c4427326cc9cb7162aa65346048102 (patch)
treee8124a8ced253d59e699c7f7408b68eaf8c9058c /src/bookmarks
parent668bf3c20445fdd23862a7b7140df68ee3b63fc0 (diff)
downloadgsoc2013-epiphany-8c10e78e46c4427326cc9cb7162aa65346048102.tar
gsoc2013-epiphany-8c10e78e46c4427326cc9cb7162aa65346048102.tar.gz
gsoc2013-epiphany-8c10e78e46c4427326cc9cb7162aa65346048102.tar.bz2
gsoc2013-epiphany-8c10e78e46c4427326cc9cb7162aa65346048102.tar.lz
gsoc2013-epiphany-8c10e78e46c4427326cc9cb7162aa65346048102.tar.xz
gsoc2013-epiphany-8c10e78e46c4427326cc9cb7162aa65346048102.tar.zst
gsoc2013-epiphany-8c10e78e46c4427326cc9cb7162aa65346048102.zip
Update to reflect changes in EphyTopicSelector api. Wrap the topic
2003-03-30 David Bordoley <bordoley@msu.edu> * 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.
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/ephy-bookmark-properties.c16
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c104
-rw-r--r--src/bookmarks/ephy-new-bookmark.c14
-rw-r--r--src/bookmarks/ephy-node-view.c73
-rw-r--r--src/bookmarks/ephy-node-view.h13
-rw-r--r--src/bookmarks/ephy-topics-selector.c47
-rw-r--r--src/bookmarks/ephy-topics-selector.h6
7 files changed, 121 insertions, 152 deletions
diff --git a/src/bookmarks/ephy-bookmark-properties.c b/src/bookmarks/ephy-bookmark-properties.c
index 7a03a2d41..fcf1cd23e 100644
--- a/src/bookmarks/ephy-bookmark-properties.c
+++ b/src/bookmarks/ephy-bookmark-properties.c
@@ -29,6 +29,7 @@
#include <gtk/gtktable.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkmisc.h>
+#include <gtk/gtkscrolledwindow.h>
#include <libgnome/gnome-i18n.h>
static void ephy_bookmark_properties_class_init (EphyBookmarkPropertiesClass *klass);
@@ -278,7 +279,7 @@ set_window_icon (EphyBookmarkProperties *editor)
static void
build_ui (EphyBookmarkProperties *editor)
{
- GtkWidget *table, *label, *entry, *topics_selector;
+ GtkWidget *table, *label, *entry, *topics_selector, *scrolled_window;
char *str;
const char *tmp;
@@ -341,11 +342,20 @@ build_ui (EphyBookmarkProperties *editor)
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;
+ scrolled_window = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
+ "hadjustment", NULL,
+ "vadjustment", NULL,
+ "hscrollbar_policy", GTK_POLICY_AUTOMATIC,
+ "vscrollbar_policy", GTK_POLICY_AUTOMATIC,
+ "shadow_type", GTK_SHADOW_IN,
+ NULL);
+ gtk_widget_show (scrolled_window);
+ gtk_container_add (GTK_CONTAINER (scrolled_window), topics_selector);
label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
str = g_strconcat ("<b>", _("To_pics:"), "</b>", NULL);
@@ -354,7 +364,7 @@ build_ui (EphyBookmarkProperties *editor)
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_table_attach (GTK_TABLE (table), scrolled_window, 1, 2, 2, 3,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (editor)->vbox),
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index e50f5659e..51f5081c2 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -20,6 +20,7 @@
#include <gtk/gtktable.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkstock.h>
+#include <gtk/gtkscrolledwindow.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtkvbox.h>
#include <gdk/gdkkeysyms.h>
@@ -105,8 +106,8 @@ static void cmd_select_all (EggAction *action,
struct EphyBookmarksEditorPrivate
{
EphyBookmarks *bookmarks;
- EphyNodeView *bm_view;
- EphyNodeView *key_view;
+ GtkWidget *bm_view;
+ GtkWidget *key_view;
EphyNodeFilter *bookmarks_filter;
GtkWidget *search_entry;
GtkWidget *menu_dock;
@@ -132,10 +133,10 @@ static EggActionGroupEntry ephy_bookmark_popup_entries [] = {
{ "NewTopic", N_("_New Topic"), GTK_STOCK_NEW, "<control>N",
NULL, G_CALLBACK (cmd_add_topic), NULL },
- { "OpenInWindow", N_("_Open In New Window"), GTK_STOCK_OPEN, "<control>O",
+ { "OpenInWindow", N_("_Open in New Window"), GTK_STOCK_OPEN, "<control>O",
NULL, G_CALLBACK (cmd_open_bookmarks_in_browser), NULL },
- { "OpenInTab", N_("Open In New _Tab"), NULL, "<shift><control>O",
+ { "OpenInTab", N_("Open in New _Tab"), NULL, "<shift><control>O",
NULL, G_CALLBACK (cmd_open_bookmarks_in_tabs), NULL },
{ "Cut", N_("Cu_t"), GTK_STOCK_CUT, "<control>X",
@@ -172,8 +173,8 @@ cmd_add_topic (EggAction *action,
node = ephy_bookmarks_add_keyword (editor->priv->bookmarks,
_("Type a topic"));
- ephy_node_view_select_node (editor->priv->key_view, node);
- ephy_node_view_edit (editor->priv->key_view);
+ ephy_node_view_select_node (EPHY_NODE_VIEW (editor->priv->key_view), node);
+ ephy_node_view_edit (EPHY_NODE_VIEW (editor->priv->key_view));
}
static void
@@ -187,13 +188,13 @@ static void
cmd_rename (EggAction *action,
EphyBookmarksEditor *editor)
{
- if (ephy_node_view_has_focus (editor->priv->bm_view))
+ if (gtk_widget_is_focus (editor->priv->bm_view))
{
- ephy_node_view_edit (editor->priv->bm_view);
+ ephy_node_view_edit (EPHY_NODE_VIEW (editor->priv->bm_view));
}
- else if (ephy_node_view_has_focus (editor->priv->key_view))
+ else if (gtk_widget_is_focus (editor->priv->key_view))
{
- ephy_node_view_edit (editor->priv->key_view);
+ ephy_node_view_edit (EPHY_NODE_VIEW (editor->priv->key_view));
}
}
@@ -219,7 +220,7 @@ cmd_open_bookmarks_in_tabs (EggAction *action,
GList *l;
window = EPHY_WINDOW (get_target_window (editor));
- selection = ephy_node_view_get_selection (editor->priv->bm_view);
+ selection = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->bm_view));
for (l = selection; l; l = l->next)
{
@@ -245,7 +246,7 @@ cmd_open_bookmarks_in_browser (EggAction *action,
GList *l;
window = EPHY_WINDOW (get_target_window (editor));
- selection = ephy_node_view_get_selection (editor->priv->bm_view);
+ selection = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->bm_view));
for (l = selection; l; l = l->next)
{
@@ -266,13 +267,13 @@ static void
cmd_delete (EggAction *action,
EphyBookmarksEditor *editor)
{
- if (ephy_node_view_has_focus (editor->priv->bm_view))
+ if (gtk_widget_is_focus (editor->priv->bm_view))
{
- ephy_node_view_remove (editor->priv->bm_view);
+ ephy_node_view_remove (EPHY_NODE_VIEW (editor->priv->bm_view));
}
- else if (ephy_node_view_has_focus (editor->priv->key_view))
+ else if (gtk_widget_is_focus (editor->priv->key_view))
{
- ephy_node_view_remove (editor->priv->key_view);
+ ephy_node_view_remove (EPHY_NODE_VIEW (editor->priv->key_view));
}
}
@@ -284,7 +285,7 @@ cmd_bookmark_properties (EggAction *action,
GList *selection;
GList *l;
- selection = ephy_node_view_get_selection (editor->priv->bm_view);
+ selection = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->bm_view));
for (l = selection; l; l = l->next)
{
@@ -342,9 +343,9 @@ cmd_select_all (EggAction *action,
{
gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
}
- else if (ephy_node_view_has_focus (editor->priv->bm_view))
+ else if (gtk_widget_is_focus (editor->priv->bm_view))
{
- ephy_node_view_select_all (editor->priv->bm_view);
+ ephy_node_view_select_all (EPHY_NODE_VIEW (editor->priv->bm_view));
}
}
@@ -416,7 +417,7 @@ ephy_bookmarks_editor_dispose (GObject *object)
if (editor->priv->key_view != NULL)
{
- selection = ephy_node_view_get_selection (editor->priv->key_view);
+ selection = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->key_view));
if (selection == NULL || selection->data == NULL)
{
editor->priv->key_view = NULL;
@@ -552,7 +553,7 @@ keyword_node_selected_cb (EphyNodeView *view,
if (node == NULL)
{
bookmarks = ephy_bookmarks_get_bookmarks (editor->priv->bookmarks);
- ephy_node_view_select_node (editor->priv->key_view, bookmarks);
+ ephy_node_view_select_node (EPHY_NODE_VIEW (editor->priv->key_view), bookmarks);
}
else
{
@@ -671,7 +672,8 @@ static void
ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
{
GtkWidget *hbox, *vbox;
- EphyNodeView *bm_view, *key_view;
+ GtkWidget *bm_view, *key_view;
+ GtkWidget *scrolled_window;
EphyNode *node;
long selected_id;
EphyNode *selected_node;
@@ -726,26 +728,36 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
node = ephy_bookmarks_get_keywords (editor->priv->bookmarks);
+ scrolled_window = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
+ "hadjustment", NULL,
+ "vadjustment", NULL,
+ "hscrollbar_policy", GTK_POLICY_AUTOMATIC,
+ "vscrollbar_policy", GTK_POLICY_AUTOMATIC,
+ "shadow_type", GTK_SHADOW_IN,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (hbox), scrolled_window, FALSE, TRUE, 0);
+ gtk_widget_show (scrolled_window);
+
/* Keywords View */
key_view = ephy_node_view_new (node, NULL);
- ephy_node_view_enable_drag_source (key_view,
+ ephy_node_view_enable_drag_source (EPHY_NODE_VIEW (key_view),
topic_drag_types,
n_topic_drag_types,
-1);
- ephy_node_view_enable_drag_dest (key_view,
+ ephy_node_view_enable_drag_dest (EPHY_NODE_VIEW (key_view),
topic_drag_dest_types,
n_topic_drag_dest_types);
- ephy_node_view_set_browse_mode (key_view);
- ephy_node_view_add_column (key_view, _("Topics"),
+ ephy_node_view_set_browse_mode (EPHY_NODE_VIEW (key_view));
+ ephy_node_view_add_column (EPHY_NODE_VIEW (key_view), _("Topics"),
EPHY_TREE_MODEL_NODE_COL_KEYWORD, TRUE, TRUE);
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (key_view), FALSE, TRUE, 0);
- gtk_widget_set_size_request (GTK_WIDGET (key_view), 130, -1);
- gtk_widget_show (GTK_WIDGET (key_view));
+ gtk_container_add (GTK_CONTAINER (scrolled_window), key_view);
+ gtk_widget_set_size_request (key_view, 130, -1);
+ gtk_widget_show (key_view);
editor->priv->key_view = key_view;
g_signal_connect (G_OBJECT (key_view),
"key_press_event",
G_CALLBACK (key_pressed_cb),
- editor->priv->key_view);
+ EPHY_NODE_VIEW (editor->priv->key_view));
g_signal_connect (G_OBJECT (key_view),
"node_selected",
G_CALLBACK (keyword_node_selected_cb),
@@ -768,26 +780,36 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
build_search_box (editor),
FALSE, FALSE, 0);
+ scrolled_window = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
+ "hadjustment", NULL,
+ "vadjustment", NULL,
+ "hscrollbar_policy", GTK_POLICY_AUTOMATIC,
+ "vscrollbar_policy", GTK_POLICY_AUTOMATIC,
+ "shadow_type", GTK_SHADOW_IN,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0);
+ gtk_widget_show (scrolled_window);
+
node = ephy_bookmarks_get_bookmarks (editor->priv->bookmarks);
editor->priv->bookmarks_filter = ephy_node_filter_new ();
/* Bookmarks View */
bm_view = ephy_node_view_new (node, editor->priv->bookmarks_filter);
- ephy_node_view_set_hinted (bm_view, TRUE);
- ephy_node_view_enable_drag_source (bm_view,
+ gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (bm_view), TRUE);
+ ephy_node_view_enable_drag_source (EPHY_NODE_VIEW (bm_view),
bmk_drag_types,
n_bmk_drag_types,
EPHY_NODE_BMK_PROP_LOCATION);
- ephy_node_view_add_icon_column (bm_view, EPHY_TREE_MODEL_NODE_COL_ICON);
- ephy_node_view_add_column (bm_view, _("Title"),
+ ephy_node_view_add_icon_column (EPHY_NODE_VIEW (bm_view), EPHY_TREE_MODEL_NODE_COL_ICON);
+ ephy_node_view_add_column (EPHY_NODE_VIEW (bm_view), _("Title"),
EPHY_TREE_MODEL_NODE_COL_BOOKMARK, TRUE, TRUE);
- gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (bm_view), TRUE, TRUE, 0);
- gtk_widget_show (GTK_WIDGET (bm_view));
+ gtk_container_add (GTK_CONTAINER (scrolled_window), bm_view);
+ gtk_widget_show (bm_view);
editor->priv->bm_view = bm_view;
g_signal_connect (G_OBJECT (bm_view),
"key_press_event",
G_CALLBACK (key_pressed_cb),
- editor->priv->bm_view);
+ EPHY_NODE_VIEW (editor->priv->bm_view));
g_signal_connect (G_OBJECT (bm_view),
"node_activated",
G_CALLBACK (ephy_bookmarks_editor_node_activated_cb),
@@ -812,7 +834,7 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
selected_node = ephy_node_get_from_id (selected_id);
if (selected_node != NULL)
{
- ephy_node_view_select_node (key_view, selected_node);
+ ephy_node_view_select_node (EPHY_NODE_VIEW (key_view), selected_node);
}
g_free (selected_id_str);
@@ -914,7 +936,7 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor,
/* Unselection */
if (node == NULL)
{
- selection = ephy_node_view_get_selection (editor->priv->bm_view);
+ selection = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->bm_view));
if (!selection)
{
rename = delete = properties = FALSE;
@@ -945,7 +967,7 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor,
}
else
{
- if (view == editor->priv->key_view)
+ if (view == EPHY_NODE_VIEW (editor->priv->key_view))
{
properties = FALSE;
}
@@ -955,7 +977,7 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor,
}
delete = TRUE;
- selection = ephy_node_view_get_selection (editor->priv->bm_view);
+ selection = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->bm_view));
if (g_list_length (selection) > 1)
{
rename = FALSE;
diff --git a/src/bookmarks/ephy-new-bookmark.c b/src/bookmarks/ephy-new-bookmark.c
index 4217debc4..f133e167d 100644
--- a/src/bookmarks/ephy-new-bookmark.c
+++ b/src/bookmarks/ephy-new-bookmark.c
@@ -23,6 +23,7 @@
#include <gtk/gtkhbox.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtkstock.h>
+#include <gtk/gtkscrolledwindow.h>
#include <gtk/gtkeditable.h>
#include <libgnome/gnome-i18n.h>
@@ -187,7 +188,7 @@ ephy_new_bookmark_response_cb (GtkDialog *dialog,
static GtkWidget *
build_editing_table (EphyNewBookmark *editor)
{
- GtkWidget *table, *label, *entry, *topics_selector;
+ GtkWidget *table, *label, *entry, *topics_selector, *scrolled_window;
char *str;
table = gtk_table_new (2, 2, FALSE);
@@ -214,6 +215,15 @@ build_editing_table (EphyNewBookmark *editor)
topics_selector = ephy_topics_selector_new (editor->priv->bookmarks, NULL);
gtk_widget_show (topics_selector);
+ scrolled_window = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
+ "hadjustment", NULL,
+ "vadjustment", NULL,
+ "hscrollbar_policy", GTK_POLICY_AUTOMATIC,
+ "vscrollbar_policy", GTK_POLICY_AUTOMATIC,
+ "shadow_type", GTK_SHADOW_IN,
+ NULL);
+ gtk_widget_show (scrolled_window);
+ gtk_container_add (GTK_CONTAINER (scrolled_window), topics_selector);
editor->priv->topics_selector = topics_selector;
label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
@@ -223,7 +233,7 @@ build_editing_table (EphyNewBookmark *editor)
gtk_label_set_mnemonic_widget (GTK_LABEL (label), topics_selector);
gtk_widget_show (label);
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_table_attach (GTK_TABLE (table), scrolled_window, 1, 2, 1, 2,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
return table;
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 <gtk/gtktreeview.h>
#include <gtk/gtktreeselection.h>
#include <gtk/gtktreeviewcolumn.h>
#include <gtk/gtkcellrenderertext.h>
@@ -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));
@@ -904,14 +875,6 @@ ephy_node_view_enable_drag_source (EphyNodeView *view,
}
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)
{
GtkTreeSelection *selection;
@@ -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);
diff --git a/src/bookmarks/ephy-node-view.h b/src/bookmarks/ephy-node-view.h
index 08b5757e0..7889791bc 100644
--- a/src/bookmarks/ephy-node-view.h
+++ b/src/bookmarks/ephy-node-view.h
@@ -21,7 +21,7 @@
#ifndef __EPHY_NODE_VIEW_H
#define __EPHY_NODE_VIEW_H
-#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtktreeview.h>
#include <gtk/gtkdnd.h>
#include "ephy-tree-model-node.h"
@@ -40,14 +40,14 @@ typedef struct EphyNodeViewPrivate EphyNodeViewPrivate;
typedef struct
{
- GtkScrolledWindow parent;
+ GtkTreeView parent;
EphyNodeViewPrivate *priv;
} EphyNodeView;
typedef struct
{
- GtkScrolledWindowClass parent;
+ GtkTreeViewClass parent;
void (*node_activated) (EphyNodeView *view, EphyNode *node);
void (*node_selected) (EphyNodeView *view, EphyNode *node);
@@ -57,7 +57,7 @@ typedef struct
GType ephy_node_view_get_type (void);
-EphyNodeView *ephy_node_view_new (EphyNode *root,
+GtkWidget *ephy_node_view_new (EphyNode *root,
EphyNodeFilter *filter);
void ephy_node_view_enable_dnd (EphyNodeView *view);
@@ -77,8 +77,6 @@ GList *ephy_node_view_get_selection (EphyNodeView *view);
void ephy_node_view_select_all (EphyNodeView *view);
-gboolean ephy_node_view_has_focus (EphyNodeView *view);
-
void ephy_node_view_set_browse_mode (EphyNodeView *view);
void ephy_node_view_select_node (EphyNodeView *view,
@@ -93,9 +91,6 @@ void ephy_node_view_enable_drag_dest (EphyNodeView *view,
GtkTargetEntry *types,
int n_types);
-void ephy_node_view_set_hinted (EphyNodeView *view,
- gboolean hinted);
-
void ephy_node_view_edit (EphyNodeView *view);
G_END_DECLS
diff --git a/src/bookmarks/ephy-topics-selector.c b/src/bookmarks/ephy-topics-selector.c
index a7d8a3400..cf1439617 100644
--- a/src/bookmarks/ephy-topics-selector.c
+++ b/src/bookmarks/ephy-topics-selector.c
@@ -44,7 +44,6 @@ struct EphyTopicsSelectorPrivate
{
EphyBookmarks *bookmarks;
GtkTreeModel *model;
- GtkWidget *treeview;
EphyNode *bookmark;
};
@@ -84,7 +83,7 @@ ephy_topics_selector_get_type (void)
(GInstanceInitFunc) ephy_topics_selector_init
};
- ephy_topics_selector_type = g_type_register_static (GTK_TYPE_SCROLLED_WINDOW,
+ ephy_topics_selector_type = g_type_register_static (GTK_TYPE_TREE_VIEW,
"EphyTopicsSelector",
&our_info, 0);
}
@@ -365,26 +364,6 @@ 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)
{
@@ -395,30 +374,27 @@ ephy_topics_build_ui (EphyTopicsSelector *editor)
model = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER);
editor->priv->model = GTK_TREE_MODEL (model);
- 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);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (editor), GTK_TREE_MODEL (model));
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (editor), FALSE);
g_idle_add ((GSourceFunc) set_sort_column_id, model);
- 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 (editor->priv->treeview), column);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (editor), 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 (editor->priv->treeview), column);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (editor), column);
- g_signal_connect (G_OBJECT (editor->priv->treeview), "key_press_event",
+ g_signal_connect (G_OBJECT (editor), "key_press_event",
G_CALLBACK (topic_key_pressed), editor);
- g_signal_connect (G_OBJECT (editor->priv->treeview), "button_press_event",
+ g_signal_connect (G_OBJECT (editor), "button_press_event",
G_CALLBACK (topic_clicked), editor);
fill_model (editor);
-
- gtk_container_add (GTK_CONTAINER (editor), editor->priv->treeview);
}
static void
@@ -441,16 +417,9 @@ ephy_topics_selector_new (EphyBookmarks *bookmarks,
(EPHY_TYPE_TOPIC_SELECTOR,
"bookmarks", bookmarks,
"bookmark", bookmark,
- "hadjustment", NULL,
- "vadjustment", NULL,
- "hscrollbar_policy", GTK_POLICY_AUTOMATIC,
- "vscrollbar_policy", GTK_POLICY_AUTOMATIC,
- "shadow_type", GTK_SHADOW_IN,
NULL));
ephy_topics_build_ui (editor);
- g_signal_connect (G_OBJECT (editor), "mnemonic-activate",
- G_CALLBACK (mneumonic_activated), editor);
-
+
return GTK_WIDGET (editor);
}
diff --git a/src/bookmarks/ephy-topics-selector.h b/src/bookmarks/ephy-topics-selector.h
index 8adfa7523..d87086980 100644
--- a/src/bookmarks/ephy-topics-selector.h
+++ b/src/bookmarks/ephy-topics-selector.h
@@ -23,7 +23,7 @@
#include "ephy-bookmarks.h"
-#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtktreeview.h>
G_BEGIN_DECLS
@@ -38,14 +38,14 @@ typedef struct EphyTopicsSelectorPrivate EphyTopicsSelectorPrivate;
typedef struct
{
- GtkScrolledWindow parent;
+ GtkTreeView parent;
EphyTopicsSelectorPrivate *priv;
} EphyTopicsSelector;
typedef struct
{
- GtkScrolledWindowClass parent;
+ GtkTreeViewClass parent;
} EphyTopicsSelectorClass;
GType ephy_topics_selector_get_type (void);