diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-05-21 04:52:47 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-05-21 04:52:47 +0800 |
commit | 3389ee02736c231e61877abd5d9663e57f27a276 (patch) | |
tree | fb09a5a53a779f673e7bcc1f9d98d3fea23370b0 /lib | |
parent | def97c979d02aed973fb1443d89ab81f1d570b7c (diff) | |
download | gsoc2013-epiphany-3389ee02736c231e61877abd5d9663e57f27a276.tar gsoc2013-epiphany-3389ee02736c231e61877abd5d9663e57f27a276.tar.gz gsoc2013-epiphany-3389ee02736c231e61877abd5d9663e57f27a276.tar.bz2 gsoc2013-epiphany-3389ee02736c231e61877abd5d9663e57f27a276.tar.lz gsoc2013-epiphany-3389ee02736c231e61877abd5d9663e57f27a276.tar.xz gsoc2013-epiphany-3389ee02736c231e61877abd5d9663e57f27a276.tar.zst gsoc2013-epiphany-3389ee02736c231e61877abd5d9663e57f27a276.zip |
Fix nodes drag and drop. Make double click select the whole address in
2003-05-20 Marco Pesenti Gritti <marco@it.gnome.org>
* lib/ephy-dnd.c: (ephy_dnd_drag_data_get),
(ephy_dnd_node_list_extract_nodes):
* lib/ephy-node-db.c: (ephy_node_db_set_name), (node_from_id_real),
(ephy_node_db_get_name):
* lib/ephy-node-db.h:
* lib/ephy-node.c: (ephy_node_get_db):
* lib/ephy-node.h:
* lib/widgets/ephy-location-entry.c:
(ephy_location_entry_button_press_event_cb),
(ephy_location_entry_build):
* lib/widgets/ephy-tree-model-sort.c: (each_node_get_data_binder):
Fix nodes drag and drop.
Make double click select the whole address in toolbar entry.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ephy-dnd.c | 13 | ||||
-rw-r--r-- | lib/ephy-node-db.c | 8 | ||||
-rw-r--r-- | lib/ephy-node-db.h | 2 | ||||
-rw-r--r-- | lib/ephy-node.c | 6 | ||||
-rw-r--r-- | lib/ephy-node.h | 2 | ||||
-rw-r--r-- | lib/widgets/ephy-location-entry.c | 14 | ||||
-rw-r--r-- | lib/widgets/ephy-tree-model-sort.c | 6 |
7 files changed, 43 insertions, 8 deletions
diff --git a/lib/ephy-dnd.c b/lib/ephy-dnd.c index 8c18bd754..9f10c5a3c 100644 --- a/lib/ephy-dnd.c +++ b/lib/ephy-dnd.c @@ -92,6 +92,7 @@ ephy_dnd_drag_data_get (GtkWidget *widget, { result = g_string_new (NULL); (* each_selected_item_iterator) (add_one_node, container_context, result); + g_string_erase (result, result->len - 1, -1); } else { @@ -110,21 +111,21 @@ ephy_dnd_drag_data_get (GtkWidget *widget, GList * ephy_dnd_node_list_extract_nodes (const char *node_list) { - EphyNodeDb *db; GList *result = NULL; char **nodes; int i; nodes = g_strsplit (node_list, ";", -1); - db = ephy_node_db_get_by_name (nodes[0]); - g_return_val_if_fail (db != NULL, NULL); - - for (i = 1; nodes[i] != NULL; i++) + for (i = 0; nodes[i] != NULL; i = i + 2) { gulong id; + EphyNodeDb *db; + + db = ephy_node_db_get_by_name (nodes[i]); + g_return_val_if_fail (db != NULL, NULL); - if (ephy_str_to_int (nodes[i], &id)) + if (ephy_str_to_int (nodes[i + 1], &id)) { EphyNode *node; diff --git a/lib/ephy-node-db.c b/lib/ephy-node-db.c index f77bac0bd..366b55365 100644 --- a/lib/ephy-node-db.c +++ b/lib/ephy-node-db.c @@ -82,7 +82,7 @@ ephy_node_db_set_name (EphyNodeDb *db, const char *name) if (ephy_node_databases == NULL) { ephy_node_databases = g_hash_table_new_full - (g_str_hash, g_str_equal, NULL, NULL); + (g_str_hash, g_str_equal, g_free, NULL); } g_hash_table_insert (ephy_node_databases, db->priv->name, db); @@ -228,6 +228,12 @@ node_from_id_real (EphyNodeDb *db, long id) return ret; } +const char * +ephy_node_db_get_name (EphyNodeDb *db) +{ + return db->priv->name; +} + EphyNode * ephy_node_db_get_node_from_id (EphyNodeDb *db, long id) { diff --git a/lib/ephy-node-db.h b/lib/ephy-node-db.h index 2b8c7637c..2b1f8fd7d 100644 --- a/lib/ephy-node-db.h +++ b/lib/ephy-node-db.h @@ -56,6 +56,8 @@ EphyNodeDb *ephy_node_db_get_by_name (const char *name); EphyNodeDb *ephy_node_db_new (const char *name); +const char *ephy_node_db_get_name (EphyNodeDb *db); + EphyNode *ephy_node_db_get_node_from_id (EphyNodeDb *db, long id); diff --git a/lib/ephy-node.c b/lib/ephy-node.c index f860d7467..d155aae78 100644 --- a/lib/ephy-node.c +++ b/lib/ephy-node.c @@ -345,6 +345,12 @@ ephy_node_new_with_id (EphyNodeDb *db, gulong reserved_id) return node; } +EphyNodeDb * +ephy_node_get_db (EphyNode *node) +{ + return node->db; +} + long ephy_node_get_id (EphyNode *node) { diff --git a/lib/ephy-node.h b/lib/ephy-node.h index 9fb3084a0..846d5fa41 100644 --- a/lib/ephy-node.h +++ b/lib/ephy-node.h @@ -47,6 +47,8 @@ EphyNode *ephy_node_new (EphyNodeDb *db); EphyNode *ephy_node_new_with_id (EphyNodeDb *db, gulong reserved_id); +EphyNodeDb *ephy_node_get_db (EphyNode *node); + /* unique node ID */ long ephy_node_get_id (EphyNode *node); diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c index 0db0694ee..a9884f3c3 100644 --- a/lib/widgets/ephy-location-entry.c +++ b/lib/widgets/ephy-location-entry.c @@ -194,6 +194,18 @@ ephy_location_entry_new (void) return GTK_WIDGET (g_object_new (EPHY_TYPE_LOCATION_ENTRY, NULL)); } +static gboolean +ephy_location_entry_button_press_event_cb (GtkWidget *entry, GdkEventButton *event, EphyLocationEntry *w) +{ + if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) + { + ephy_location_entry_activate (w); + return TRUE; + } + + return FALSE; +} + static void ephy_location_entry_build (EphyLocationEntry *w) { @@ -207,6 +219,8 @@ ephy_location_entry_build (EphyLocationEntry *w) g_signal_connect (p->entry, "key-press-event", G_CALLBACK (ephy_location_entry_key_press_event_cb), w); + g_signal_connect (p->entry, "button-press-event", + G_CALLBACK (ephy_location_entry_button_press_event_cb), w); g_signal_connect (p->entry, "activate", G_CALLBACK (ephy_location_entry_activate_cb), w); diff --git a/lib/widgets/ephy-tree-model-sort.c b/lib/widgets/ephy-tree-model-sort.c index 1d03effb8..b91946e8d 100644 --- a/lib/widgets/ephy-tree-model-sort.c +++ b/lib/widgets/ephy-tree-model-sort.c @@ -250,6 +250,7 @@ each_node_get_data_binder (EphyDragEachSelectedItemDataGet iteratee, GtkTreeIter iter; GtkTreePath *path = gtk_tree_row_reference_get_path (i->data); EphyNode *node = NULL; + EphyNodeDb *db; char *value; gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path); @@ -259,7 +260,10 @@ each_node_get_data_binder (EphyDragEachSelectedItemDataGet iteratee, if (node == NULL) return; - value = g_strdup_printf ("%ld", ephy_node_get_id (node)); + db = ephy_node_get_db (node); + value = g_strdup_printf ("%s;%ld", + ephy_node_db_get_name (db), + ephy_node_get_id (node)); iteratee (value, -1, -1, -1, -1, data); g_free (value); } |