aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-04-29 16:50:19 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-04-29 16:50:19 +0800
commit56b18a72cbde121e7999846d99bb3e8eb91d4068 (patch)
treeee9ad4aa70d426a2d2c9060c2bc189a43e416698
parentfefbbb55910beadb0e568e917d3736cd5c62d31a (diff)
downloadgsoc2013-epiphany-56b18a72cbde121e7999846d99bb3e8eb91d4068.tar
gsoc2013-epiphany-56b18a72cbde121e7999846d99bb3e8eb91d4068.tar.gz
gsoc2013-epiphany-56b18a72cbde121e7999846d99bb3e8eb91d4068.tar.bz2
gsoc2013-epiphany-56b18a72cbde121e7999846d99bb3e8eb91d4068.tar.lz
gsoc2013-epiphany-56b18a72cbde121e7999846d99bb3e8eb91d4068.tar.xz
gsoc2013-epiphany-56b18a72cbde121e7999846d99bb3e8eb91d4068.tar.zst
gsoc2013-epiphany-56b18a72cbde121e7999846d99bb3e8eb91d4068.zip
Remove add_icon_column func and add the functionality to the normal
2003-04-29 Marco Pesenti Gritti <marco@it.gnome.org> * lib/widgets/ephy-node-view.c: (ephy_node_view_add_column): * lib/widgets/ephy-node-view.h: Remove add_icon_column func and add the functionality to the normal add_column. The icon will be packed in the same column. * src/bookmarks/ephy-bookmarks-editor.c: (entry_selection_changed_cb), (add_entry_monitor), (add_text_renderer_monitor), (cmd_add_topic), (cmd_rename), (build_search_box), (ephy_bookmarks_editor_construct), (toolbar_items_changed_cb), (ephy_bookmarks_editor_init): Fix for api change. Deal with 2 more sensitivity cases: bookmarks added by dnd to the toolbar and treeview text renderers. Remove hints until we have more columns. * src/ephy-history-window.c: (ephy_history_window_construct): Fix for new api * src/ephy-toolbars-model.c: (impl_add_item): Dont check if normal items are already in the toolbar: fix warnings.
-rw-r--r--ChangeLog31
-rw-r--r--lib/widgets/ephy-node-view.c42
-rw-r--r--lib/widgets/ephy-node-view.h6
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c71
-rw-r--r--src/ephy-history-window.c11
-rwxr-xr-xsrc/ephy-toolbars-model.c12
6 files changed, 115 insertions, 58 deletions
diff --git a/ChangeLog b/ChangeLog
index 624ca3939..6eeef1349 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+2003-04-29 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * lib/widgets/ephy-node-view.c: (ephy_node_view_add_column):
+ * lib/widgets/ephy-node-view.h:
+
+ Remove add_icon_column func and add the functionality to the
+ normal add_column. The icon will be packed in the same column.
+
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ (entry_selection_changed_cb), (add_entry_monitor),
+ (add_text_renderer_monitor), (cmd_add_topic), (cmd_rename),
+ (build_search_box), (ephy_bookmarks_editor_construct),
+ (toolbar_items_changed_cb), (ephy_bookmarks_editor_init):
+
+ Fix for api change.
+
+ Deal with 2 more sensitivity cases:
+ bookmarks added by dnd to the toolbar and treeview text
+ renderers.
+
+ Remove hints until we have more columns.
+
+ * src/ephy-history-window.c: (ephy_history_window_construct):
+
+ Fix for new api
+
+ * src/ephy-toolbars-model.c: (impl_add_item):
+
+ Dont check if normal items are already in the toolbar:
+ fix warnings.
+
2003-04-28 David Bordoley <bordoley@msu.edu>
* po/POTFILES.in:
diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c
index 18b6cd29c..5b94a5069 100644
--- a/lib/widgets/ephy-node-view.c
+++ b/lib/widgets/ephy-node-view.c
@@ -739,11 +739,14 @@ ephy_node_view_add_column (EphyNodeView *view,
GType value_type,
int prop_id,
int priority_prop_id,
- EphyNodeViewFlags flags)
+ EphyNodeViewFlags flags,
+ EphyTreeModelNodeValueFunc icon_func)
+
{
GtkTreeViewColumn *gcolumn;
GtkCellRenderer *renderer;
int column;
+ int icon_column;
g_return_val_if_fail (!(flags & EPHY_NODE_VIEW_EDITABLE) ||
view->priv->editable_renderer == NULL, NULL);
@@ -752,6 +755,19 @@ ephy_node_view_add_column (EphyNodeView *view,
(view->priv->nodemodel, value_type, prop_id);
gcolumn = (GtkTreeViewColumn *) gtk_tree_view_column_new ();
+
+ if (icon_func)
+ {
+ icon_column = ephy_tree_model_node_add_func_column
+ (view->priv->nodemodel, GDK_TYPE_PIXBUF, icon_func, NULL);
+
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ gtk_tree_view_column_pack_start (gcolumn, renderer, FALSE);
+ gtk_tree_view_column_set_attributes (gcolumn, renderer,
+ "pixbuf", icon_column,
+ NULL);
+ }
+
renderer = gtk_cell_renderer_text_new ();
if (flags & EPHY_NODE_VIEW_EDITABLE)
@@ -767,6 +783,7 @@ ephy_node_view_add_column (EphyNodeView *view,
gtk_tree_view_column_set_attributes (gcolumn, renderer,
"text", column,
NULL);
+
if (priority_prop_id >= 0)
{
int wcol;
@@ -824,29 +841,6 @@ ephy_node_view_add_column (EphyNodeView *view,
return gcolumn;
}
-void
-ephy_node_view_add_icon_column (EphyNodeView *view,
- EphyTreeModelNodeValueFunc func)
-{
- GtkTreeViewColumn *gcolumn;
- GtkCellRenderer *renderer;
- int column;
-
- column = ephy_tree_model_node_add_func_column
- (view->priv->nodemodel, GDK_TYPE_PIXBUF, func, NULL);
-
- gcolumn = (GtkTreeViewColumn *) gtk_tree_view_column_new ();
- renderer = gtk_cell_renderer_pixbuf_new ();
- gtk_tree_view_column_pack_start (gcolumn, renderer, TRUE);
- gtk_tree_view_column_set_attributes (gcolumn, renderer,
- "pixbuf", column,
- NULL);
- gtk_tree_view_column_set_sizing (gcolumn,
- GTK_TREE_VIEW_COLUMN_GROW_ONLY);
- gtk_tree_view_append_column (GTK_TREE_VIEW (view),
- gcolumn);
-}
-
static void
ephy_node_view_init (EphyNodeView *view)
{
diff --git a/lib/widgets/ephy-node-view.h b/lib/widgets/ephy-node-view.h
index f19f8cc30..100f8fc25 100644
--- a/lib/widgets/ephy-node-view.h
+++ b/lib/widgets/ephy-node-view.h
@@ -81,10 +81,8 @@ GtkTreeViewColumn *ephy_node_view_add_column (EphyNodeView *view,
GType value_type,
int prop_id,
int priority_prop_id,
- EphyNodeViewFlags flags);
-
-void ephy_node_view_add_icon_column (EphyNodeView *view,
- EphyTreeModelNodeValueFunc func);
+ EphyNodeViewFlags flags,
+ EphyTreeModelNodeValueFunc icon_func);
void ephy_node_view_remove (EphyNodeView *view);
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index cf4c7c619..d314ab660 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -82,6 +82,7 @@ static void ephy_bookmarks_editor_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
+static void ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor);
static void search_entry_changed_cb (GtkWidget *entry,
EphyBookmarksEditor *editor);
@@ -204,6 +205,36 @@ static EggActionGroupEntry ephy_bookmark_popup_entries [] = {
static guint ephy_bookmark_popup_n_entries = G_N_ELEMENTS (ephy_bookmark_popup_entries);
static void
+entry_selection_changed_cb (GtkWidget *widget, GParamSpec *pspec, EphyBookmarksEditor *editor)
+{
+ ephy_bookmarks_editor_update_menu (editor);
+}
+
+static void
+add_entry_monitor (EphyBookmarksEditor *editor, GtkWidget *entry)
+{
+ g_signal_connect (G_OBJECT (entry),
+ "notify::selection-bound",
+ G_CALLBACK (entry_selection_changed_cb),
+ editor);
+ g_signal_connect (G_OBJECT (entry),
+ "notify::cursor-position",
+ G_CALLBACK (entry_selection_changed_cb),
+ editor);
+}
+
+static void
+add_text_renderer_monitor (EphyBookmarksEditor *editor)
+{
+ GtkWidget *entry;
+
+ entry = gtk_window_get_focus (GTK_WINDOW (editor));
+ g_return_if_fail (GTK_IS_EDITABLE (entry));
+
+ add_entry_monitor (editor, entry);
+}
+
+static void
cmd_add_topic (EggAction *action,
EphyBookmarksEditor *editor)
{
@@ -213,6 +244,7 @@ cmd_add_topic (EggAction *action,
_("Type a topic"));
ephy_node_view_select_node (EPHY_NODE_VIEW (editor->priv->key_view), node);
ephy_node_view_edit (EPHY_NODE_VIEW (editor->priv->key_view));
+ add_text_renderer_monitor (editor);
}
static void
@@ -234,6 +266,7 @@ cmd_rename (EggAction *action,
{
ephy_node_view_edit (EPHY_NODE_VIEW (editor->priv->key_view));
}
+ add_text_renderer_monitor (editor);
}
static GtkWidget *
@@ -937,12 +970,6 @@ search_entry_changed_cb (GtkWidget *entry, EphyBookmarksEditor *editor)
g_free (search_text);
}
-static void
-search_selection_changed_cb (GtkWidget *widget, GParamSpec *pspec, EphyBookmarksEditor *editor)
-{
- ephy_bookmarks_editor_update_menu (editor);
-}
-
static GtkWidget *
build_search_box (EphyBookmarksEditor *editor)
{
@@ -960,14 +987,7 @@ build_search_box (EphyBookmarksEditor *editor)
g_signal_connect (G_OBJECT (entry), "changed",
G_CALLBACK (search_entry_changed_cb),
editor);
- g_signal_connect (G_OBJECT (entry),
- "notify::selection-bound",
- G_CALLBACK (search_selection_changed_cb),
- editor);
- g_signal_connect (G_OBJECT (entry),
- "notify::cursor-position",
- G_CALLBACK (search_selection_changed_cb),
- editor);
+ add_entry_monitor (editor, entry);
label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
@@ -1139,7 +1159,7 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
EPHY_NODE_KEYWORD_PROP_NAME,
EPHY_NODE_KEYWORD_PROP_PRIORITY,
EPHY_NODE_VIEW_AUTO_SORT |
- EPHY_NODE_VIEW_EDITABLE);
+ EPHY_NODE_VIEW_EDITABLE, NULL);
gtk_container_add (GTK_CONTAINER (scrolled_window), key_view);
gtk_widget_set_size_request (key_view, 130, -1);
gtk_widget_show (key_view);
@@ -1186,16 +1206,15 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
/* Bookmarks View */
bm_view = ephy_node_view_new (node, editor->priv->bookmarks_filter);
add_focus_monitor (editor, bm_view);
- gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (bm_view), TRUE);
ephy_node_view_enable_drag_source (EPHY_NODE_VIEW (bm_view),
bmk_drag_types,
n_bmk_drag_types,
EPHY_NODE_BMK_PROP_LOCATION);
- ephy_node_view_add_icon_column (EPHY_NODE_VIEW (bm_view), provide_favicon);
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_EDITABLE,
+ provide_favicon);
gtk_container_add (GTK_CONTAINER (scrolled_window), bm_view);
gtk_widget_show (bm_view);
editor->priv->bm_view = bm_view;
@@ -1216,7 +1235,7 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
"changed",
G_CALLBACK (view_selection_changed_cb),
editor);
-
+
ephy_state_add_window (GTK_WIDGET(editor),
"bookmarks_editor",
450, 400);
@@ -1316,9 +1335,23 @@ ephy_bookmarks_editor_get_property (GObject *object,
}
static void
+toolbar_items_changed_cb (EphyToolbarsModel *model,
+ int toolbar_position,
+ int position,
+ EphyBookmarksEditor *editor)
+{
+ ephy_bookmarks_editor_update_menu (editor);
+}
+
+static void
ephy_bookmarks_editor_init (EphyBookmarksEditor *editor)
{
editor->priv = g_new0 (EphyBookmarksEditorPrivate, 1);
editor->priv->tb_model = ephy_shell_get_toolbars_model (ephy_shell);
+
+ g_signal_connect (editor->priv->tb_model, "item_added",
+ G_CALLBACK (toolbar_items_changed_cb), editor);
+ g_signal_connect (editor->priv->tb_model, "item_removed",
+ G_CALLBACK (toolbar_items_changed_cb), editor);
}
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index cb6fc9a27..3f4fd8540 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -872,12 +872,12 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
EPHY_NODE_PAGE_PROP_LOCATION);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (sites_view));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
- ephy_node_view_add_icon_column (EPHY_NODE_VIEW (sites_view), provide_favicon);
ephy_node_view_add_column (EPHY_NODE_VIEW (sites_view), _("Sites"),
G_TYPE_STRING,
EPHY_NODE_PAGE_PROP_TITLE,
EPHY_NODE_PAGE_PROP_PRIORITY,
- EPHY_NODE_VIEW_AUTO_SORT);
+ EPHY_NODE_VIEW_AUTO_SORT,
+ provide_favicon);
gtk_container_add (GTK_CONTAINER (scrolled_window), sites_view);
gtk_widget_show (sites_view);
editor->priv->sites_view = sites_view;
@@ -915,15 +915,12 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
EPHY_NODE_PAGE_PROP_LOCATION);
col = ephy_node_view_add_column (EPHY_NODE_VIEW (pages_view), _("Title"),
G_TYPE_STRING, EPHY_NODE_PAGE_PROP_TITLE,
- -1, EPHY_NODE_VIEW_USER_SORT);
+ -1, EPHY_NODE_VIEW_USER_SORT, NULL);
gtk_tree_view_column_set_max_width (col, 250);
col = ephy_node_view_add_column (EPHY_NODE_VIEW (pages_view), _("Location"),
G_TYPE_STRING, EPHY_NODE_PAGE_PROP_LOCATION,
- -1, EPHY_NODE_VIEW_USER_SORT);
+ -1, EPHY_NODE_VIEW_USER_SORT, NULL);
gtk_tree_view_column_set_max_width (col, 200);
-/* col = ephy_node_view_add_column (EPHY_NODE_VIEW (pages_view), _("Last Visit"),
- G_TYPE_STRING, EPHY_NODE_PAGE_PROP_LAST_VISIT,
- -1, EPHY_NODE_VIEW_USER_SORT);*/
gtk_container_add (GTK_CONTAINER (scrolled_window), pages_view);
gtk_widget_show (pages_view);
editor->priv->pages_view = pages_view;
diff --git a/src/ephy-toolbars-model.c b/src/ephy-toolbars-model.c
index f4fb3a0d2..43a081e22 100755
--- a/src/ephy-toolbars-model.c
+++ b/src/ephy-toolbars-model.c
@@ -78,7 +78,7 @@ impl_add_item (EggToolbarsModel *t,
EphyBookmarks *bookmarks;
char *action_name = NULL;
const char *res;
- gboolean topic = FALSE;
+ gboolean topic = FALSE, normal_item = FALSE;
int id = -1;
LOG ("Add item %s", name)
@@ -88,7 +88,7 @@ impl_add_item (EggToolbarsModel *t,
if (gdk_atom_intern (EPHY_DND_TOPIC_TYPE, FALSE) == type)
{
GList *nodes;
-
+
topic = TRUE;
nodes = ephy_dnd_node_list_extract_nodes (name);
id = ephy_node_get_id (EPHY_NODE (nodes->data));
@@ -99,16 +99,20 @@ impl_add_item (EggToolbarsModel *t,
{
GList *nodes;
- topic = FALSE;
nodes = ephy_dnd_node_list_extract_nodes (name);
id = ephy_node_get_id (EPHY_NODE (nodes->data));
action_name = g_strdup_printf ("GoBookmarkId%d", id);
g_list_free (nodes);
}
+ else
+ {
+ normal_item = TRUE;
+ }
res = action_name ? action_name : name;
- if (!ephy_toolbars_model_has_bookmark (EPHY_TOOLBARS_MODEL (t), topic, id))
+ if (normal_item ||
+ !ephy_toolbars_model_has_bookmark (EPHY_TOOLBARS_MODEL (t), topic, id))
{
EGG_TOOLBARS_MODEL_CLASS (parent_class)->add_item
(t, toolbar_position, position, type, res);