aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2003-02-11 05:34:47 +0800
committerXan Lopez <xan@src.gnome.org>2003-02-11 05:34:47 +0800
commit675475904f7a7005847bd10576cac278ccd84b2c (patch)
tree2bb821206519ba0a23cb1112f25272f196d8417d /src/bookmarks
parent78b2fbc125502918e9e614e3ee3dad5947e0a68e (diff)
downloadgsoc2013-epiphany-675475904f7a7005847bd10576cac278ccd84b2c.tar
gsoc2013-epiphany-675475904f7a7005847bd10576cac278ccd84b2c.tar.gz
gsoc2013-epiphany-675475904f7a7005847bd10576cac278ccd84b2c.tar.bz2
gsoc2013-epiphany-675475904f7a7005847bd10576cac278ccd84b2c.tar.lz
gsoc2013-epiphany-675475904f7a7005847bd10576cac278ccd84b2c.tar.xz
gsoc2013-epiphany-675475904f7a7005847bd10576cac278ccd84b2c.tar.zst
gsoc2013-epiphany-675475904f7a7005847bd10576cac278ccd84b2c.zip
Remove Location field from BE bookmarks view, add a location entry
Remove Location field from BE bookmarks view, add a location entry instead.
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c53
-rw-r--r--src/bookmarks/ephy-tree-model-node.c7
-rw-r--r--src/bookmarks/ephy-tree-model-node.h1
3 files changed, 43 insertions, 18 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 1a145188e..93a4123cc 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -54,6 +54,7 @@ struct EphyBookmarksEditorPrivate
EphyNodeView *key_view;
EphyNodeFilter *bookmarks_filter;
GtkWidget *title_entry;
+ GtkWidget *location_entry;
GtkWidget *keywords_entry;
GtkWidget *search_entry;
};
@@ -189,6 +190,7 @@ ephy_bookmarks_editor_node_selected_cb (GtkWidget *view,
{
const char *title;
const char *keywords;
+ const char *location;
if (node != NULL)
{
@@ -198,19 +200,26 @@ ephy_bookmarks_editor_node_selected_cb (GtkWidget *view,
(node, EPHY_NODE_BMK_PROP_TITLE);
keywords = ephy_node_get_property_string
(node, EPHY_NODE_BMK_PROP_KEYWORDS);
+ location = ephy_node_get_property_string
+ (node, EPHY_NODE_BMK_PROP_LOCATION);
gtk_entry_set_text (GTK_ENTRY (editor->priv->title_entry),
title ? g_strdup (title) : "");
gtk_entry_set_text (GTK_ENTRY (editor->priv->keywords_entry),
keywords ? g_strdup (keywords) : "");
+ gtk_entry_set_text (GTK_ENTRY (editor->priv->location_entry),
+ location ? g_strdup (location) : "");
gtk_widget_set_sensitive (GTK_WIDGET (editor->priv->title_entry), TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (editor->priv->keywords_entry), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (editor->priv->location_entry), TRUE);
}
else
{
gtk_entry_set_text (GTK_ENTRY (editor->priv->title_entry), "");
gtk_entry_set_text (GTK_ENTRY (editor->priv->keywords_entry), "");
+ gtk_entry_set_text (GTK_ENTRY (editor->priv->location_entry), "");
gtk_widget_set_sensitive (GTK_WIDGET (editor->priv->title_entry), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (editor->priv->keywords_entry), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (editor->priv->location_entry), FALSE);
}
}
@@ -257,7 +266,7 @@ update_prop_from_entry (EphyBookmarksEditor *editor,
GValue value = { 0, };
selection = ephy_node_view_get_selection (editor->priv->bm_view);
- if (selection)
+ if (selection != NULL)
{
EphyNode *bm = EPHY_NODE (selection->data);
char *tmp;
@@ -269,8 +278,8 @@ update_prop_from_entry (EphyBookmarksEditor *editor,
ephy_node_set_property (bm, id, &value);
g_value_unset (&value);
g_free (tmp);
+ g_list_free (selection);
}
- g_list_free (selection);
}
static void
@@ -281,6 +290,13 @@ title_entry_changed_cb (GtkWidget *entry, EphyBookmarksEditor *editor)
}
static void
+location_entry_changed_cb (GtkWidget *entry, EphyBookmarksEditor *editor)
+{
+ update_prop_from_entry (editor, editor->priv->location_entry,
+ EPHY_NODE_BMK_PROP_LOCATION);
+}
+
+static void
keywords_changed_cb (GtkWidget *entry,
EphyBookmarksEditor *editor)
{
@@ -313,6 +329,7 @@ build_editing_table (EphyBookmarksEditor *editor)
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_widget_show (table);
+ /* Title entry */
label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
str = g_strconcat ("<b>", _("Title:"), "</b>", NULL);
@@ -329,6 +346,24 @@ build_editing_table (EphyBookmarksEditor *editor)
G_CALLBACK (title_entry_changed_cb),
editor);
+ /* Location entry */
+ label = gtk_label_new (NULL);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ str = g_strconcat ("<b>", _("Location:"), "</b>", NULL);
+ gtk_label_set_markup (GTK_LABEL (label), str);
+ g_free (str);
+ gtk_widget_show (label);
+ entry = gtk_entry_new ();
+ editor->priv->location_entry = entry;
+ gtk_widget_set_sensitive (GTK_WIDGET (entry), FALSE);
+ gtk_widget_show (entry);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
+ gtk_table_attach_defaults (GTK_TABLE (table), entry, 1, 2, 1, 2);
+ g_signal_connect (G_OBJECT (entry), "changed",
+ G_CALLBACK (location_entry_changed_cb),
+ editor);
+
+ /* Keywords entry */
label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
str = g_strconcat ("<b>", _("Keywords:"), "</b>", NULL);
@@ -341,8 +376,8 @@ build_editing_table (EphyBookmarksEditor *editor)
editor->priv->keywords_entry = entry;
gtk_widget_set_sensitive (GTK_WIDGET (entry), FALSE);
gtk_widget_show (entry);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
- gtk_table_attach_defaults (GTK_TABLE (table), entry, 1, 2, 1, 2);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
+ gtk_table_attach_defaults (GTK_TABLE (table), entry, 1, 2, 2, 3);
g_signal_connect (G_OBJECT (entry), "keywords_changed",
G_CALLBACK (keywords_changed_cb),
editor);
@@ -448,9 +483,11 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
EphyNode *selected_node;
char *selected_id_str;
+ gtk_window_set_title (GTK_WINDOW (editor), _("Bookmarks"));
+
gtk_dialog_set_has_separator (GTK_DIALOG (editor), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (editor), 6);
- gtk_widget_set_size_request (GTK_WIDGET (editor), 500, 400);
+ gtk_widget_set_size_request (GTK_WIDGET (editor), 600, 400);
g_signal_connect (G_OBJECT (editor),
"response",
G_CALLBACK (ephy_bookmarks_editor_response_cb),
@@ -470,7 +507,7 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
ephy_node_view_add_column (key_view, _("Keywords"),
EPHY_TREE_MODEL_NODE_COL_KEYWORD, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (key_view), FALSE, TRUE, 0);
- gtk_widget_set_size_request (GTK_WIDGET (key_view), 120, -1);
+ gtk_widget_set_size_request (GTK_WIDGET (key_view), 180, -1);
gtk_widget_show (GTK_WIDGET (key_view));
editor->priv->key_view = key_view;
g_signal_connect (G_OBJECT (key_view),
@@ -494,8 +531,6 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
ephy_node_view_add_icon_column (bm_view, EPHY_TREE_MODEL_NODE_COL_ICON);
ephy_node_view_add_column (bm_view, _("Title"),
EPHY_TREE_MODEL_NODE_COL_BOOKMARK, TRUE);
- ephy_node_view_add_column (bm_view, _("Location"),
- EPHY_TREE_MODEL_NODE_COL_LOCATION, TRUE);
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (bm_view), TRUE, TRUE, 0);
gtk_widget_show (GTK_WIDGET (bm_view));
editor->priv->bm_view = bm_view;
@@ -520,8 +555,6 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
GTK_RESPONSE_CLOSE);
gtk_dialog_set_default_response (GTK_DIALOG (editor), GTK_RESPONSE_CLOSE);
- gtk_window_set_title (GTK_WINDOW (editor), _("Bookmarks"));
-
selected_id_str = eel_gconf_get_string (CONF_BOOKMARKS_SELECTED_NODE);
selected_id = g_ascii_strtoull (selected_id_str, NULL, 10);
if (selected_id <= 0)
diff --git a/src/bookmarks/ephy-tree-model-node.c b/src/bookmarks/ephy-tree-model-node.c
index e6b467946..41bdc235e 100644
--- a/src/bookmarks/ephy-tree-model-node.c
+++ b/src/bookmarks/ephy-tree-model-node.c
@@ -358,7 +358,6 @@ ephy_tree_model_node_get_column_type (GtkTreeModel *tree_model,
switch (index)
{
case EPHY_TREE_MODEL_NODE_COL_BOOKMARK:
- case EPHY_TREE_MODEL_NODE_COL_LOCATION:
case EPHY_TREE_MODEL_NODE_COL_KEYWORD:
return G_TYPE_STRING;
case EPHY_TREE_MODEL_NODE_COL_VISIBLE:
@@ -483,11 +482,6 @@ ephy_tree_model_node_get_value (GtkTreeModel *tree_model,
EPHY_NODE_BMK_PROP_TITLE,
value);
break;
- case EPHY_TREE_MODEL_NODE_COL_LOCATION:
- ephy_node_get_property (node,
- EPHY_NODE_BMK_PROP_LOCATION,
- value);
- break;
case EPHY_TREE_MODEL_NODE_COL_KEYWORD:
ephy_node_get_property (node,
EPHY_NODE_KEYWORD_PROP_NAME,
@@ -717,7 +711,6 @@ ephy_tree_model_node_column_get_type (void)
static const GEnumValue values[] =
{
{ EPHY_TREE_MODEL_NODE_COL_BOOKMARK, "EPHY_TREE_MODEL_NODE_COL_BOOKMARK", "bookmark" },
- { EPHY_TREE_MODEL_NODE_COL_LOCATION, "EPHY_TREE_MODEL_NODE_COL_LOCATION", "location" },
{ 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" },
diff --git a/src/bookmarks/ephy-tree-model-node.h b/src/bookmarks/ephy-tree-model-node.h
index aa2cd9d0e..5ebefa4fd 100644
--- a/src/bookmarks/ephy-tree-model-node.h
+++ b/src/bookmarks/ephy-tree-model-node.h
@@ -38,7 +38,6 @@ G_BEGIN_DECLS
typedef enum
{
EPHY_TREE_MODEL_NODE_COL_BOOKMARK,
- EPHY_TREE_MODEL_NODE_COL_LOCATION,
EPHY_TREE_MODEL_NODE_COL_KEYWORD,
EPHY_TREE_MODEL_NODE_COL_VISIBLE,
EPHY_TREE_MODEL_NODE_COL_ICON,