aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-09-21 21:57:34 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-09-21 21:57:34 +0800
commitd538e7d29b445a3f15893d907aa2d11285cf9c6d (patch)
tree26a3b7205138f2ba0c5e1f80d4ae74f4fd61ce21
parent740323fa9dc25b6d831c5ff4b681ad142cc1afa6 (diff)
downloadgsoc2013-epiphany-d538e7d29b445a3f15893d907aa2d11285cf9c6d.tar
gsoc2013-epiphany-d538e7d29b445a3f15893d907aa2d11285cf9c6d.tar.gz
gsoc2013-epiphany-d538e7d29b445a3f15893d907aa2d11285cf9c6d.tar.bz2
gsoc2013-epiphany-d538e7d29b445a3f15893d907aa2d11285cf9c6d.tar.lz
gsoc2013-epiphany-d538e7d29b445a3f15893d907aa2d11285cf9c6d.tar.xz
gsoc2013-epiphany-d538e7d29b445a3f15893d907aa2d11285cf9c6d.tar.zst
gsoc2013-epiphany-d538e7d29b445a3f15893d907aa2d11285cf9c6d.zip
Implement a way to choose visible column in a menu. Not finished I need to
2003-09-21 Marco Pesenti Gritti <marco@gnome.org> * data/ui/epiphany-bookmark-editor-ui.xml: * lib/widgets/ephy-node-view.c: (ephy_node_view_add_column): * src/bookmarks/ephy-bookmarks-editor.c: (cmd_view_columns), (ephy_bookmarks_editor_construct): Implement a way to choose visible column in a menu. Not finished I need to persist state in a gconf key.
-rw-r--r--ChangeLog10
-rw-r--r--data/ui/epiphany-bookmark-editor-ui.xml5
-rw-r--r--lib/widgets/ephy-node-view.c3
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c73
4 files changed, 71 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 7be6ffebb..df5a3d785 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2003-09-21 Marco Pesenti Gritti <marco@gnome.org>
+
+ * data/ui/epiphany-bookmark-editor-ui.xml:
+ * lib/widgets/ephy-node-view.c: (ephy_node_view_add_column):
+ * src/bookmarks/ephy-bookmarks-editor.c: (cmd_view_columns),
+ (ephy_bookmarks_editor_construct):
+
+ Implement a way to choose visible column in a menu. Not finished
+ I need to persist state in a gconf key.
+
2003-09-21 Christian Persch <chpe@cvs.gnome.org>
* configure.in:
diff --git a/data/ui/epiphany-bookmark-editor-ui.xml b/data/ui/epiphany-bookmark-editor-ui.xml
index 449229660..15a48f544 100644
--- a/data/ui/epiphany-bookmark-editor-ui.xml
+++ b/data/ui/epiphany-bookmark-editor-ui.xml
@@ -25,6 +25,11 @@
<menuitem name="EditSelectAll" action="SelectAll"/>
</menu>
+<menu name="ViewMenu" action="View">
+ <menuitem name="ViewTitleMenu" action="ViewTitle"/>
+ <menuitem name="ViewTitleAddressMenu" action="ViewTitleAddress"/>
+</menu>
+
<menu name="HelpMenu" action="Help">
<menuitem name="HelpContents" action="HelpContents"/>
<menuitem name="HelpAbout" action="HelpAbout"/>
diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c
index 774a1e9f7..1c36a7768 100644
--- a/lib/widgets/ephy-node-view.c
+++ b/lib/widgets/ephy-node-view.c
@@ -1202,9 +1202,6 @@ ephy_node_view_add_column (EphyNodeView *view,
int column;
int icon_column;
- g_return_val_if_fail (!(flags & EPHY_NODE_VIEW_EDITABLE) ||
- view->priv->editable_renderer == NULL, NULL);
-
column = ephy_tree_model_node_add_prop_column
(view->priv->nodemodel, value_type, prop_id);
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 0258d9aaa..685c762ff 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -139,6 +139,9 @@ struct EphyBookmarksEditorPrivate
int priority_col;
EphyToolbarsModel *tb_model;
GHashTable *props_dialogs;
+
+ GtkTreeViewColumn *title_col;
+ GtkTreeViewColumn *address_col;
};
enum
@@ -196,17 +199,6 @@ static GtkActionEntry ephy_bookmark_popup_entries [] = {
N_("Select all bookmarks or text"),
G_CALLBACK (cmd_select_all) },
- /* View Menu */
-/* { "ViewTitle", N_("_Title"), NULL, NULL,
- N_("Show only the title column"),
- NULL, NULL, RADIO_ACTION, NULL },
- { "ViewLocation", N_("_Address"), NULL, NULL,
- N_("Show only the address column"),
- NULL, NULL, RADIO_ACTION, "ViewTitle" },
- { "ViewTitleLocation", N_("T_itle and Address"), NULL, NULL,
- N_("Show both the title and address columns"),
- NULL, NULL, RADIO_ACTION, "ViewTitle" }, */
-
/* Help Menu */
{ "HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1",
N_("Display bookmarks help"),
@@ -224,9 +216,25 @@ static GtkToggleActionEntry ephy_bookmark_popup_toggle_entries [] =
N_("Show the selected bookmark or topic in the bookmarks bar"),
G_CALLBACK (cmd_show_in_bookmarks_bar), FALSE }
};
-
static guint ephy_bookmark_popup_n_toggle_entries = G_N_ELEMENTS (ephy_bookmark_popup_toggle_entries);
+enum
+{
+ VIEW_TITLE,
+ VIEW_TITLE_AND_ADDRESS
+};
+
+static GtkRadioActionEntry ephy_bookmark_radio_entries [] =
+{
+ /* View Menu */
+ { "ViewTitle", NULL, N_("_Title"), NULL,
+ N_("Show only the title column"), VIEW_TITLE },
+ { "ViewTitleAddress", NULL, N_("T_itle and Address"), NULL,
+ N_("Show both the title and address columns"),
+ VIEW_TITLE_AND_ADDRESS }
+};
+static guint ephy_bookmark_n_radio_entries = G_N_ELEMENTS (ephy_bookmark_radio_entries);
+
static void
entry_selection_changed_cb (GtkWidget *widget, GParamSpec *pspec, EphyBookmarksEditor *editor)
{
@@ -665,6 +673,30 @@ cmd_help_contents (GtkAction *action,
"ephy-managing-bookmarks");
}
+static void
+cmd_view_columns (GtkAction *action,
+ GtkRadioAction *current,
+ EphyBookmarksEditor *editor)
+{
+ int value;
+
+ g_return_if_fail (EPHY_IS_BOOKMARKS_EDITOR (editor));
+
+ value = gtk_radio_action_get_current_value (current);
+
+ switch (value)
+ {
+ case VIEW_TITLE:
+ gtk_tree_view_column_set_visible (editor->priv->title_col, TRUE);
+ gtk_tree_view_column_set_visible (editor->priv->address_col, FALSE);
+ break;
+ case VIEW_TITLE_AND_ADDRESS:
+ gtk_tree_view_column_set_visible (editor->priv->title_col, TRUE);
+ gtk_tree_view_column_set_visible (editor->priv->address_col, TRUE);
+ break;
+ }
+}
+
GType
ephy_bookmarks_editor_get_type (void)
{
@@ -1237,6 +1269,12 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
ephy_bookmark_popup_toggle_entries,
ephy_bookmark_popup_n_toggle_entries,
editor);
+ gtk_action_group_add_radio_actions (action_group,
+ ephy_bookmark_radio_entries,
+ ephy_bookmark_n_radio_entries,
+ VIEW_TITLE,
+ G_CALLBACK (cmd_view_columns),
+ editor);
gtk_ui_manager_insert_action_group (ui_merge,
action_group, 0);
gtk_ui_manager_add_ui_from_file (ui_merge,
@@ -1249,10 +1287,6 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
editor->priv->ui_merge = ui_merge;
editor->priv->action_group = action_group;
- /* Fixme: We should implement gconf prefs for monitoring this setting */
-/* action = gtk_action_group_get_action (action_group, "ViewTitle");
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);*/
-
hpaned = gtk_hpaned_new ();
gtk_container_set_border_width (GTK_CONTAINER (hpaned), 0);
gtk_box_pack_end (GTK_BOX (editor->priv->main_vbox), hpaned,
@@ -1352,12 +1386,17 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
bmk_drag_types,
n_bmk_drag_types,
col_id);
- ephy_node_view_add_column (EPHY_NODE_VIEW (bm_view), _("Title"),
+ editor->priv->title_col = ephy_node_view_add_column
+ (EPHY_NODE_VIEW (bm_view), _("Title"),
G_TYPE_STRING, EPHY_NODE_BMK_PROP_TITLE, -1,
EPHY_NODE_VIEW_AUTO_SORT |
EPHY_NODE_VIEW_EDITABLE |
EPHY_NODE_VIEW_SEARCHABLE,
provide_favicon);
+ editor->priv->address_col = ephy_node_view_add_column
+ (EPHY_NODE_VIEW (bm_view), _("Address"),
+ G_TYPE_STRING, EPHY_NODE_BMK_PROP_LOCATION,
+ 0, -1, NULL);
gtk_container_add (GTK_CONTAINER (scrolled_window), bm_view);
gtk_widget_show (bm_view);
editor->priv->bm_view = bm_view;