diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-04-17 20:59:52 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-04-17 20:59:52 +0800 |
commit | 609b92cfa632385313d1d2421b516bdb41fdbf00 (patch) | |
tree | 09fc963d624f5723fc75551eb125b3d7d825f795 | |
parent | 9e94d5208ee7d936c6d3595435b9364fec5850dd (diff) | |
download | gsoc2013-epiphany-609b92cfa632385313d1d2421b516bdb41fdbf00.tar gsoc2013-epiphany-609b92cfa632385313d1d2421b516bdb41fdbf00.tar.gz gsoc2013-epiphany-609b92cfa632385313d1d2421b516bdb41fdbf00.tar.bz2 gsoc2013-epiphany-609b92cfa632385313d1d2421b516bdb41fdbf00.tar.lz gsoc2013-epiphany-609b92cfa632385313d1d2421b516bdb41fdbf00.tar.xz gsoc2013-epiphany-609b92cfa632385313d1d2421b516bdb41fdbf00.tar.zst gsoc2013-epiphany-609b92cfa632385313d1d2421b516bdb41fdbf00.zip |
New abstracted implementations. Nicer and will be useful for history
2003-04-17 Marco Pesenti Gritti <marco@it.gnome.org>
* lib/widgets/Makefile.am:
* lib/widgets/ephy-node-view.c:
* lib/widgets/ephy-node-view.h:
* lib/widgets/ephy-tree-model-node.c:
* lib/widgets/ephy-tree-model-node.h:
New abstracted implementations.
Nicer and will be useful for
history dialog interface rehash to make
it more consistent with bookmarks (this
was the hard part of the work).
* src/bookmarks/Makefile.am:
* src/bookmarks/ephy-bookmarks-editor.c:
Use them.
* src/history-dialog.c:
Temp hack to keep the thing building until
I actually rewrite history dialog.
2
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | lib/widgets/Makefile.am | 4 | ||||
-rw-r--r-- | lib/widgets/ephy-node-view.c (renamed from src/bookmarks/ephy-node-view.c) | 456 | ||||
-rw-r--r-- | lib/widgets/ephy-node-view.h (renamed from src/bookmarks/ephy-node-view.h) | 25 | ||||
-rw-r--r-- | lib/widgets/ephy-tree-model-node.c (renamed from src/bookmarks/ephy-tree-model-node.c) | 303 | ||||
-rw-r--r-- | lib/widgets/ephy-tree-model-node.h (renamed from src/bookmarks/ephy-tree-model-node.h) | 20 | ||||
-rw-r--r-- | src/bookmarks/Makefile.am | 6 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 52 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 13 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks.h | 7 | ||||
-rw-r--r-- | src/bookmarks/ephy-topics-selector.c | 5 | ||||
-rw-r--r-- | src/ephy-window.c | 1 |
12 files changed, 507 insertions, 409 deletions
@@ -1,3 +1,27 @@ +2003-04-17 Marco Pesenti Gritti <marco@it.gnome.org> + + * lib/widgets/Makefile.am: + * lib/widgets/ephy-node-view.c: + * lib/widgets/ephy-node-view.h: + * lib/widgets/ephy-tree-model-node.c: + * lib/widgets/ephy-tree-model-node.h: + + New abstracted implementations. + Nicer and will be useful for + history dialog interface rehash to make + it more consistent with bookmarks (this + was the hard part of the work). + + * src/bookmarks/Makefile.am: + * src/bookmarks/ephy-bookmarks-editor.c: + + Use them. + + * src/history-dialog.c: + + Temp hack to keep the thing building until + I actually rewrite history dialog. + 2003-04-16 Marco Pesenti Gritti <marco@it.gnome.org> * data/ui/Makefile.am: diff --git a/lib/widgets/Makefile.am b/lib/widgets/Makefile.am index 809041a49..d2d27ca03 100644 --- a/lib/widgets/Makefile.am +++ b/lib/widgets/Makefile.am @@ -21,10 +21,14 @@ libephywidgets_la_SOURCES = \ ephy-ellipsizing-label.h \ ephy-location-entry.c \ ephy-location-entry.h \ + ephy-node-view.c \ + ephy-node-view.h \ ephy-notebook.c \ ephy-notebook.h \ ephy-spinner.c \ ephy-spinner.h \ + ephy-tree-model-node.c \ + ephy-tree-model-node.h \ ephy-tree-model-sort.c \ ephy-tree-model-sort.h diff --git a/src/bookmarks/ephy-node-view.c b/lib/widgets/ephy-node-view.c index cb96f72b1..1d8eba5cd 100644 --- a/src/bookmarks/ephy-node-view.c +++ b/lib/widgets/ephy-node-view.c @@ -26,8 +26,6 @@ #include <libgnome/gnome-i18n.h> #include "eggtreemodelfilter.h" -#include "ephy-bookmarks.h" -#include "ephy-tree-model-node.h" #include "ephy-node-view.h" #include "ephy-tree-model-sort.h" #include "eggtreemultidnd.h" @@ -60,13 +58,16 @@ struct EphyNodeViewPrivate EphyNodeFilter *filter; - EphyTreeModelNodeColumn default_sort_column_id; + EphyNode *selected_node; GtkTargetList *drag_targets; - EphyNode *selected_node; + int default_sort_column_id; + int priority_prop_id; + int priority_column_id; gboolean editing; + int editable_property; }; enum @@ -209,6 +210,146 @@ ephy_node_view_finalize (GObject *object) G_OBJECT_CLASS (parent_class)->finalize (object); } +static EphyNode * +get_node_from_path (EphyNodeView *view, GtkTreePath *path) +{ + EphyNode *node; + GtkTreeIter iter, iter2; + + gtk_tree_model_get_iter (view->priv->sortmodel, &iter, path); + gtk_tree_model_sort_convert_iter_to_child_iter + (GTK_TREE_MODEL_SORT (view->priv->sortmodel), &iter2, &iter); + egg_tree_model_filter_convert_iter_to_child_iter + (EGG_TREE_MODEL_FILTER (view->priv->filtermodel), &iter, &iter2); + node = ephy_tree_model_node_node_from_iter (view->priv->nodemodel, &iter); + + return node; +} + +static gboolean +drag_motion_cb (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + guint time, + EphyNodeView *view) +{ + EphyNode *node; + GtkTreePath *path = NULL; + GtkTreeViewDropPosition pos; + gboolean res; + EphyNodeViewPriority priority; + + g_signal_stop_emission_by_name (widget, "drag_motion"); + + res = gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (widget), + x, y, &path, &pos); + if (!res) return TRUE; + + node = get_node_from_path (view, path); + + priority = ephy_node_get_property_int (node, view->priv->priority_prop_id); + + if (priority != EPHY_NODE_VIEW_ALL_PRIORITY && + priority != EPHY_NODE_VIEW_SPECIAL_PRIORITY) + + { + gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget), path, + GTK_TREE_VIEW_DROP_INTO_OR_AFTER); + gdk_drag_status (context, context->suggested_action, time); + } + else + { + gdk_drag_status (context, 0, time); + } + + return TRUE; +} + +static gboolean +drag_drop_cb (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + guint time, + EphyNodeView *view) +{ + GdkAtom target; + + g_signal_stop_emission_by_name (widget, "drag_drop"); + + target = gtk_drag_dest_find_target (widget, context, + view->priv->drag_targets); + + if (target != GDK_NONE) + { + gtk_drag_get_data (widget, context, target, time); + } + + return TRUE; +} + +static gboolean +drag_data_received_cb (GtkWidget *widget, + GdkDragContext *context, + gint x, + gint y, + GtkSelectionData *selection_data, + guint info, + guint time, + EphyNodeView *view) +{ + GtkTreePath *path = NULL; + GtkTreeViewDropPosition pos; + + g_signal_stop_emission_by_name (widget, "drag_data_received"); + + if (gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (widget), + x, y, &path, &pos)) + { + EphyNode *node; + GList *src_nodes; + + node = get_node_from_path (view, path); + + src_nodes = ephy_dnd_node_list_extract_nodes + (selection_data->data); + + g_signal_emit (G_OBJECT (view), + ephy_node_view_signals[NODE_DROPPED], 0, + node, src_nodes); + + g_list_free (src_nodes); + + } + + return TRUE; +} + +void +ephy_node_view_enable_drag_dest (EphyNodeView *view, + GtkTargetEntry *types, + int n_types) +{ + GtkWidget *treeview; + + g_return_if_fail (view != NULL); + + treeview = GTK_WIDGET (view); + + gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (treeview), + types, n_types, + GDK_ACTION_COPY); + view->priv->drag_targets = gtk_target_list_new (types, n_types); + + g_signal_connect (treeview, "drag_data_received", + G_CALLBACK (drag_data_received_cb), view); + g_signal_connect (treeview, "drag_drop", + G_CALLBACK (drag_drop_cb), view); + g_signal_connect (treeview, "drag_motion", + G_CALLBACK (drag_motion_cb), view); +} + static void filter_changed_cb (EphyNodeFilter *filter, EphyNodeView *view) @@ -276,22 +417,6 @@ ephy_node_view_row_activated_cb (GtkTreeView *treeview, g_signal_emit (G_OBJECT (view), ephy_node_view_signals[NODE_ACTIVATED], 0, node); } -static EphyNode * -get_node_from_path (EphyNodeView *view, GtkTreePath *path) -{ - EphyNode *node; - GtkTreeIter iter, iter2; - - gtk_tree_model_get_iter (view->priv->sortmodel, &iter, path); - gtk_tree_model_sort_convert_iter_to_child_iter - (GTK_TREE_MODEL_SORT (view->priv->sortmodel), &iter2, &iter); - egg_tree_model_filter_convert_iter_to_child_iter - (EGG_TREE_MODEL_FILTER (view->priv->filtermodel), &iter, &iter2); - node = ephy_tree_model_node_node_from_iter (view->priv->nodemodel, &iter); - - return node; -} - static gboolean ephy_node_view_key_press_cb (GtkTreeView *treeview, GdkEventKey *event, @@ -335,7 +460,8 @@ ephy_node_view_button_press_cb (GtkTreeView *treeview, } else { - view->priv->selected_node = get_node_from_path (view, path); + view->priv->selected_node = + get_node_from_path (view, path); } target_view = view; @@ -478,6 +604,39 @@ ephy_node_view_new (EphyNode *root, return GTK_WIDGET (view); } +static void +cell_renderer_edited (GtkCellRendererText *cell, + const char *path_str, + const char *new_text, + EphyNodeView *view) +{ + GValue value = { 0, }; + GtkTreePath *path; + GtkTreeIter iter, iter2; + EphyNode *node; + + view->priv->editing = FALSE; + + g_object_set (G_OBJECT (view->priv->editable_renderer), + "editable", FALSE, + NULL); + + path = gtk_tree_path_new_from_string (path_str); + gtk_tree_model_get_iter (view->priv->sortmodel, &iter, path); + gtk_tree_model_sort_convert_iter_to_child_iter + (GTK_TREE_MODEL_SORT (view->priv->sortmodel), &iter2, &iter); + egg_tree_model_filter_convert_iter_to_child_iter + (EGG_TREE_MODEL_FILTER (view->priv->filtermodel), &iter, &iter2); + node = ephy_tree_model_node_node_from_iter (view->priv->nodemodel, &iter); + + g_value_init (&value, G_TYPE_STRING); + g_value_set_string (&value, new_text); + ephy_node_set_property (node, + view->priv->editable_property, + &value); + g_value_unset (&value); +} + static int ephy_node_view_sort_func (GtkTreeModel *model, GtkTreeIter *a, @@ -510,10 +669,7 @@ ephy_node_view_sort_func (GtkTreeModel *model, stra = g_utf8_casefold (g_value_get_string (&a_value), -1); strb = g_utf8_casefold (g_value_get_string (&b_value), -1); g_return_val_if_fail (stra != NULL || strb != NULL, 0); - - if (column == EPHY_TREE_MODEL_NODE_COL_BOOKMARK || - column == EPHY_TREE_MODEL_NODE_COL_KEYWORD) - retval = g_utf8_collate (stra, strb); + retval = g_utf8_collate (stra, strb); g_free (stra); g_free (strb); break; @@ -549,9 +705,8 @@ ephy_node_view_sort_func (GtkTreeModel *model, static gboolean set_sort_column_id (EphyNodeView *view) { - EphyTreeModelNodeColumn priority = EPHY_TREE_MODEL_NODE_COL_PRIORITY; GList *sort_order = NULL; - sort_order = g_list_append (sort_order, GINT_TO_POINTER (priority)); + sort_order = g_list_append (sort_order, GINT_TO_POINTER (view->priv->priority_column_id)); sort_order = g_list_append (sort_order, GINT_TO_POINTER (view->priv->default_sort_column_id)); gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (view->priv->sortmodel), @@ -566,64 +721,52 @@ set_sort_column_id (EphyNodeView *view) } static void -cell_renderer_edited (GtkCellRendererText *cell, - const char *path_str, - const char *new_text, - EphyNodeView *view) +provide_priority (EphyNode *node, GValue *value, EphyNodeView *view) { - GValue value = { 0, }; - GtkTreePath *path; - GtkTreeIter iter, iter2; - EphyNode *node; - - view->priv->editing = FALSE; + int priority; - g_object_set (G_OBJECT (view->priv->editable_renderer), - "editable", FALSE, - NULL); - - path = gtk_tree_path_new_from_string (path_str); - gtk_tree_model_get_iter (view->priv->sortmodel, &iter, path); - gtk_tree_model_sort_convert_iter_to_child_iter - (GTK_TREE_MODEL_SORT (view->priv->sortmodel), &iter2, &iter); - egg_tree_model_filter_convert_iter_to_child_iter - (EGG_TREE_MODEL_FILTER (view->priv->filtermodel), &iter, &iter2); - node = ephy_tree_model_node_node_from_iter (view->priv->nodemodel, &iter); - - g_value_init (&value, G_TYPE_STRING); - g_value_set_string (&value, new_text); - - switch (view->priv->editable_node_column) - { - case EPHY_TREE_MODEL_NODE_COL_BOOKMARK: - ephy_node_set_property (node, - EPHY_NODE_BMK_PROP_TITLE, - &value); - break; - case EPHY_TREE_MODEL_NODE_COL_KEYWORD: - ephy_node_set_property (node, - EPHY_NODE_KEYWORD_PROP_NAME, - &value); - break; - default: - break; - } + g_value_init (value, G_TYPE_INT); + priority = ephy_node_get_property_int (node, view->priv->priority_prop_id); + if (priority == EPHY_NODE_VIEW_ALL_PRIORITY || + priority == EPHY_NODE_VIEW_SPECIAL_PRIORITY) + g_value_set_int (value, priority); + else + g_value_set_int (value, EPHY_NODE_VIEW_NORMAL_PRIORITY); +} - g_value_unset (&value); +static void +provide_text_weight (EphyNode *node, GValue *value, EphyNodeView *view) +{ + int priority; + + g_value_init (value, G_TYPE_INT); + priority = ephy_node_get_property_int + (node, view->priv->priority_prop_id); + if (priority == EPHY_NODE_VIEW_ALL_PRIORITY || + priority == EPHY_NODE_VIEW_SPECIAL_PRIORITY) + g_value_set_int (value, PANGO_WEIGHT_BOLD); + else + g_value_set_int (value, PANGO_WEIGHT_NORMAL); } GtkTreeViewColumn * ephy_node_view_add_column (EphyNodeView *view, const char *title, - EphyTreeModelNodeColumn column, - gboolean sortable, - gboolean editable) + GType value_type, + int prop_id, + int priority_prop_id, + gboolean editable, + gboolean sortable) { GtkTreeViewColumn *gcolumn; GtkCellRenderer *renderer; + int column; g_return_val_if_fail (!editable || view->priv->editable_renderer == NULL, NULL); + column = ephy_tree_model_node_add_prop_column + (view->priv->nodemodel, value_type, prop_id); + gcolumn = (GtkTreeViewColumn *) gtk_tree_view_column_new (); renderer = gtk_cell_renderer_text_new (); @@ -638,15 +781,36 @@ ephy_node_view_add_column (EphyNodeView *view, gtk_tree_view_column_pack_start (gcolumn, renderer, TRUE); gtk_tree_view_column_set_attributes (gcolumn, renderer, "text", column, - "weight", EPHY_TREE_MODEL_NODE_COL_TITLE_WEIGHT, NULL); + if (priority_prop_id > 0) + { + int wcol; + + wcol = ephy_tree_model_node_add_func_column + (view->priv->nodemodel, G_TYPE_INT, + (EphyTreeModelNodeValueFunc) provide_text_weight, + view); + gtk_tree_view_column_add_attribute (gcolumn, renderer, + "weight", wcol); + } + 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), gcolumn); + if (sortable) { + int scol; + + scol = ephy_tree_model_node_add_func_column + (view->priv->nodemodel, G_TYPE_INT, + (EphyTreeModelNodeValueFunc) provide_priority, + view); + view->priv->priority_column_id = scol; + + view->priv->priority_prop_id = priority_prop_id; view->priv->default_sort_column_id = column; g_idle_add ((GSourceFunc) set_sort_column_id, view); } @@ -656,10 +820,14 @@ ephy_node_view_add_column (EphyNodeView *view, void ephy_node_view_add_icon_column (EphyNodeView *view, - EphyTreeModelNodeColumn column) + EphyTreeModelNodeValueFunc func) { GtkTreeViewColumn *gcolumn; GtkCellRenderer *renderer; + int column; + + column = ephy_tree_model_node_add_func_column + (view->priv->nodemodel, GDK_TYPE_PIXBUF, func, NULL); gcolumn = (GtkTreeViewColumn *) gtk_tree_view_column_new (); renderer = gtk_cell_renderer_pixbuf_new (); @@ -813,130 +981,6 @@ ephy_node_view_select_node (EphyNodeView *view, gtk_tree_path_free (path); } -static gboolean -drag_motion_cb (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint time, - EphyNodeView *view) -{ - EphyNode *node; - GtkTreePath *path = NULL; - GtkTreeViewDropPosition pos; - gboolean res; - EphyBookmarksKeywordPriority priority; - - g_signal_stop_emission_by_name (widget, "drag_motion"); - - res = gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (widget), - x, y, &path, &pos); - if (!res) return TRUE; - - node = get_node_from_path (view, path); - - priority = ephy_node_get_property_int (node, EPHY_NODE_KEYWORD_PROP_PRIORITY); - - if (priority != EPHY_BOOKMARKS_KEYWORD_ALL_PRIORITY && - priority != EPHY_BOOKMARKS_KEYWORD_SPECIAL_PRIORITY) - - { - gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget), path, - GTK_TREE_VIEW_DROP_INTO_OR_AFTER); - gdk_drag_status (context, context->suggested_action, time); - } - else - { - gdk_drag_status (context, 0, time); - } - - return TRUE; -} - -static gboolean -drag_drop_cb (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint time, - EphyNodeView *view) -{ - GdkAtom target; - - g_signal_stop_emission_by_name (widget, "drag_drop"); - - target = gtk_drag_dest_find_target (widget, context, - view->priv->drag_targets); - - if (target != GDK_NONE) - { - gtk_drag_get_data (widget, context, target, time); - } - - return TRUE; -} - -static gboolean -drag_data_received_cb (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *selection_data, - guint info, - guint time, - EphyNodeView *view) -{ - GtkTreePath *path = NULL; - GtkTreeViewDropPosition pos; - - g_signal_stop_emission_by_name (widget, "drag_data_received"); - - if (gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (widget), - x, y, &path, &pos)) - { - EphyNode *node; - GList *src_nodes; - - node = get_node_from_path (view, path); - - src_nodes = ephy_dnd_node_list_extract_nodes - (selection_data->data); - - g_signal_emit (G_OBJECT (view), - ephy_node_view_signals[NODE_DROPPED], 0, - node, src_nodes); - - g_list_free (src_nodes); - - } - - return TRUE; -} - -void -ephy_node_view_enable_drag_dest (EphyNodeView *view, - GtkTargetEntry *types, - int n_types) -{ - GtkWidget *treeview; - - g_return_if_fail (view != NULL); - - treeview = GTK_WIDGET (view); - - gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (treeview), - types, n_types, - GDK_ACTION_COPY); - view->priv->drag_targets = gtk_target_list_new (types, n_types); - - g_signal_connect (treeview, "drag_data_received", - G_CALLBACK (drag_data_received_cb), view); - g_signal_connect (treeview, "drag_drop", - G_CALLBACK (drag_drop_cb), view); - g_signal_connect (treeview, "drag_motion", - G_CALLBACK (drag_motion_cb), view); -} - void ephy_node_view_enable_drag_source (EphyNodeView *view, GtkTargetEntry *types, @@ -990,8 +1034,11 @@ ephy_node_view_edit (EphyNodeView *view) } gboolean -ephy_node_view_is_editing (EphyNodeView *view) +ephy_node_view_is_editing (EphyNodeView *view, + int property) { + view->priv->editable_property = property; + return view->priv->editing; } @@ -1037,3 +1084,16 @@ ephy_node_view_has_selection (EphyNodeView *view, gboolean *multiple) return rows > 0; } + +void +ephy_node_view_enable_sort (EphyNodeView *view, + GtkTreeIterCompareFunc sort_func, + gpointer data, + GtkDestroyNotify destroy) +{ + gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (view->priv->sortmodel), + GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, + GTK_SORT_ASCENDING); + gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (view->priv->sortmodel), + sort_func, data, destroy); +} diff --git a/src/bookmarks/ephy-node-view.h b/lib/widgets/ephy-node-view.h index 43006449e..148b376b1 100644 --- a/src/bookmarks/ephy-node-view.h +++ b/lib/widgets/ephy-node-view.h @@ -45,6 +45,13 @@ typedef struct EphyNodeViewPrivate *priv; } EphyNodeView; +typedef enum +{ + EPHY_NODE_VIEW_ALL_PRIORITY, + EPHY_NODE_VIEW_SPECIAL_PRIORITY, + EPHY_NODE_VIEW_NORMAL_PRIORITY +} EphyNodeViewPriority; + typedef struct { GtkTreeViewClass parent; @@ -64,12 +71,14 @@ void ephy_node_view_enable_dnd (EphyNodeView *view); GtkTreeViewColumn *ephy_node_view_add_column (EphyNodeView *view, const char *title, - EphyTreeModelNodeColumn column, - gboolean sortable, - gboolean editable); + GType value_type, + int prop_id, + int priority_prop_id, + gboolean editable, + gboolean sortable); void ephy_node_view_add_icon_column (EphyNodeView *view, - EphyTreeModelNodeColumn column); + EphyTreeModelNodeValueFunc func); void ephy_node_view_remove (EphyNodeView *view); @@ -92,10 +101,16 @@ void ephy_node_view_enable_drag_dest (EphyNodeView *view, void ephy_node_view_edit (EphyNodeView *view); -gboolean ephy_node_view_is_editing (EphyNodeView *view); +gboolean ephy_node_view_is_editing (EphyNodeView *view, + int property); gboolean ephy_node_view_is_target (EphyNodeView *view); +void ephy_node_view_enable_sort (EphyNodeView *view, + GtkTreeIterCompareFunc sort_func, + gpointer data, + GtkDestroyNotify destroy); + G_END_DECLS #endif /* EPHY_NODE_VIEW_H */ diff --git a/src/bookmarks/ephy-tree-model-node.c b/lib/widgets/ephy-tree-model-node.c index bca22c379..35d36c98d 100644 --- a/src/bookmarks/ephy-tree-model-node.c +++ b/lib/widgets/ephy-tree-model-node.c @@ -26,11 +26,9 @@ #include <string.h> #include "ephy-node-filter.h" -#include "ephy-bookmarks.h" #include "ephy-tree-model-node.h" #include "ephy-stock-icons.h" #include "ephy-node.h" -#include "ephy-shell.h" #include "ephy-debug.h" static void ephy_tree_model_node_class_init (EphyTreeModelNodeClass *klass); @@ -45,18 +43,11 @@ static void ephy_tree_model_node_get_property (GObject *object, GValue *value, GParamSpec *pspec); static guint ephy_tree_model_node_get_flags (GtkTreeModel *tree_model); -static int ephy_tree_model_node_get_n_columns (GtkTreeModel *tree_model); -static GType ephy_tree_model_node_get_column_type (GtkTreeModel *tree_model, - int index); static gboolean ephy_tree_model_node_get_iter (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreePath *path); static GtkTreePath *ephy_tree_model_node_get_path (GtkTreeModel *tree_model, GtkTreeIter *iter); -static void ephy_tree_model_node_get_value (GtkTreeModel *tree_model, - GtkTreeIter *iter, - int column, - GValue *value); static gboolean ephy_tree_model_node_iter_next (GtkTreeModel *tree_model, GtkTreeIter *iter); static gboolean ephy_tree_model_node_iter_children (GtkTreeModel *tree_model, @@ -96,8 +87,19 @@ struct EphyTreeModelNodePrivate EphyNode *root; EphyNodeFilter *filter; + + GList *columns; + int columns_num; }; +typedef struct +{ + GType type; + int prop_id; + EphyTreeModelNodeValueFunc func; + gpointer user_data; +} EphyTreeModelNodeColData; + enum { PROP_0, @@ -190,6 +192,9 @@ ephy_tree_model_node_init (EphyTreeModelNode *model) dummy = gtk_tree_view_new (); gtk_widget_destroy (dummy); + + model->priv->columns = NULL; + model->priv->columns_num = EPHY_TREE_MODEL_NODE_BUILTIN_COLUMNS; } static void @@ -204,6 +209,9 @@ ephy_tree_model_node_finalize (GObject *object) g_return_if_fail (model->priv != NULL); + g_list_foreach (model->priv->columns, (GFunc) g_free, NULL); + g_list_free (model->priv->columns); + g_free (model->priv); G_OBJECT_CLASS (parent_class)->finalize (object); @@ -319,60 +327,148 @@ ephy_tree_model_node_new (EphyNode *root, return model; } -static void -ephy_tree_model_node_tree_model_init (GtkTreeModelIface *iface) +int +ephy_tree_model_node_add_prop_column (EphyTreeModelNode *model, + GType value_type, + int prop_id) { - iface->get_flags = ephy_tree_model_node_get_flags; - iface->get_n_columns = ephy_tree_model_node_get_n_columns; - iface->get_column_type = ephy_tree_model_node_get_column_type; - iface->get_iter = ephy_tree_model_node_get_iter; - iface->get_path = ephy_tree_model_node_get_path; - iface->get_value = ephy_tree_model_node_get_value; - iface->iter_next = ephy_tree_model_node_iter_next; - iface->iter_children = ephy_tree_model_node_iter_children; - iface->iter_has_child = ephy_tree_model_node_iter_has_child; - iface->iter_n_children = ephy_tree_model_node_iter_n_children; - iface->iter_nth_child = ephy_tree_model_node_iter_nth_child; - iface->iter_parent = ephy_tree_model_node_iter_parent; + EphyTreeModelNodeColData *col; + + col = g_new0 (EphyTreeModelNodeColData, 1); + col->prop_id = prop_id; + col->type = value_type; + col->func = NULL; + col->user_data = NULL; + + model->priv->columns = g_list_append (model->priv->columns, col); + model->priv->columns_num++; + + return model->priv->columns_num; } -static guint -ephy_tree_model_node_get_flags (GtkTreeModel *tree_model) +int +ephy_tree_model_node_add_func_column (EphyTreeModelNode *model, + GType value_type, + EphyTreeModelNodeValueFunc func, + gpointer user_data) { - return 0; + EphyTreeModelNodeColData *col; + + col = g_new0 (EphyTreeModelNodeColData, 1); + col->prop_id = -1; + col->type = value_type; + col->func = func; + col->user_data = user_data; + + model->priv->columns = g_list_append (model->priv->columns, col); + model->priv->columns_num++; + + return model->priv->columns_num; } static int ephy_tree_model_node_get_n_columns (GtkTreeModel *tree_model) { - return EPHY_TREE_MODEL_NODE_NUM_COLUMNS; + EphyTreeModelNode *model = EPHY_TREE_MODEL_NODE (tree_model); + + return model->priv->columns_num; } static GType ephy_tree_model_node_get_column_type (GtkTreeModel *tree_model, int index) { - g_return_val_if_fail (EPHY_IS_TREE_MODEL_NODE (tree_model), G_TYPE_INVALID); - g_return_val_if_fail ((index < EPHY_TREE_MODEL_NODE_NUM_COLUMNS) && (index >= 0), G_TYPE_INVALID); + int list_index; + EphyTreeModelNodeColData *col; + EphyTreeModelNode *model = EPHY_TREE_MODEL_NODE (tree_model); + + if (index == EPHY_TREE_MODEL_NODE_COL_VISIBLE) + return G_TYPE_BOOLEAN; + + list_index = index - EPHY_TREE_MODEL_NODE_BUILTIN_COLUMNS - 1; + col = g_list_nth_data (model->priv->columns, list_index); + + return col->type; +} + +static void +ephy_tree_model_node_get_value (GtkTreeModel *tree_model, + GtkTreeIter *iter, + int column, + GValue *value) +{ + int list_index; + EphyTreeModelNodeColData *col; + EphyTreeModelNode *model = EPHY_TREE_MODEL_NODE (tree_model); + EphyNode *node; + + g_return_if_fail (EPHY_IS_TREE_MODEL_NODE (tree_model)); + g_return_if_fail (iter != NULL); + g_return_if_fail (iter->stamp == model->stamp); + g_return_if_fail (EPHY_IS_NODE (iter->user_data)); + + if (model->priv->root == NULL) + return; - switch (index) + node = EPHY_NODE (iter->user_data); + + if (column == EPHY_TREE_MODEL_NODE_COL_VISIBLE) { - case EPHY_TREE_MODEL_NODE_COL_BOOKMARK: - case EPHY_TREE_MODEL_NODE_COL_KEYWORD: - return G_TYPE_STRING; - case EPHY_TREE_MODEL_NODE_COL_TITLE_WEIGHT: - case EPHY_TREE_MODEL_NODE_COL_PRIORITY: - return G_TYPE_INT; - case EPHY_TREE_MODEL_NODE_COL_VISIBLE: - return G_TYPE_BOOLEAN; - case EPHY_TREE_MODEL_NODE_COL_ICON: - return GDK_TYPE_PIXBUF; - default: - g_assert_not_reached (); - return G_TYPE_INVALID; + g_value_init (value, G_TYPE_BOOLEAN); + + if (model->priv->filter != NULL) + { + g_value_set_boolean (value, + ephy_node_filter_evaluate (model->priv->filter, node)); + } + else + { + g_value_set_boolean (value, TRUE); + } + } + else + { + list_index = column - EPHY_TREE_MODEL_NODE_BUILTIN_COLUMNS - 1; + col = g_list_nth_data (model->priv->columns, list_index); + + g_return_if_fail (col != NULL); + + if (col->prop_id > 0) + { + ephy_node_get_property (node, + col->prop_id, + value); + } + else + { + col->func (node, value, col->user_data); + } } } +static void +ephy_tree_model_node_tree_model_init (GtkTreeModelIface *iface) +{ + iface->get_flags = ephy_tree_model_node_get_flags; + iface->get_iter = ephy_tree_model_node_get_iter; + iface->get_path = ephy_tree_model_node_get_path; + iface->iter_next = ephy_tree_model_node_iter_next; + iface->iter_children = ephy_tree_model_node_iter_children; + iface->iter_has_child = ephy_tree_model_node_iter_has_child; + iface->iter_n_children = ephy_tree_model_node_iter_n_children; + iface->iter_nth_child = ephy_tree_model_node_iter_nth_child; + iface->iter_parent = ephy_tree_model_node_iter_parent; + iface->get_n_columns = ephy_tree_model_node_get_n_columns; + iface->get_column_type = ephy_tree_model_node_get_column_type; + iface->get_value = ephy_tree_model_node_get_value; +} + +static guint +ephy_tree_model_node_get_flags (GtkTreeModel *tree_model) +{ + return 0; +} + static gboolean ephy_tree_model_node_get_iter (GtkTreeModel *tree_model, GtkTreeIter *iter, @@ -436,102 +532,6 @@ ephy_tree_model_node_get_path (GtkTreeModel *tree_model, return get_path_real (model, node); } -static void -get_icon_pixbuf (EphyNode *node, GValue *value) -{ - EphyFaviconCache *cache; - const char *icon_location; - GdkPixbuf *pixbuf = NULL; - - cache = ephy_embed_shell_get_favicon_cache (EPHY_EMBED_SHELL (ephy_shell)); - icon_location = ephy_node_get_property_string - (node, EPHY_NODE_BMK_PROP_ICON); - - LOG ("Get favicon for %s", icon_location ? icon_location : "None") - - if (icon_location) - { - pixbuf = ephy_favicon_cache_get (cache, icon_location); - } - - g_value_init (value, GDK_TYPE_PIXBUF); - g_value_set_object (value, pixbuf); -} - -static void -ephy_tree_model_node_get_value (GtkTreeModel *tree_model, - GtkTreeIter *iter, - int column, - GValue *value) -{ - EphyTreeModelNode *model = EPHY_TREE_MODEL_NODE (tree_model); - EphyNode *node; - int priority; - - g_return_if_fail (EPHY_IS_TREE_MODEL_NODE (tree_model)); - g_return_if_fail (iter != NULL); - g_return_if_fail (iter->stamp == model->stamp); - g_return_if_fail (EPHY_IS_NODE (iter->user_data)); - g_return_if_fail (column < EPHY_TREE_MODEL_NODE_NUM_COLUMNS); - - if (model->priv->root == NULL) - return; - - node = EPHY_NODE (iter->user_data); - - switch (column) - { - case EPHY_TREE_MODEL_NODE_COL_BOOKMARK: - ephy_node_get_property (node, - EPHY_NODE_BMK_PROP_TITLE, - value); - break; - case EPHY_TREE_MODEL_NODE_COL_KEYWORD: - ephy_node_get_property (node, - EPHY_NODE_KEYWORD_PROP_NAME, - value); - break; - case EPHY_TREE_MODEL_NODE_COL_ICON: - get_icon_pixbuf (node, value); - break; - - case EPHY_TREE_MODEL_NODE_COL_VISIBLE: - g_value_init (value, G_TYPE_BOOLEAN); - - if (model->priv->filter != NULL) - { - g_value_set_boolean (value, - ephy_node_filter_evaluate (model->priv->filter, node)); - } - else - { - g_value_set_boolean (value, TRUE); - } - break; - case EPHY_TREE_MODEL_NODE_COL_TITLE_WEIGHT: - g_value_init (value, G_TYPE_INT); - priority = ephy_node_get_property_int (node, EPHY_NODE_KEYWORD_PROP_PRIORITY); - if (priority == EPHY_BOOKMARKS_KEYWORD_ALL_PRIORITY || - priority == EPHY_BOOKMARKS_KEYWORD_SPECIAL_PRIORITY) - g_value_set_int (value, PANGO_WEIGHT_BOLD); - else - g_value_set_int (value, PANGO_WEIGHT_NORMAL); - break; - case EPHY_TREE_MODEL_NODE_COL_PRIORITY: - g_value_init (value, G_TYPE_INT); - priority = ephy_node_get_property_int (node, EPHY_NODE_KEYWORD_PROP_PRIORITY); - if (priority == EPHY_BOOKMARKS_KEYWORD_ALL_PRIORITY || - priority == EPHY_BOOKMARKS_KEYWORD_SPECIAL_PRIORITY) - g_value_set_int (value, priority); - else - g_value_set_int (value, EPHY_BOOKMARKS_KEYWORD_NORMAL_PRIORITY); - break; - default: - g_assert_not_reached (); - break; - } -} - static gboolean ephy_tree_model_node_iter_next (GtkTreeModel *tree_model, GtkTreeIter *iter) @@ -725,28 +725,3 @@ root_destroyed_cb (EphyNode *node, * signals already */ } -GType -ephy_tree_model_node_column_get_type (void) -{ - static GType etype = 0; - - if (etype == 0) - { - static const GEnumValue values[] = - { - { EPHY_TREE_MODEL_NODE_COL_BOOKMARK, "EPHY_TREE_MODEL_NODE_COL_BOOKMARK", "bookmark" }, - { EPHY_TREE_MODEL_NODE_COL_KEYWORD, "EPHY_TREE_MODEL_NODE_COL_KEYWORD", "keyword" }, - { EPHY_TREE_MODEL_NODE_COL_ICON, "EPHY_TREE_MODEL_NODE_COL_ICON", "icon" }, - { EPHY_TREE_MODEL_NODE_COL_VISIBLE, "EPHY_TREE_MODEL_NODE_COL_VISIBLE", "visible" }, - { EPHY_TREE_MODEL_NODE_COL_TITLE_WEIGHT, "EPHY_TREE_MODEL_NODE_COL_TITLE_WEIGHT", "title weight" }, - { EPHY_TREE_MODEL_NODE_COL_PRIORITY, "EPHY_TREE_MODEL_NODE_COL_PRIORITY", "priority" }, - - { 0, 0, 0 } - }; - - etype = g_enum_register_static ("EphyTreeModelNodeColumn", values); - } - - return etype; -} - diff --git a/src/bookmarks/ephy-tree-model-node.h b/lib/widgets/ephy-tree-model-node.h index afc862f58..d50e9732f 100644 --- a/src/bookmarks/ephy-tree-model-node.h +++ b/lib/widgets/ephy-tree-model-node.h @@ -37,18 +37,11 @@ G_BEGIN_DECLS typedef enum { - EPHY_TREE_MODEL_NODE_COL_BOOKMARK, - EPHY_TREE_MODEL_NODE_COL_KEYWORD, EPHY_TREE_MODEL_NODE_COL_VISIBLE, - EPHY_TREE_MODEL_NODE_COL_ICON, - EPHY_TREE_MODEL_NODE_COL_TITLE_WEIGHT, - EPHY_TREE_MODEL_NODE_COL_PRIORITY, - EPHY_TREE_MODEL_NODE_NUM_COLUMNS + EPHY_TREE_MODEL_NODE_BUILTIN_COLUMNS } EphyTreeModelNodeColumn; -GType ephy_tree_model_node_column_get_type (void); - -#define EPHY_TYPE_TREE_MODEL_NODE_COLUMN (ephy_tree_model_node_column_get_type ()) +typedef void (*EphyTreeModelNodeValueFunc) (EphyNode *node, GValue *value, gpointer user_data); typedef struct EphyTreeModelNodePrivate EphyTreeModelNodePrivate; @@ -71,6 +64,15 @@ GType ephy_tree_model_node_get_type (void); EphyTreeModelNode *ephy_tree_model_node_new (EphyNode *root, EphyNodeFilter *filter); +int ephy_tree_model_node_add_prop_column (EphyTreeModelNode *model, + GType value_type, + int prop_id); + +int ephy_tree_model_node_add_func_column (EphyTreeModelNode *model, + GType value_type, + EphyTreeModelNodeValueFunc func, + gpointer user_data); + EphyNode *ephy_tree_model_node_node_from_iter (EphyTreeModelNode *model, GtkTreeIter *iter); diff --git a/src/bookmarks/Makefile.am b/src/bookmarks/Makefile.am index 563329335..8da75c248 100644 --- a/src/bookmarks/Makefile.am +++ b/src/bookmarks/Makefile.am @@ -32,11 +32,7 @@ libephybookmarks_la_SOURCES = \ ephy-keywords-entry.h \ ephy-new-bookmark.c \ ephy-new-bookmark.h \ - ephy-node-view.c \ - ephy-node-view.h \ ephy-topic-action.c \ ephy-topic-action.h \ ephy-topics-selector.c \ - ephy-topics-selector.h \ - ephy-tree-model-node.c \ - ephy-tree-model-node.h + ephy-topics-selector.h diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c index b9782120f..25fd53357 100644 --- a/src/bookmarks/ephy-bookmarks-editor.c +++ b/src/bookmarks/ephy-bookmarks-editor.c @@ -44,6 +44,7 @@ #include "popup-commands.h" #include "ephy-state.h" #include "window-commands.h" +#include "ephy-debug.h" static GtkTargetEntry topic_drag_dest_types [] = { @@ -118,6 +119,7 @@ struct EphyBookmarksEditorPrivate GtkWidget *window; EggMenuMerge *ui_merge; EggActionGroup *action_group; + int priority_col; }; enum @@ -532,12 +534,12 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor) if (key_focus && selected) { EphyNode *node = EPHY_NODE (selected->data); - EphyBookmarksKeywordPriority priority;; + EphyNodeViewPriority priority;; priority = ephy_node_get_property_int (node, EPHY_NODE_KEYWORD_PROP_PRIORITY); - if (priority == -1) priority = EPHY_BOOKMARKS_KEYWORD_NORMAL_PRIORITY; - key_normal = (priority == EPHY_BOOKMARKS_KEYWORD_NORMAL_PRIORITY); + if (priority == -1) priority = EPHY_NODE_VIEW_NORMAL_PRIORITY; + key_normal = (priority == EPHY_NODE_VIEW_NORMAL_PRIORITY); g_list_free (selected); } @@ -828,6 +830,28 @@ menu_activate_cb (EphyNodeView *view, } static void +provide_favicon (EphyNode *node, GValue *value, gpointer user_data) +{ + EphyFaviconCache *cache; + const char *icon_location; + GdkPixbuf *pixbuf = NULL; + + cache = ephy_embed_shell_get_favicon_cache (EPHY_EMBED_SHELL (ephy_shell)); + icon_location = ephy_node_get_property_string + (node, EPHY_NODE_BMK_PROP_ICON); + + LOG ("Get favicon for %s", icon_location ? icon_location : "None") + + if (icon_location) + { + pixbuf = ephy_favicon_cache_get (cache, icon_location); + } + + g_value_init (value, GDK_TYPE_PIXBUF); + g_value_set_object (value, pixbuf); +} + +static void ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor) { GtkTreeSelection *selection; @@ -913,12 +937,15 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor) n_topic_drag_types, -1); ephy_node_view_enable_drag_dest (EPHY_NODE_VIEW (key_view), - topic_drag_dest_types, - n_topic_drag_dest_types); + topic_drag_dest_types, + n_topic_drag_dest_types); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (key_view)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE); ephy_node_view_add_column (EPHY_NODE_VIEW (key_view), _("Topics"), - EPHY_TREE_MODEL_NODE_COL_KEYWORD, TRUE, TRUE); + G_TYPE_STRING, + EPHY_NODE_KEYWORD_PROP_NAME, + EPHY_NODE_KEYWORD_PROP_PRIORITY, + TRUE, TRUE); gtk_container_add (GTK_CONTAINER (scrolled_window), key_view); gtk_widget_set_size_request (key_view, 130, -1); gtk_widget_show (key_view); @@ -932,13 +959,13 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor) G_CALLBACK (keyword_node_selected_cb), editor); g_signal_connect (G_OBJECT (key_view), - "show_popup", - G_CALLBACK (keyword_node_show_popup_cb), - editor); - g_signal_connect (G_OBJECT (key_view), "node_dropped", G_CALLBACK (node_dropped_cb), editor); + g_signal_connect (G_OBJECT (key_view), + "show_popup", + G_CALLBACK (keyword_node_show_popup_cb), + editor); vbox = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (hbox), @@ -969,9 +996,10 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor) bmk_drag_types, n_bmk_drag_types, EPHY_NODE_BMK_PROP_LOCATION); - ephy_node_view_add_icon_column (EPHY_NODE_VIEW (bm_view), EPHY_TREE_MODEL_NODE_COL_ICON); + ephy_node_view_add_icon_column (EPHY_NODE_VIEW (bm_view), provide_favicon); ephy_node_view_add_column (EPHY_NODE_VIEW (bm_view), _("Title"), - EPHY_TREE_MODEL_NODE_COL_BOOKMARK, TRUE, TRUE); + G_TYPE_STRING, EPHY_NODE_BMK_PROP_TITLE, + -1, TRUE, TRUE); gtk_container_add (GTK_CONTAINER (scrolled_window), bm_view); gtk_widget_show (bm_view); editor->priv->bm_view = bm_view; diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index 1962ae3be..955a7ef35 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -22,6 +22,7 @@ #include "ephy-history.h" #include "ephy-debug.h" #include "ephy-tree-model-node.h" +#include "ephy-node-view.h" #include <string.h> #include <libgnome/gnome-i18n.h> @@ -506,10 +507,10 @@ ephy_bookmarks_init (EphyBookmarks *eb) eb->priv->keywords = ephy_node_new_with_id (KEYWORDS_NODE_ID); ephy_node_ref (eb->priv->keywords); g_value_init (&value, G_TYPE_INT); - g_value_set_int (&value, EPHY_BOOKMARKS_KEYWORD_ALL_PRIORITY); + g_value_set_int (&value, EPHY_NODE_VIEW_ALL_PRIORITY); ephy_node_set_property (eb->priv->bookmarks, - EPHY_NODE_KEYWORD_PROP_PRIORITY, - &value); + EPHY_NODE_KEYWORD_PROP_PRIORITY, + &value); g_value_unset (&value); g_signal_connect_object (G_OBJECT (eb->priv->keywords), "child_removed", @@ -530,7 +531,7 @@ ephy_bookmarks_init (EphyBookmarks *eb) &value); g_value_unset (&value); g_value_init (&value, G_TYPE_INT); - g_value_set_int (&value, EPHY_BOOKMARKS_KEYWORD_SPECIAL_PRIORITY); + g_value_set_int (&value, EPHY_NODE_VIEW_SPECIAL_PRIORITY); ephy_node_set_property (eb->priv->favorites, EPHY_NODE_KEYWORD_PROP_PRIORITY, &value); @@ -547,7 +548,7 @@ ephy_bookmarks_init (EphyBookmarks *eb) &value); g_value_unset (&value); g_value_init (&value, G_TYPE_INT); - g_value_set_int (&value, EPHY_BOOKMARKS_KEYWORD_SPECIAL_PRIORITY); + g_value_set_int (&value, EPHY_NODE_VIEW_SPECIAL_PRIORITY); ephy_node_set_property (eb->priv->notcategorized, EPHY_NODE_KEYWORD_PROP_PRIORITY, &value); @@ -856,7 +857,7 @@ ephy_bookmarks_add_keyword (EphyBookmarks *eb, g_value_unset (&value); g_value_init (&value, G_TYPE_INT); - g_value_set_int (&value, EPHY_BOOKMARKS_KEYWORD_NORMAL_PRIORITY); + g_value_set_int (&value, EPHY_NODE_VIEW_NORMAL_PRIORITY); ephy_node_set_property (key, EPHY_NODE_KEYWORD_PROP_PRIORITY, &value); g_value_unset (&value); diff --git a/src/bookmarks/ephy-bookmarks.h b/src/bookmarks/ephy-bookmarks.h index 174c3c930..0ab70af8e 100644 --- a/src/bookmarks/ephy-bookmarks.h +++ b/src/bookmarks/ephy-bookmarks.h @@ -47,13 +47,6 @@ enum EPHY_NODE_KEYWORD_PROP_PRIORITY = 8 }; -typedef enum -{ - EPHY_BOOKMARKS_KEYWORD_ALL_PRIORITY, - EPHY_BOOKMARKS_KEYWORD_SPECIAL_PRIORITY, - EPHY_BOOKMARKS_KEYWORD_NORMAL_PRIORITY -} EphyBookmarksKeywordPriority; - struct EphyBookmarks { GObject parent; diff --git a/src/bookmarks/ephy-topics-selector.c b/src/bookmarks/ephy-topics-selector.c index cf1439617..d97a9449f 100644 --- a/src/bookmarks/ephy-topics-selector.c +++ b/src/bookmarks/ephy-topics-selector.c @@ -19,6 +19,7 @@ #include "ephy-topics-selector.h" #include "ephy-debug.h" +#include "ephy-node-view.h" #include <gtk/gtkliststore.h> #include <gtk/gtkcellrenderertoggle.h> @@ -223,9 +224,9 @@ fill_model (EphyTopicsSelector *editor) priority = ephy_node_get_property_int (kid, EPHY_NODE_KEYWORD_PROP_PRIORITY); - if (priority == -1) priority = EPHY_BOOKMARKS_KEYWORD_NORMAL_PRIORITY; + if (priority == -1) priority = EPHY_NODE_VIEW_NORMAL_PRIORITY; - if (priority == EPHY_BOOKMARKS_KEYWORD_NORMAL_PRIORITY) + if (priority == EPHY_NODE_VIEW_NORMAL_PRIORITY) { gtk_list_store_append (model, &iter); gtk_list_store_set (model, &iter, diff --git a/src/ephy-window.c b/src/ephy-window.c index 11a5e9b28..f9cd8addd 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -316,7 +316,6 @@ ephy_window_get_type (void) "EphyWindow", &our_info, 0); } - return ephy_window_type; } |