diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 5 | ||||
-rw-r--r-- | src/bookmarks/ephy-node-view.c | 8 | ||||
-rw-r--r-- | src/bookmarks/ephy-tree-model-node.c | 16 | ||||
-rw-r--r-- | src/bookmarks/ephy-tree-model-node.h | 7 |
5 files changed, 42 insertions, 7 deletions
@@ -1,3 +1,16 @@ +2003-03-23 Xan Lopez <xan@masilla.org> + + * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_init): + * src/bookmarks/ephy-node-view.c: (ephy_node_view_sort_func): + * src/bookmarks/ephy-tree-model-node.c: + (ephy_tree_model_node_get_column_type), + (ephy_tree_model_node_get_value): + * src/bookmarks/ephy-tree-model-node.h: + + Some ground work on the PRIORITY property, change it from + bool to int, add more priority types (ALL, SPECIAL, NORMAL), + and use it in the WEIGTH_TEXT property (just ALL is bold now). + 2003-03-23 David Bordoley <bordoley@msu.edu> * data/art/Makefile.am: diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index cb6a7edc2..5c4bd0694 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -21,6 +21,7 @@ #include "ephy-shell.h" #include "ephy-history.h" #include "ephy-debug.h" +#include "ephy-tree-model-node.h" #include <string.h> #include <libgnome/gnome-i18n.h> @@ -444,8 +445,8 @@ ephy_bookmarks_init (EphyBookmarks *eb) /* Keywords */ eb->priv->keywords = ephy_node_new_with_id (KEYWORDS_NODE_ID); ephy_node_ref (eb->priv->keywords); - g_value_init (&value, G_TYPE_BOOLEAN); - g_value_set_boolean (&value, TRUE); + g_value_init (&value, G_TYPE_INT); + g_value_set_int (&value, EPHY_TREE_MODEL_ALL_PRIORITY); ephy_node_set_property (eb->priv->bookmarks, EPHY_NODE_KEYWORD_PROP_ALL_PRIORITY, &value); diff --git a/src/bookmarks/ephy-node-view.c b/src/bookmarks/ephy-node-view.c index e91f7f912..afa9505c4 100644 --- a/src/bookmarks/ephy-node-view.c +++ b/src/bookmarks/ephy-node-view.c @@ -458,6 +458,14 @@ ephy_node_view_sort_func (GtkTreeModel *model, column == EPHY_TREE_MODEL_NODE_COL_KEYWORD) retval = strcmp (stra, strb); break; + case G_TYPE_INT: + if (g_value_get_int (&a_value) < g_value_get_int (&b_value)) + retval = -1; + else if (g_value_get_int (&a_value) == g_value_get_int (&b_value)) + retval = 0; + else + retval = 1; + break; case G_TYPE_BOOLEAN: if (g_value_get_boolean (&a_value) < g_value_get_boolean (&b_value)) retval = -1; diff --git a/src/bookmarks/ephy-tree-model-node.c b/src/bookmarks/ephy-tree-model-node.c index e62acbad7..bf8e0570c 100644 --- a/src/bookmarks/ephy-tree-model-node.c +++ b/src/bookmarks/ephy-tree-model-node.c @@ -361,9 +361,9 @@ ephy_tree_model_node_get_column_type (GtkTreeModel *tree_model, 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: - case EPHY_TREE_MODEL_NODE_COL_PRIORITY: return G_TYPE_BOOLEAN; case EPHY_TREE_MODEL_NODE_COL_ICON: return GDK_TYPE_PIXBUF; @@ -466,6 +466,7 @@ ephy_tree_model_node_get_value (GtkTreeModel *tree_model, { 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); @@ -509,15 +510,20 @@ ephy_tree_model_node_get_value (GtkTreeModel *tree_model, break; case EPHY_TREE_MODEL_NODE_COL_TITLE_WEIGHT: g_value_init (value, G_TYPE_INT); - if (!ephy_node_get_property_boolean (node, EPHY_NODE_KEYWORD_PROP_ALL_PRIORITY)) + /* Only priority ALL (0) has bold text */ + if (ephy_node_get_property_int (node, EPHY_NODE_KEYWORD_PROP_ALL_PRIORITY)) g_value_set_int (value, PANGO_WEIGHT_NORMAL); else g_value_set_int (value, PANGO_WEIGHT_BOLD); break; case EPHY_TREE_MODEL_NODE_COL_PRIORITY: - g_value_init (value, G_TYPE_BOOLEAN); - g_value_set_boolean (value, !ephy_node_get_property_boolean (node, - EPHY_NODE_KEYWORD_PROP_ALL_PRIORITY)); + g_value_init (value, G_TYPE_INT); + priority = ephy_node_get_property_int (node, EPHY_NODE_KEYWORD_PROP_ALL_PRIORITY); + if (priority == EPHY_TREE_MODEL_ALL_PRIORITY || + priority == EPHY_TREE_MODEL_SPECIAL_PRIORITY) + g_value_set_int (value, priority); + else + g_value_set_int (value, EPHY_TREE_MODEL_NORMAL_PRIORITY); break; default: g_assert_not_reached (); diff --git a/src/bookmarks/ephy-tree-model-node.h b/src/bookmarks/ephy-tree-model-node.h index afc862f58..94139e7e1 100644 --- a/src/bookmarks/ephy-tree-model-node.h +++ b/src/bookmarks/ephy-tree-model-node.h @@ -46,6 +46,13 @@ typedef enum EPHY_TREE_MODEL_NODE_NUM_COLUMNS } EphyTreeModelNodeColumn; +typedef enum +{ + EPHY_TREE_MODEL_ALL_PRIORITY, + EPHY_TREE_MODEL_SPECIAL_PRIORITY, + EPHY_TREE_MODEL_NORMAL_PRIORITY +} EphyTreeModelNodePriority; + GType ephy_tree_model_node_column_get_type (void); #define EPHY_TYPE_TREE_MODEL_NODE_COLUMN (ephy_tree_model_node_column_get_type ()) |