aboutsummaryrefslogtreecommitdiffstats
path: root/lib/widgets/ephy-node-view.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-04-18 18:19:22 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-04-18 18:19:22 +0800
commit26d1ed1f62e1c3229729bb79673f1b424a4dd8d9 (patch)
tree9ba8e9dec6fa731d89980ae62ce615e1630cab6e /lib/widgets/ephy-node-view.c
parent6e4b4bb1ec37e4afb9a8b52bb81d4d82ce20b136 (diff)
downloadgsoc2013-epiphany-26d1ed1f62e1c3229729bb79673f1b424a4dd8d9.tar
gsoc2013-epiphany-26d1ed1f62e1c3229729bb79673f1b424a4dd8d9.tar.gz
gsoc2013-epiphany-26d1ed1f62e1c3229729bb79673f1b424a4dd8d9.tar.bz2
gsoc2013-epiphany-26d1ed1f62e1c3229729bb79673f1b424a4dd8d9.tar.lz
gsoc2013-epiphany-26d1ed1f62e1c3229729bb79673f1b424a4dd8d9.tar.xz
gsoc2013-epiphany-26d1ed1f62e1c3229729bb79673f1b424a4dd8d9.tar.zst
gsoc2013-epiphany-26d1ed1f62e1c3229729bb79673f1b424a4dd8d9.zip
Do not install two copies of epiphany.png
2003-04-18 Marco Pesenti Gritti <marco@it.gnome.org> * data/art/Makefile.am: Do not install two copies of epiphany.png * embed/ephy-history.c: (ephy_history_save), (ephy_history_set_page_title): Use host name as title for sites, not the real title. * lib/ephy-state.c: (ephy_state_add_window), (paned_size_allocate_cb), (ephy_state_add_paned): * lib/ephy-state.h: Add a way to persist paned. * lib/widgets/ephy-node-view.h: * lib/widgets/ephy-node-view.c: (ephy_node_view_sort_func), (provide_text_weight), (ephy_node_view_add_column), (ephy_node_view_has_selection): Improve add_column api a bit to support both auto sorting and user sorting. * src/bookmarks/ephy-bookmarks-editor.c: (ephy_bookmarks_editor_construct): Updates for changed api. * src/ephy-history-window.c: (ephy_history_window_construct): Set a max size for title/location. Not very good, but the best we can do with current treeview api prolly. Persist the paned size. Make columns user sortable.
Diffstat (limited to 'lib/widgets/ephy-node-view.c')
-rw-r--r--lib/widgets/ephy-node-view.c79
1 files changed, 34 insertions, 45 deletions
diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c
index 1d8eba5cd..3d52afd21 100644
--- a/lib/widgets/ephy-node-view.c
+++ b/lib/widgets/ephy-node-view.c
@@ -64,7 +64,6 @@ struct EphyNodeViewPrivate
int default_sort_column_id;
int priority_prop_id;
- int priority_column_id;
gboolean editing;
int editable_property;
@@ -659,7 +658,6 @@ ephy_node_view_sort_func (GtkTreeModel *model,
GValue a_value = {0, };
GValue b_value = {0, };
gchar *stra, *strb;
-
gtk_tree_model_get_value (model, a, column, &a_value);
gtk_tree_model_get_value (model, b, column, &b_value);
@@ -702,24 +700,6 @@ ephy_node_view_sort_func (GtkTreeModel *model,
}
-static gboolean
-set_sort_column_id (EphyNodeView *view)
-{
- GList *sort_order = NULL;
- 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),
- GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
- GTK_SORT_ASCENDING);
- gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (view->priv->sortmodel),
- ephy_node_view_sort_func,
- sort_order,
- (GtkDestroyNotify) g_list_free);
-
- return FALSE;
-}
-
static void
provide_priority (EphyNode *node, GValue *value, EphyNodeView *view)
{
@@ -744,9 +724,13 @@ provide_text_weight (EphyNode *node, GValue *value, EphyNodeView *view)
(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 *
@@ -755,14 +739,14 @@ ephy_node_view_add_column (EphyNodeView *view,
GType value_type,
int prop_id,
int priority_prop_id,
- gboolean editable,
- gboolean sortable)
+ EphyNodeViewFlags flags)
{
GtkTreeViewColumn *gcolumn;
GtkCellRenderer *renderer;
int column;
- g_return_val_if_fail (!editable || view->priv->editable_renderer == NULL, NULL);
+ g_return_val_if_fail (!(flags & EPHY_NODE_VIEW_EDITABLE) ||
+ view->priv->editable_renderer == NULL, NULL);
column = ephy_tree_model_node_add_prop_column
(view->priv->nodemodel, value_type, prop_id);
@@ -770,7 +754,7 @@ ephy_node_view_add_column (EphyNodeView *view,
gcolumn = (GtkTreeViewColumn *) gtk_tree_view_column_new ();
renderer = gtk_cell_renderer_text_new ();
- if (editable)
+ if (flags & EPHY_NODE_VIEW_EDITABLE)
{
view->priv->editable_renderer = renderer;
view->priv->editable_column = gcolumn;
@@ -782,10 +766,12 @@ ephy_node_view_add_column (EphyNodeView *view,
gtk_tree_view_column_set_attributes (gcolumn, renderer,
"text", column,
NULL);
- if (priority_prop_id > 0)
+ if (priority_prop_id >= 0)
{
int wcol;
+ view->priv->priority_prop_id = priority_prop_id;
+
wcol = ephy_tree_model_node_add_func_column
(view->priv->nodemodel, G_TYPE_INT,
(EphyTreeModelNodeValueFunc) provide_text_weight,
@@ -794,25 +780,41 @@ ephy_node_view_add_column (EphyNodeView *view,
"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)
+ if (flags & EPHY_NODE_VIEW_USER_SORT)
+ {
+ GList *order = NULL;
+
+ order = g_list_append (order, GINT_TO_POINTER (column));
+ gtk_tree_sortable_set_sort_func
+ (GTK_TREE_SORTABLE (view->priv->sortmodel),
+ column, ephy_node_view_sort_func,
+ order, (GtkDestroyNotify)g_list_free);
+ gtk_tree_view_column_set_sort_column_id (gcolumn, column);
+ }
+ else if (flags & EPHY_NODE_VIEW_AUTO_SORT)
{
int scol;
+ GList *order = NULL;
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);
+ order = g_list_append (order, GINT_TO_POINTER (scol));
+ order = g_list_append (order, GINT_TO_POINTER (column));
+ gtk_tree_sortable_set_default_sort_func
+ (GTK_TREE_SORTABLE (view->priv->sortmodel),
+ ephy_node_view_sort_func,
+ order, (GtkDestroyNotify)g_list_free);
+ gtk_tree_sortable_set_sort_column_id
+ (GTK_TREE_SORTABLE (view->priv->sortmodel),
+ GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
+ GTK_SORT_ASCENDING);
}
return gcolumn;
@@ -1084,16 +1086,3 @@ 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);
-}