aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-03-23 20:30:41 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-03-23 20:30:41 +0800
commitc325934e436073606e8ff5c725f1b068618d3797 (patch)
tree7eb87588f06c0de47747b69133b8038fc677a20e
parentf360f793d3c18a3d0e9870f05d0a9787066f7046 (diff)
downloadgsoc2013-epiphany-c325934e436073606e8ff5c725f1b068618d3797.tar
gsoc2013-epiphany-c325934e436073606e8ff5c725f1b068618d3797.tar.gz
gsoc2013-epiphany-c325934e436073606e8ff5c725f1b068618d3797.tar.bz2
gsoc2013-epiphany-c325934e436073606e8ff5c725f1b068618d3797.tar.lz
gsoc2013-epiphany-c325934e436073606e8ff5c725f1b068618d3797.tar.xz
gsoc2013-epiphany-c325934e436073606e8ff5c725f1b068618d3797.tar.zst
gsoc2013-epiphany-c325934e436073606e8ff5c725f1b068618d3797.zip
Complete implementation of the editor functionalities.
2003-03-23 Marco Pesenti Gritti <marco@it.gnome.org> * TODO: * data/ui/epiphany-bookmark-editor-ui.xml.in: * src/bookmarks/ephy-bookmarks-editor.c: (cmd_add_topic), (cmd_remove_topic), (cmd_close), (cmd_rename_topic), (cmd_rename_bookmark), (ephy_bookmarks_editor_construct): * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_remove_keyword): * src/bookmarks/ephy-bookmarks.h: * src/bookmarks/ephy-node-view.c: (cell_renderer_edited), (ephy_node_view_add_column), (ephy_node_view_init), (ephy_node_view_edit): * src/bookmarks/ephy-node-view.h: Complete implementation of the editor functionalities. [Still work to do ... I updated the TODO with some of the higher priority things. If you want to work on any of them let me know ... (to avoid conflicts, I plan to keep working on this stuff in the next days).]
-rw-r--r--ChangeLog21
-rw-r--r--TODO16
-rw-r--r--data/ui/epiphany-bookmark-editor-ui.xml.in16
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c45
-rw-r--r--src/bookmarks/ephy-bookmarks.c6
-rw-r--r--src/bookmarks/ephy-bookmarks.h3
-rw-r--r--src/bookmarks/ephy-node-view.c96
-rw-r--r--src/bookmarks/ephy-node-view.h5
8 files changed, 198 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index f63acdcf7..be165c678 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2003-03-23 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * TODO:
+ * data/ui/epiphany-bookmark-editor-ui.xml.in:
+ * src/bookmarks/ephy-bookmarks-editor.c: (cmd_add_topic),
+ (cmd_remove_topic), (cmd_close), (cmd_rename_topic),
+ (cmd_rename_bookmark), (ephy_bookmarks_editor_construct):
+ * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_remove_keyword):
+ * src/bookmarks/ephy-bookmarks.h:
+ * src/bookmarks/ephy-node-view.c: (cell_renderer_edited),
+ (ephy_node_view_add_column), (ephy_node_view_init),
+ (ephy_node_view_edit):
+ * src/bookmarks/ephy-node-view.h:
+
+ Complete implementation of the editor functionalities.
+
+ [Still work to do ... I updated the TODO with some of the higher
+ priority things. If you want to work on any of them let me
+ know ... (to avoid conflicts, I plan to keep working on this
+ stuff in the next days).]
+
2003-03-23 Xan Lopez <xan@masilla.org>
* src/bookmarks/ephy-node-view.c: (ephy_node_view_button_press_cb):
diff --git a/TODO b/TODO
index 053961729..1b890ff06 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,21 @@
To do:
+Bookmarks:
+
+- Good editor menu layout, accells ...
+- All bookmarks dialogs need to use ephy_state for default/user persisted size
+- Fix import to s/folder/topic again
+- The keyword field of the bookmark need to be updated topic set/unset,
+ otherwise completion will not work
+- Consistent use of topics instead of keywords in the code
+- Drag topics on the toolbar
+- Support several special folders: I guess we need to make the All node
+ property more generic.
+- "Most used" topic. Note that here the topic term doesnt work well :/
+- "Not categorized" topic. Same prob as above.
+- Do we need "All" ?
+
+Others:
- if you change mozilla settings when ephy is not running, they arent updated in prefs.js
- downloader should resize when clicking details, so that the cursor is not moved away from the button
- make popups less annoying
diff --git a/data/ui/epiphany-bookmark-editor-ui.xml.in b/data/ui/epiphany-bookmark-editor-ui.xml.in
index 594445a13..b443989aa 100644
--- a/data/ui/epiphany-bookmark-editor-ui.xml.in
+++ b/data/ui/epiphany-bookmark-editor-ui.xml.in
@@ -1,25 +1,33 @@
<Root>
<menu>
+
<submenu name="FileMenu" verb="File">
<menuitem name="FileNewTopic" verb="NewTopic"/>
<separator name="FileSep1"/>
<menuitem name="FileOpenInWindow" verb="OpenInWindow"/>
<menuitem name="FileOpenInTab" verb="OpenInTab"/>
- <separator name="FileSep2"/>
- <menuitem name="FileRenameBookmark" verb="RenameBookmark"/>
- <menuitem name="FileRemoveBookmark" verb="RemoveBookmark"/>
- <menuitem name="FileRemoveTopic" verb="RemoveTopic"/>
<separator name="FileSep3"/>
<menuitem name="FileProperties" verb="Properties"/>
</submenu>
+
+<submenu name="EditMenu" verb="Edit">
+ <menuitem name="EditRenameBookmark" verb="RenameBookmark"/>
+ <menuitem name="EditRenameTopic" verb="RenameTopic"/>
+ <separator name="FileSep1"/>
+ <menuitem name="FileRemoveBookmark" verb="RemoveBookmark"/>
+ <menuitem name="FileRemoveTopic" verb="RemoveTopic"/>
+</submenu>
+
</menu>
<popups>
+
<popup name="EphyBookmarkEditorPopup" verb="FakeToplevel">
<menuitem name="OpenInWindowBMK" verb="OpenInWindow"/>
<menuitem name="OpenInTabBMK" verb="OpenInTab"/>
<separator name="BookmarksPopupSep1"/>
<menuitem name="RemoveBMK" verb="RemoveBookmark"/>
+ <menuitem name="RenameBMK" verb="RenameBookmark"/>
<separator name="BookmarksPopupSep2"/>
<menuitem name="BMKProperties" verb="Properties"/>
</popup>
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 7383b2477..8a0a94f0f 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -67,6 +67,10 @@ static void cmd_remove_topic (EggAction *action,
EphyBookmarksEditor *editor);
static void cmd_rename_bookmark (EggAction *action,
EphyBookmarksEditor *editor);
+static void cmd_rename_topic (EggAction *action,
+ EphyBookmarksEditor *editor);
+static void cmd_close (EggAction *action,
+ EphyBookmarksEditor *editor);
struct EphyBookmarksEditorPrivate
{
@@ -98,6 +102,7 @@ static GObjectClass *parent_class = NULL;
static EggActionGroupEntry ephy_bookmark_popup_entries [] = {
/* Toplevel */
{ "File", N_("_File"), NULL, NULL, NULL, NULL, NULL },
+ { "Edit", N_("_Edit"), NULL, NULL, NULL, NULL, NULL },
{ "FakeToplevel", (""), NULL, NULL, NULL, NULL, NULL },
{ "NewTopic", N_("_New Topic"), GTK_STOCK_NEW, NULL,
@@ -112,6 +117,9 @@ static EggActionGroupEntry ephy_bookmark_popup_entries [] = {
{ "RenameBookmark", N_("_Rename Bookmark"), NULL, NULL,
NULL, G_CALLBACK (cmd_rename_bookmark), NULL },
+ { "RenameTopic", N_("R_ename Topic"), NULL, NULL,
+ NULL, G_CALLBACK (cmd_rename_topic), NULL },
+
{ "RemoveBookmark", N_("_Delete Bookmark"), GTK_STOCK_DELETE, NULL,
NULL, G_CALLBACK (cmd_remove_bookmarks), NULL },
@@ -120,6 +128,9 @@ static EggActionGroupEntry ephy_bookmark_popup_entries [] = {
{ "Properties", N_("_Properties"), GTK_STOCK_PROPERTIES, NULL,
NULL, G_CALLBACK (cmd_bookmark_properties), NULL },
+
+ { "Close", N_("_Close"), GTK_STOCK_CLOSE, NULL,
+ NULL, G_CALLBACK (cmd_close), NULL },
};
static guint ephy_bookmark_popup_n_entries = G_N_ELEMENTS (ephy_bookmark_popup_entries);
@@ -127,18 +138,48 @@ static void
cmd_add_topic (EggAction *action,
EphyBookmarksEditor *editor)
{
+ EphyNode *node;
+
+ node = ephy_bookmarks_add_keyword (editor->priv->bookmarks,
+ _("Type a topic"));
+ ephy_node_view_select_node (editor->priv->key_view, node);
+ ephy_node_view_edit (editor->priv->key_view);
}
static void
cmd_remove_topic (EggAction *action,
EphyBookmarksEditor *editor)
{
+ GList *selection;
+
+ selection = ephy_node_view_get_selection (editor->priv->key_view);
+ if (selection)
+ {
+ EphyNode *node = EPHY_NODE (selection->data);
+ ephy_bookmarks_remove_keyword (editor->priv->bookmarks, node);
+ g_list_free (selection);
+ }
+}
+
+static void
+cmd_close (EggAction *action,
+ EphyBookmarksEditor *editor)
+{
+ gtk_widget_hide (GTK_WIDGET (editor));
+}
+
+static void
+cmd_rename_topic (EggAction *action,
+ EphyBookmarksEditor *editor)
+{
+ ephy_node_view_edit (editor->priv->key_view);
}
static void
cmd_rename_bookmark (EggAction *action,
EphyBookmarksEditor *editor)
{
+ ephy_node_view_edit (editor->priv->bm_view);
}
static GtkWidget *
@@ -571,7 +612,7 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
ephy_node_view_enable_drag_source (key_view);
ephy_node_view_set_browse_mode (key_view);
ephy_node_view_add_column (key_view, _("Topics"),
- EPHY_TREE_MODEL_NODE_COL_KEYWORD, TRUE);
+ EPHY_TREE_MODEL_NODE_COL_KEYWORD, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (key_view), FALSE, TRUE, 0);
gtk_widget_set_size_request (GTK_WIDGET (key_view), 130, -1);
gtk_widget_show (GTK_WIDGET (key_view));
@@ -599,7 +640,7 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
ephy_node_view_enable_drag_source (bm_view);
ephy_node_view_add_icon_column (bm_view, EPHY_TREE_MODEL_NODE_COL_ICON);
ephy_node_view_add_column (bm_view, _("Bookmarks"),
- EPHY_TREE_MODEL_NODE_COL_BOOKMARK, TRUE);
+ EPHY_TREE_MODEL_NODE_COL_BOOKMARK, TRUE, 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;
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 7baaf7d8f..cb6a7edc2 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -770,6 +770,12 @@ ephy_bookmarks_add_keyword (EphyBookmarks *eb,
return key;
}
+void ephy_bookmarks_remove_keyword (EphyBookmarks *eb,
+ EphyNode *keyword)
+{
+ ephy_node_remove_child (eb->priv->keywords, keyword);
+}
+
EphyNode *
ephy_bookmarks_find_keyword (EphyBookmarks *eb,
const char *name,
diff --git a/src/bookmarks/ephy-bookmarks.h b/src/bookmarks/ephy-bookmarks.h
index fa3232565..f8db9b961 100644
--- a/src/bookmarks/ephy-bookmarks.h
+++ b/src/bookmarks/ephy-bookmarks.h
@@ -89,6 +89,9 @@ EphyNode *ephy_bookmarks_find_keyword (EphyBookmarks *eb,
const char *name,
gboolean partial_match);
+void ephy_bookmarks_remove_keyword (EphyBookmarks *eb,
+ EphyNode *keyword);
+
gboolean ephy_bookmarks_has_keyword (EphyBookmarks *eb,
EphyNode *keyword,
EphyNode *bookmark);
diff --git a/src/bookmarks/ephy-node-view.c b/src/bookmarks/ephy-node-view.c
index 2c97e4f33..e91f7f912 100644
--- a/src/bookmarks/ephy-node-view.c
+++ b/src/bookmarks/ephy-node-view.c
@@ -25,6 +25,7 @@
#include <libgnome/gnome-i18n.h>
#include "eggtreemodelfilter.h"
+#include "ephy-bookmarks.h"
#include "ephy-tree-model-node.h"
#include "ephy-node-view.h"
#include "ephy-tree-model-sort.h"
@@ -51,6 +52,9 @@ struct EphyNodeViewPrivate
EphyTreeModelNode *nodemodel;
GtkTreeModel *filtermodel;
GtkTreeModel *sortmodel;
+ GtkCellRenderer *editable_renderer;
+ GtkTreeViewColumn *editable_column;
+ EphyTreeModelNodeColumn editable_node_column;
EphyNodeFilter *filter;
@@ -493,18 +497,75 @@ set_sort_column_id (EphyNodeView *view)
return FALSE;
}
-
+
+static void
+cell_renderer_edited (GtkCellRendererText *cell,
+ const char *path_str,
+ const char *new_text,
+ EphyNodeView *view)
+{
+ GValue value = { 0, };
+ GtkTreePath *path;
+ GtkTreeIter iter, iter2;
+ EphyNode *node;
+
+ g_object_set (G_OBJECT (view->priv->editable_renderer),
+ "editable", FALSE,
+ NULL);
+
+ path = gtk_tree_path_new_from_string (path_str);
+ gtk_tree_model_get_iter (view->priv->sortmodel, &iter, path);
+ gtk_tree_model_sort_convert_iter_to_child_iter
+ (GTK_TREE_MODEL_SORT (view->priv->sortmodel), &iter2, &iter);
+ egg_tree_model_filter_convert_iter_to_child_iter
+ (EGG_TREE_MODEL_FILTER (view->priv->filtermodel), &iter, &iter2);
+ node = ephy_tree_model_node_node_from_iter (view->priv->nodemodel, &iter);
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, new_text);
+
+ switch (view->priv->editable_node_column)
+ {
+ case EPHY_TREE_MODEL_NODE_COL_BOOKMARK:
+ ephy_node_set_property (node,
+ EPHY_NODE_BMK_PROP_TITLE,
+ &value);
+ break;
+ case EPHY_TREE_MODEL_NODE_COL_KEYWORD:
+ ephy_node_set_property (node,
+ EPHY_NODE_KEYWORD_PROP_NAME,
+ &value);
+ break;
+ default:
+ break;
+ }
+
+ g_value_unset (&value);
+}
+
void
ephy_node_view_add_column (EphyNodeView *view,
const char *title,
EphyTreeModelNodeColumn column,
- gboolean sortable)
+ gboolean sortable,
+ gboolean editable)
{
GtkTreeViewColumn *gcolumn;
GtkCellRenderer *renderer;
+ g_return_if_fail (!editable || view->priv->editable_renderer == NULL);
+
gcolumn = (GtkTreeViewColumn *) gtk_tree_view_column_new ();
renderer = gtk_cell_renderer_text_new ();
+
+ if (editable)
+ {
+ view->priv->editable_renderer = renderer;
+ view->priv->editable_column = gcolumn;
+ view->priv->editable_node_column = column;
+ g_signal_connect (renderer, "edited", G_CALLBACK (cell_renderer_edited), view);
+ }
+
gtk_tree_view_column_pack_start (gcolumn, renderer, TRUE);
gtk_tree_view_column_set_attributes (gcolumn, renderer,
"text", column,
@@ -545,6 +606,7 @@ static void
ephy_node_view_init (EphyNodeView *view)
{
view->priv = g_new0 (EphyNodeViewPrivate, 1);
+ view->priv->editable_renderer = NULL;
}
static void
@@ -655,10 +717,38 @@ ephy_node_view_enable_drag_source (EphyNodeView *view)
ephy_dnd_enable_model_drag_source (GTK_WIDGET (view->priv->treeview));
}
-void
+void
ephy_node_view_set_hinted (EphyNodeView *view, gboolean hinted)
{
g_return_if_fail (view != NULL);
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view->priv->treeview), hinted);
}
+
+void
+ephy_node_view_edit (EphyNodeView *view)
+{
+ GtkTreeSelection *selection;
+ GList *rows;
+ GtkTreeModel *model;
+
+ g_return_if_fail (view->priv->editable_renderer != NULL);
+
+ selection = gtk_tree_view_get_selection
+ (GTK_TREE_VIEW (view->priv->treeview));
+ rows = gtk_tree_selection_get_selected_rows (selection, &model);
+ if (rows == NULL) return;
+
+ g_object_set (G_OBJECT (view->priv->editable_renderer),
+ "editable", TRUE,
+ NULL);
+
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (view->priv->treeview),
+ (GtkTreePath *)rows->data,
+ view->priv->editable_column,
+ TRUE);
+
+ g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
+ g_list_free (rows);
+}
+
diff --git a/src/bookmarks/ephy-node-view.h b/src/bookmarks/ephy-node-view.h
index 89a84f72c..9055b914e 100644
--- a/src/bookmarks/ephy-node-view.h
+++ b/src/bookmarks/ephy-node-view.h
@@ -64,7 +64,8 @@ void ephy_node_view_enable_dnd (EphyNodeView *view);
void ephy_node_view_add_column (EphyNodeView *view,
const char *title,
EphyTreeModelNodeColumn column,
- gboolean sortable);
+ gboolean sortable,
+ gboolean editable);
void ephy_node_view_add_icon_column (EphyNodeView *view,
EphyTreeModelNodeColumn column);
@@ -83,6 +84,8 @@ void ephy_node_view_enable_drag_source (EphyNodeView *view);
void ephy_node_view_set_hinted (EphyNodeView *view,
gboolean hinted);
+void ephy_node_view_edit (EphyNodeView *view);
+
G_END_DECLS
#endif /* EPHY_NODE_VIEW_H */