aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-10-14 19:36:37 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-10-14 19:36:37 +0800
commit15dd9817a91d1c0b9a12f5dc5999d08c38c6d396 (patch)
treefd433dfc31a7336306628e4ceb200b6428b05460
parentee91f3c5d1faa4d0582d10778818827c7f62f5ec (diff)
downloadgsoc2013-epiphany-15dd9817a91d1c0b9a12f5dc5999d08c38c6d396.tar
gsoc2013-epiphany-15dd9817a91d1c0b9a12f5dc5999d08c38c6d396.tar.gz
gsoc2013-epiphany-15dd9817a91d1c0b9a12f5dc5999d08c38c6d396.tar.bz2
gsoc2013-epiphany-15dd9817a91d1c0b9a12f5dc5999d08c38c6d396.tar.lz
gsoc2013-epiphany-15dd9817a91d1c0b9a12f5dc5999d08c38c6d396.tar.xz
gsoc2013-epiphany-15dd9817a91d1c0b9a12f5dc5999d08c38c6d396.tar.zst
gsoc2013-epiphany-15dd9817a91d1c0b9a12f5dc5999d08c38c6d396.zip
Make location a normal entry.
2003-10-14 Marco Pesenti Gritti <marco@gnome.org> * lib/widgets/ephy-location-entry.c: (ephy_location_entry_class_init), (ephy_location_entry_construct_contents), (ephy_location_entry_init), (ephy_location_entry_activate): * lib/widgets/ephy-location-entry.h: * src/ephy-history-window.c: (confirmation_dialog_response_cb): * src/ephy-location-action.c: (remove_completion_actions), (add_completion_actions), (connect_proxy), (ephy_location_action_set_address): * src/ephy-location-action.h: * src/toolbar.c: * src/toolbar.h: Make location a normal entry.
-rw-r--r--ChangeLog17
-rw-r--r--lib/widgets/ephy-location-entry.c185
-rw-r--r--lib/widgets/ephy-location-entry.h4
-rw-r--r--src/ephy-history-window.c14
-rw-r--r--src/ephy-location-action.c25
-rw-r--r--src/ephy-location-action.h2
-rwxr-xr-xsrc/toolbar.c12
-rw-r--r--src/toolbar.h2
8 files changed, 23 insertions, 238 deletions
diff --git a/ChangeLog b/ChangeLog
index 53172e9fc..694b16e95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2003-10-14 Marco Pesenti Gritti <marco@gnome.org>
+
+ * lib/widgets/ephy-location-entry.c:
+ (ephy_location_entry_class_init),
+ (ephy_location_entry_construct_contents),
+ (ephy_location_entry_init), (ephy_location_entry_activate):
+ * lib/widgets/ephy-location-entry.h:
+ * src/ephy-history-window.c: (confirmation_dialog_response_cb):
+ * src/ephy-location-action.c: (remove_completion_actions),
+ (add_completion_actions), (connect_proxy),
+ (ephy_location_action_set_address):
+ * src/ephy-location-action.h:
+ * src/toolbar.c:
+ * src/toolbar.h:
+
+ Make location a normal entry.
+
2003-10-13 Marco Pesenti Gritti <marco@gnome.org>
* lib/widgets/ephy-location-entry.c:
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index e581a0c30..c935f9d04 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -24,11 +24,8 @@
#include "ephy-location-entry.h"
#include "ephy-marshal.h"
#include "ephy-debug.h"
-#include "ephy-file-helpers.h"
#include <gtk/gtktoolbar.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtkcomboboxentry.h>
#include <gtk/gtkentry.h>
#include <gtk/gtkwindow.h>
#include <gtk/gtkcellrenderertext.h>
@@ -40,15 +37,10 @@
struct _EphyLocationEntryPrivate
{
- EphyTreeModelNode *combo_model;
- GtkWidget *combo;
GtkWidget *entry;
char *before_completion;
gboolean user_changed;
gboolean activation_mode;
- EphyNodeDb *combo_db;
- EphyNode *combo_root;
- char *xml_file;
guint text_col;
guint action_col;
@@ -68,7 +60,6 @@ static int n_web_prefixes = G_N_ELEMENTS (web_prefixes);
static void ephy_location_entry_class_init (EphyLocationEntryClass *klass);
static void ephy_location_entry_init (EphyLocationEntry *le);
-static void ephy_location_entry_finalize (GObject *o);
static GObjectClass *parent_class = NULL;
@@ -144,8 +135,6 @@ ephy_location_entry_class_init (EphyLocationEntryClass *klass)
parent_class = g_type_class_peek_parent (klass);
- object_class->finalize = ephy_location_entry_finalize;
-
tool_item_class->set_tooltip = ephy_location_entry_set_tooltip;
EphyLocationEntrySignals[USER_CHANGED] = g_signal_new (
@@ -207,91 +196,6 @@ entry_button_press_cb (GtkWidget *entry, GdkEventButton *event, EphyLocationEntr
return FALSE;
}
-static void
-add_to_history (EphyLocationEntry *le, const char *text)
-{
- GPtrArray *children;
- int i, l, n_items, index = -1;
- int *order;
-
- /* check if it already exists */
- children = ephy_node_get_children (le->priv->combo_root);
- n_items = children->len;
- for (i = 0; i < n_items; i++)
- {
- EphyNode *kid;
- const char *node_text;
-
- kid = g_ptr_array_index (children, i);
- node_text = ephy_node_get_property_string
- (kid, EPHY_NODE_LOC_HISTORY_PROP_TEXT);
-
- if (strcmp (text, node_text) == 0)
- {
- index = i;
- break;
- }
- }
- ephy_node_thaw (le->priv->combo_root);
-
- /* it doesnt exist, add it */
- if (index < 0)
- {
- GValue value = { 0, };
- EphyNode *node;
-
- node = ephy_node_new (le->priv->combo_db);
- g_value_init (&value, G_TYPE_STRING);
- g_value_set_string (&value, text);
- ephy_node_set_property (node, EPHY_NODE_LOC_HISTORY_PROP_TEXT,
- &value);
-
- if (n_items >= MAX_LOC_HISTORY_ITEMS)
- {
- EphyNode *last;
-
- last = ephy_node_get_nth_child
- (le->priv->combo_root, n_items - 1);
- ephy_node_remove_child (le->priv->combo_root, last);
- }
-
- ephy_node_add_child (le->priv->combo_root, node);
- }
-
- /* move it at the top */
- n_items = ephy_node_get_n_children (le->priv->combo_root);
- order = g_new0 (int, n_items);
- l = 1;
- if (index == -1) index = n_items -1;
- for (i = 0; i < n_items; i++)
- {
- if (index != i)
- {
- order[i] = l;
- l++;
- }
- else
- {
- order[i] = 0;
- }
- }
- ephy_node_reorder_children (le->priv->combo_root, order);
- g_free (order);
-}
-
-static void
-entry_activate_cb (GtkEntry *entry, EphyLocationEntry *le)
-{
- char *content;
-
- content = gtk_editable_get_chars (GTK_EDITABLE(entry), 0, -1);
- if (content)
- {
- add_to_history (le, content);
- g_free (content);
- }
-}
-
static gboolean
completion_func (GtkEntryCompletion *completion,
const char *key,
@@ -376,26 +280,17 @@ static void
ephy_location_entry_construct_contents (EphyLocationEntry *le)
{
EphyLocationEntryPrivate *p = le->priv;
- int combo_text_col;
LOG ("EphyLocationEntry constructing contents %p", le)
- p->combo_model = ephy_tree_model_node_new (p->combo_root, NULL);
- combo_text_col = ephy_tree_model_node_add_prop_column
- (p->combo_model, G_TYPE_STRING, EPHY_NODE_LOC_HISTORY_PROP_TEXT);
-
- p->combo = gtk_combo_box_entry_new (GTK_TREE_MODEL (p->combo_model),
- combo_text_col);
- gtk_container_add (GTK_CONTAINER (le), p->combo);
- gtk_widget_show (p->combo);
- p->entry = GTK_BIN (p->combo)->child;
+ p->entry = gtk_entry_new ();
+ gtk_container_add (GTK_CONTAINER (le), p->entry);
+ gtk_widget_show (p->entry);
g_signal_connect (p->entry, "button_press_event",
G_CALLBACK (entry_button_press_cb), le);
g_signal_connect (p->entry, "changed",
G_CALLBACK (editable_changed_cb), le);
- g_signal_connect (p->entry, "activate",
- G_CALLBACK (entry_activate_cb), le);
}
static void
@@ -410,15 +305,6 @@ ephy_location_entry_init (EphyLocationEntry *le)
p->user_changed = TRUE;
p->activation_mode = FALSE;
- p->combo_db = ephy_node_db_new ("NodeDB");
- p->combo_root = ephy_node_new_with_id
- (p->combo_db, LOCATION_HISTORY_NODE_ID);
- p->xml_file = g_build_filename (ephy_dot_dir (),
- "ephy-location-history.xml",
- NULL);
- ephy_node_db_load_from_file (p->combo_db, p->xml_file,
- EPHY_LOC_HISTORY_XML_ROOT,
- EPHY_LOC_HISTORY_XML_VERSION);
ephy_location_entry_construct_contents (le);
@@ -429,51 +315,6 @@ ephy_location_entry_init (EphyLocationEntry *le)
G_CALLBACK (location_focus_out_cb), le);
}
-static void
-save_location_history (EphyLocationEntry *le)
-{
- xmlDocPtr doc;
- xmlNodePtr root;
- GPtrArray *children;
- int i;
-
- xmlIndentTreeOutput = TRUE;
-
- doc = xmlNewDoc ("1.0");
- root = xmlNewDocNode (doc, NULL, EPHY_LOC_HISTORY_XML_ROOT, NULL);
- xmlSetProp (root, "version", EPHY_LOC_HISTORY_XML_VERSION);
- xmlDocSetRootElement (doc, root);
-
- children = ephy_node_get_children (le->priv->combo_root);
- for (i = 0; i < children->len; i++)
- {
- EphyNode *kid;
-
- kid = g_ptr_array_index (children, i);
-
- ephy_node_save_to_xml (kid, root);
- }
- ephy_node_thaw (le->priv->combo_root);
-
- ephy_file_save_xml (le->priv->xml_file, doc);
- xmlFreeDoc(doc);
-}
-
-static void
-ephy_location_entry_finalize (GObject *o)
-{
- EphyLocationEntry *le;
-
- le = EPHY_LOCATION_ENTRY (o);
-
- save_location_history (le);
- g_free (le->priv->xml_file);
-
- LOG ("EphyLocationEntry finalized")
-
- G_OBJECT_CLASS (parent_class)->finalize (o);
-}
-
GtkWidget *
ephy_location_entry_new (void)
{
@@ -579,23 +420,3 @@ ephy_location_entry_activate (EphyLocationEntry *le)
gtk_window_set_focus (GTK_WINDOW(toplevel),
le->priv->entry);
}
-
-void
-ephy_location_entry_clear_history (EphyLocationEntry *le)
-{
- EphyNode *node;
-
- while ((node = ephy_node_get_nth_child (le->priv->combo_root, 0)) != NULL)
- {
- ephy_node_unref (node);
- }
-
- save_location_history (le);
-}
-
-GtkWidget *
-ephy_location_entry_get_entry (EphyLocationEntry *le)
-{
- return le->priv->entry;
-}
-
diff --git a/lib/widgets/ephy-location-entry.h b/lib/widgets/ephy-location-entry.h
index f516a1ad7..6445fad15 100644
--- a/lib/widgets/ephy-location-entry.h
+++ b/lib/widgets/ephy-location-entry.h
@@ -60,8 +60,6 @@ GType ephy_location_entry_get_type (void);
GtkWidget *ephy_location_entry_new (void);
-GtkWidget *ephy_location_entry_get_entry (EphyLocationEntry *le);
-
void ephy_location_entry_set_completion (EphyLocationEntry *le,
GtkTreeModel *model,
guint text_col,
@@ -76,6 +74,4 @@ const char *ephy_location_entry_get_location (EphyLocationEntry *le);
void ephy_location_entry_activate (EphyLocationEntry *le);
-void ephy_location_entry_clear_history (EphyLocationEntry *le);
-
#endif
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index 8db577231..22e1d3b68 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -223,25 +223,11 @@ static void
confirmation_dialog_response_cb (GtkDialog *dialog, gint response,
EphyHistoryWindow *editor)
{
- const GList *windows;
- Session *session;
-
gtk_widget_destroy (GTK_WIDGET (dialog));
if (response != GTK_RESPONSE_OK)
return;
- session = EPHY_SESSION (ephy_shell_get_session (ephy_shell));
- windows = session_get_windows (session);
-
- for (; windows != NULL; windows = windows->next)
- {
- Toolbar *t;
-
- t = ephy_window_get_toolbar (EPHY_WINDOW (windows->data));
- toolbar_clear_location_history (t);
- }
-
ephy_history_clear (editor->priv->history);
}
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c
index 0d90e8e24..73568195a 100644
--- a/src/ephy-location-action.c
+++ b/src/ephy-location-action.c
@@ -172,7 +172,7 @@ remove_completion_actions (GtkAction *action, GtkWidget *proxy)
EphyLocationAction *la = EPHY_LOCATION_ACTION (action);
GList *l;
- entry = ephy_location_entry_get_entry (EPHY_LOCATION_ENTRY (proxy));
+ entry = GTK_BIN (proxy)->child;
completion = gtk_entry_get_completion (GTK_ENTRY (entry));
for (l = la->priv->actions; l != NULL; l = l->next)
@@ -195,7 +195,7 @@ add_completion_actions (GtkAction *action, GtkWidget *proxy)
EphyLocationAction *la = EPHY_LOCATION_ACTION (action);
GList *l;
- entry = ephy_location_entry_get_entry (EPHY_LOCATION_ENTRY (proxy));
+ entry = GTK_BIN (proxy)->child;
completion = gtk_entry_get_completion (GTK_ENTRY (entry));
for (l = la->priv->actions; l != NULL; l = l->next)
@@ -238,7 +238,7 @@ connect_proxy (GtkAction *action, GtkWidget *proxy)
g_signal_connect_object (action, "notify::address",
G_CALLBACK (sync_address), proxy, 0);
- entry = ephy_location_entry_get_entry (EPHY_LOCATION_ENTRY (proxy));
+ entry = GTK_BIN (proxy)->child;
g_signal_connect_object (entry, "activate",
G_CALLBACK (location_url_activate_cb),
action, 0);
@@ -478,22 +478,3 @@ ephy_location_action_set_address (EphyLocationAction *action,
action->priv->address = g_strdup (address ? address : "");
g_object_notify (G_OBJECT (action), "address");
}
-
-static void
-clear_history (GtkWidget *proxy, gpointer user_data)
-{
- if (EPHY_IS_LOCATION_ENTRY (proxy))
- {
- ephy_location_entry_clear_history (EPHY_LOCATION_ENTRY (proxy));
- }
-}
-
-void
-ephy_location_action_clear_history (EphyLocationAction *action)
-{
- GSList *proxies;
-
- proxies = gtk_action_get_proxies (GTK_ACTION (action));
-
- g_slist_foreach (proxies, (GFunc) clear_history, NULL);
-}
diff --git a/src/ephy-location-action.h b/src/ephy-location-action.h
index 8058eb64f..74de3b175 100644
--- a/src/ephy-location-action.h
+++ b/src/ephy-location-action.h
@@ -57,8 +57,6 @@ const char *ephy_location_action_get_address (EphyLocationAction *action);
void ephy_location_action_set_address (EphyLocationAction *action,
const char *address);
-void ephy_location_action_clear_history (EphyLocationAction *action);
-
G_END_DECLS
#endif
diff --git a/src/toolbar.c b/src/toolbar.c
index a1b4553f1..025938e34 100755
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -644,18 +644,6 @@ toolbar_get_location (Toolbar *t)
}
void
-toolbar_clear_location_history (Toolbar *t)
-{
- GtkActionGroup *action_group;
- GtkAction *action;
-
- action_group = t->priv->action_group;
- action = gtk_action_group_get_action (action_group, "Location");
-
- ephy_location_action_clear_history (EPHY_LOCATION_ACTION (action));
-}
-
-void
toolbar_update_navigation_actions (Toolbar *t, gboolean back, gboolean forward, gboolean up)
{
GtkActionGroup *action_group;
diff --git a/src/toolbar.h b/src/toolbar.h
index f62021a20..6e4fecdf2 100644
--- a/src/toolbar.h
+++ b/src/toolbar.h
@@ -63,8 +63,6 @@ void toolbar_set_location (Toolbar *t,
void toolbar_activate_location (Toolbar *t);
-void toolbar_clear_location_history (Toolbar *t);
-
void toolbar_update_favicon (Toolbar *t);
void toolbar_update_navigation_actions (Toolbar *t,