aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Untz <vincent@vuntz.net>2003-04-15 19:47:31 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-04-15 19:47:31 +0800
commit45fdc41e1bf87f59021c8415e240d121043d8a0f (patch)
tree3756356bbdba3aba47b742ebdfe8f15fa8e274b9
parentff1c282fd26c20c432c20350cbba084aeffd4720 (diff)
downloadgsoc2013-epiphany-45fdc41e1bf87f59021c8415e240d121043d8a0f.tar
gsoc2013-epiphany-45fdc41e1bf87f59021c8415e240d121043d8a0f.tar.gz
gsoc2013-epiphany-45fdc41e1bf87f59021c8415e240d121043d8a0f.tar.bz2
gsoc2013-epiphany-45fdc41e1bf87f59021c8415e240d121043d8a0f.tar.lz
gsoc2013-epiphany-45fdc41e1bf87f59021c8415e240d121043d8a0f.tar.xz
gsoc2013-epiphany-45fdc41e1bf87f59021c8415e240d121043d8a0f.tar.zst
gsoc2013-epiphany-45fdc41e1bf87f59021c8415e240d121043d8a0f.zip
Declare all the variables before the first instruction. Fixes a
2003-04-13 Vincent Untz <vincent@vuntz.net> * src/prefs-dialog.c: (prefs_dialog_show_help): Declare all the variables before the first instruction. Fixes a compilation problem under gcc 2.95.
-rw-r--r--ChangeLog27
-rw-r--r--lib/ephy-types.h1
-rw-r--r--src/bookmarks/ephy-bookmarks.c80
-rw-r--r--src/bookmarks/ephy-tree-model-node.c2
-rw-r--r--src/prefs-dialog.c3
5 files changed, 101 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index f8d5ee1a1..56b96b15f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2003-04-13 Vincent Untz <vincent@vuntz.net>
+
+ * src/prefs-dialog.c: (prefs_dialog_show_help):
+
+ Declare all the variables before the first instruction. Fixes a
+ compilation problem under gcc 2.95.
+
+2003-04-15 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * lib/ephy-types.h:
+ * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_save),
+ (ephy_bookmarks_init), (ephy_bookmarks_finalize),
+ (ephy_bookmarks_add), (get_topics_list), (update_topics_list),
+ (ephy_bookmarks_set_keyword), (ephy_bookmarks_unset_keyword):
+ * src/bookmarks/ephy-tree-model-node.c:
+ (ephy_tree_model_node_update_node):
+
+2003-04-15 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * lib/ephy-types.h:
+ * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_save),
+ (ephy_bookmarks_init), (ephy_bookmarks_finalize),
+ (ephy_bookmarks_add), (get_topics_list), (update_topics_list),
+ (ephy_bookmarks_set_keyword), (ephy_bookmarks_unset_keyword):
+ * src/bookmarks/ephy-tree-model-node.c:
+ (ephy_tree_model_node_update_node):
+
2003-04-14 Hasbullah Bin Pit <sebol@ikhlas.com>
* configure.in(ALL_LINGUAS): Added "ms".
diff --git a/lib/ephy-types.h b/lib/ephy-types.h
index f489081e8..c0692d6ff 100644
--- a/lib/ephy-types.h
+++ b/lib/ephy-types.h
@@ -39,6 +39,7 @@ enum
BOOKMARKS_NODE_ID = 0,
KEYWORDS_NODE_ID = 1,
FAVORITES_NODE_ID = 2,
+ BMKS_NOTCATEGORIZED_NODE_ID = 3,
STATES_NODE_ID = 4,
HOSTS_NODE_ID = 5,
PAGES_NODE_ID = 6,
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index f500082e7..1962ae3be 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -36,6 +36,7 @@ struct EphyBookmarksPrivate
EphyNode *bookmarks;
EphyNode *keywords;
EphyNode *favorites;
+ EphyNode *notcategorized;
EphyNode *lower_fav;
double lower_score;
};
@@ -289,7 +290,9 @@ ephy_bookmarks_save (EphyBookmarks *eb)
kid = g_ptr_array_index (children, i);
- if (kid != eb->priv->bookmarks && kid != eb->priv->favorites)
+ if (kid != eb->priv->bookmarks &&
+ kid != eb->priv->favorites &&
+ kid != eb->priv->notcategorized)
{
ephy_node_save_to_xml (kid, root);
}
@@ -534,6 +537,23 @@ ephy_bookmarks_init (EphyBookmarks *eb)
g_value_unset (&value);
ephy_node_add_child (eb->priv->keywords, eb->priv->favorites);
+ /* Not categorized */
+ eb->priv->notcategorized = ephy_node_new_with_id (BMKS_NOTCATEGORIZED_NODE_ID);
+ ephy_node_ref (eb->priv->notcategorized);
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, _("Not Categorized"));
+ ephy_node_set_property (eb->priv->notcategorized,
+ EPHY_NODE_KEYWORD_PROP_NAME,
+ &value);
+ g_value_unset (&value);
+ g_value_init (&value, G_TYPE_INT);
+ g_value_set_int (&value, EPHY_BOOKMARKS_KEYWORD_SPECIAL_PRIORITY);
+ ephy_node_set_property (eb->priv->notcategorized,
+ EPHY_NODE_KEYWORD_PROP_PRIORITY,
+ &value);
+ g_value_unset (&value);
+ ephy_node_add_child (eb->priv->keywords, eb->priv->notcategorized);
+
if (!ephy_bookmarks_load (eb))
{
ephy_bookmarks_init_defaults (eb);
@@ -561,6 +581,7 @@ ephy_bookmarks_finalize (GObject *object)
ephy_node_unref (eb->priv->bookmarks);
ephy_node_unref (eb->priv->keywords);
ephy_node_unref (eb->priv->favorites);
+ ephy_node_unref (eb->priv->notcategorized);
g_free (eb->priv);
@@ -609,6 +630,7 @@ ephy_bookmarks_add (EphyBookmarks *eb,
g_value_unset (&value);
ephy_node_add_child (eb->priv->bookmarks, bm);
+ ephy_node_add_child (eb->priv->notcategorized, bm);
ephy_bookmarks_emit_data_changed (eb);
ephy_bookmarks_save (eb);
@@ -897,15 +919,17 @@ ephy_bookmarks_has_keyword (EphyBookmarks *eb,
return ephy_node_has_child (keyword, bookmark);
}
-static void
-update_topics_list (EphyBookmarks *eb, EphyNode *bookmark)
+static char *
+get_topics_list (EphyBookmarks *eb,
+ EphyNode *bookmark,
+ gboolean *no_topics)
{
GPtrArray *children;
int i;
GString *list;
- GValue value = { 0, };
list = g_string_new (NULL);
+ *no_topics = TRUE;
children = ephy_node_get_children (eb->priv->keywords);
for (i = 0; i < children->len; i++)
@@ -914,23 +938,32 @@ update_topics_list (EphyBookmarks *eb, EphyNode *bookmark)
kid = g_ptr_array_index (children, i);
- if (ephy_node_has_child (kid, bookmark))
+ if (kid != eb->priv->notcategorized &&
+ kid != eb->priv->favorites &&
+ kid != eb->priv->bookmarks &&
+ ephy_node_has_child (kid, bookmark))
{
const char *topic;
topic = ephy_node_get_property_string
(kid, EPHY_NODE_KEYWORD_PROP_NAME);
g_string_append (list, topic);
+ no_topics = FALSE;
}
}
ephy_node_thaw (eb->priv->keywords);
+ return g_string_free (list, FALSE);
+}
+
+static void
+update_topics_list (EphyNode *bookmark, const char *list)
+{
+ GValue value = { 0, };
g_value_init (&value, G_TYPE_STRING);
- g_value_set_string (&value, list->str);
+ g_value_set_string (&value, list);
ephy_node_set_property (bookmark, EPHY_NODE_BMK_PROP_KEYWORDS,
&value);
g_value_unset (&value);
-
- g_string_free (list, TRUE);
}
void
@@ -938,11 +971,24 @@ ephy_bookmarks_set_keyword (EphyBookmarks *eb,
EphyNode *keyword,
EphyNode *bookmark)
{
+ gboolean no_topics;
+ char *list;
+
if (ephy_node_has_child (keyword, bookmark)) return;
ephy_node_add_child (keyword, bookmark);
- update_topics_list (eb, bookmark);
+ list = get_topics_list (eb, bookmark, &no_topics);
+
+ if (ephy_node_has_child (eb->priv->notcategorized, bookmark))
+ {
+ LOG ("Remove from categorized bookmarks")
+ ephy_node_remove_child
+ (eb->priv->notcategorized, bookmark);
+ }
+
+ update_topics_list (bookmark, list);
+ g_free (list);
}
void
@@ -950,11 +996,25 @@ ephy_bookmarks_unset_keyword (EphyBookmarks *eb,
EphyNode *keyword,
EphyNode *bookmark)
{
+ gboolean no_topics;
+ char *list;
+
if (!ephy_node_has_child (keyword, bookmark)) return;
ephy_node_remove_child (keyword, bookmark);
- update_topics_list (eb, bookmark);
+ list = get_topics_list (eb, bookmark, &no_topics);
+
+ if (no_topics &&
+ !ephy_node_has_child (eb->priv->notcategorized, bookmark))
+ {
+ LOG ("Add to not categorized bookmarks")
+ ephy_node_add_child
+ (eb->priv->notcategorized, bookmark);
+ }
+
+ update_topics_list (bookmark, list);
+ g_free (list);
}
EphyNode *
diff --git a/src/bookmarks/ephy-tree-model-node.c b/src/bookmarks/ephy-tree-model-node.c
index 2cde33400..bca22c379 100644
--- a/src/bookmarks/ephy-tree-model-node.c
+++ b/src/bookmarks/ephy-tree-model-node.c
@@ -701,6 +701,8 @@ ephy_tree_model_node_update_node (EphyTreeModelNode *model,
path = get_path_real (model, node);
}
+ LOG ("Updating row")
+
gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, &iter);
gtk_tree_path_free (path);
}
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 28d32b564..17ca94cd8 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -241,9 +241,8 @@ prefs_dialog_show_page (PrefsDialog *pd,
static void
prefs_dialog_show_help (PrefsDialog *pd)
{
- GError *err;
+ GError *err = NULL;
gint id;
- err = NULL;
gchar *help_preferences[] = {
"ephy-preferences-appearance",
"ephy-preferences-general",