aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2003-03-24 04:10:33 +0800
committerXan Lopez <xan@src.gnome.org>2003-03-24 04:10:33 +0800
commit0e595f395732cc4c2e6a18dd460beb9335f81188 (patch)
tree1540cf39044fb24a113b399d008b4933503436ca
parent9e061fdc100ec5c71288049e4daffedd4253733d (diff)
downloadgsoc2013-epiphany-0e595f395732cc4c2e6a18dd460beb9335f81188.tar
gsoc2013-epiphany-0e595f395732cc4c2e6a18dd460beb9335f81188.tar.gz
gsoc2013-epiphany-0e595f395732cc4c2e6a18dd460beb9335f81188.tar.bz2
gsoc2013-epiphany-0e595f395732cc4c2e6a18dd460beb9335f81188.tar.lz
gsoc2013-epiphany-0e595f395732cc4c2e6a18dd460beb9335f81188.tar.xz
gsoc2013-epiphany-0e595f395732cc4c2e6a18dd460beb9335f81188.tar.zst
gsoc2013-epiphany-0e595f395732cc4c2e6a18dd460beb9335f81188.zip
Some ground work on the PRIORITY property, change it from bool to int, add
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).
-rw-r--r--ChangeLog13
-rw-r--r--src/bookmarks/ephy-bookmarks.c5
-rw-r--r--src/bookmarks/ephy-node-view.c8
-rw-r--r--src/bookmarks/ephy-tree-model-node.c16
-rw-r--r--src/bookmarks/ephy-tree-model-node.h7
5 files changed, 42 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 3f629cf2c..9541857bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 ())