aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-02-06 22:32:59 +0800
committerChristian Persch <chpe@src.gnome.org>2005-02-06 22:32:59 +0800
commit9de30c8784509df5ea9e80ed3eb093b3f5e35a95 (patch)
tree980e87e158fd2c48f1e438063e3f4577dce3ba41
parentdeecc2b60894f1bdd55f9818dd75845e4a6a956b (diff)
downloadgsoc2013-epiphany-9de30c8784509df5ea9e80ed3eb093b3f5e35a95.tar
gsoc2013-epiphany-9de30c8784509df5ea9e80ed3eb093b3f5e35a95.tar.gz
gsoc2013-epiphany-9de30c8784509df5ea9e80ed3eb093b3f5e35a95.tar.bz2
gsoc2013-epiphany-9de30c8784509df5ea9e80ed3eb093b3f5e35a95.tar.lz
gsoc2013-epiphany-9de30c8784509df5ea9e80ed3eb093b3f5e35a95.tar.xz
gsoc2013-epiphany-9de30c8784509df5ea9e80ed3eb093b3f5e35a95.tar.zst
gsoc2013-epiphany-9de30c8784509df5ea9e80ed3eb093b3f5e35a95.zip
Don't set the lock icon as drag source. Actually emit the lock-clicked
2005-02-06 Christian Persch <chpe@cvs.gnome.org> * lib/widgets/ephy-location-entry.c: (ephy_location_entry_class_init), (lock_button_press_event_cb), (ephy_location_entry_construct_contents): Don't set the lock icon as drag source. Actually emit the lock-clicked signal when pressed. * lib/widgets/ephy-location-entry.h: * src/ephy-location-action.c: (lock_clicked_cb), (connect_proxy), (ephy_location_action_class_init): * src/ephy-location-action.h: * src/ephy-toolbar.c: (lock_clicked_cb), (ephy_toolbar_set_window): Actually forward the lock-clicked signal to the toolbar.
-rw-r--r--lib/widgets/ephy-location-entry.c44
-rw-r--r--lib/widgets/ephy-location-entry.h1
-rw-r--r--src/ephy-location-action.c26
-rw-r--r--src/ephy-location-action.h3
-rwxr-xr-xsrc/ephy-toolbar.c9
5 files changed, 69 insertions, 14 deletions
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index b4df339db..b78612f72 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -102,21 +102,12 @@ static GObjectClass *parent_class = NULL;
enum signalsEnum
{
USER_CHANGED,
+ LOCK_CLICKED,
GET_LOCATION,
GET_TITLE,
LAST_SIGNAL
};
-static gint signals[LAST_SIGNAL];
-
-enum
-{
- LOCATION_HISTORY_NODE_ID = 1
-};
-
-enum
-{
- EPHY_NODE_LOC_HISTORY_PROP_TEXT = 1
-};
+static gint signals[LAST_SIGNAL] = { 0 };
#define MAX_LOC_HISTORY_ITEMS 10
#define EPHY_LOC_HISTORY_XML_ROOT "ephy_location_history"
@@ -197,6 +188,16 @@ ephy_location_entry_class_init (EphyLocationEntryClass *klass)
0,
G_TYPE_NONE);
+ signals[LOCK_CLICKED] = g_signal_new (
+ "lock-clicked",
+ EPHY_TYPE_LOCATION_ENTRY,
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyLocationEntryClass, lock_clicked),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
signals[GET_LOCATION] = g_signal_new (
"get-location", G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
@@ -475,6 +476,21 @@ favicon_drag_data_get_cb (GtkWidget *widget,
time, entry, each_url_get_data_binder);
}
+static gboolean
+lock_button_press_event_cb (GtkWidget *ebox,
+ GdkEventButton *event,
+ EphyLocationEntry *entry)
+{
+ if (event->type == GDK_BUTTON_PRESS && event->button == 1 /* left */)
+ {
+ g_signal_emit (entry, signals[LOCK_CLICKED], 0);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
modify_background (EphyLocationEntry *entry)
{
@@ -548,11 +564,9 @@ ephy_location_entry_construct_contents (EphyLocationEntry *entry)
priv->lock_ebox = gtk_event_box_new ();
gtk_container_set_border_width (GTK_CONTAINER (priv->lock_ebox), 2);
+ gtk_widget_add_events (priv->lock_ebox, GDK_BUTTON_PRESS_MASK);
gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->lock_ebox), FALSE);
gtk_box_pack_end (GTK_BOX (hbox), priv->lock_ebox, FALSE, FALSE, 2);
- gtk_drag_source_set (priv->lock_ebox, GDK_BUTTON1_MASK,
- url_drag_types, n_url_drag_types,
- GDK_ACTION_COPY);
//priv->lock = gtk_image_new ();
priv->lock = gtk_image_new_from_stock (GTK_STOCK_QUIT, GTK_ICON_SIZE_MENU);
@@ -578,6 +592,8 @@ ephy_location_entry_construct_contents (EphyLocationEntry *entry)
G_CALLBACK (entry_drag_motion_cb), entry);
g_signal_connect (priv->entry, "drag_drop",
G_CALLBACK (entry_drag_drop_cb), entry);
+ g_signal_connect (priv->lock_ebox, "button-press-event",
+ G_CALLBACK (lock_button_press_event_cb), entry);
}
static void
diff --git a/lib/widgets/ephy-location-entry.h b/lib/widgets/ephy-location-entry.h
index 5718a0b57..2c72590a8 100644
--- a/lib/widgets/ephy-location-entry.h
+++ b/lib/widgets/ephy-location-entry.h
@@ -48,6 +48,7 @@ struct _EphyLocationEntryClass
/* Signals */
void (*user_changed) (EphyLocationEntry *entry);
+ void (* lock_clicked) (EphyLocationEntry *entry);
/* for getting the drag data */
char * (* get_location) (EphyLocationEntry *entry);
char * (* get_title) (EphyLocationEntry *entry);
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c
index 402abb4cd..9043cac94 100644
--- a/src/ephy-location-action.c
+++ b/src/ephy-location-action.c
@@ -72,6 +72,13 @@ enum
PROP_WINDOW
};
+enum
+{
+ LOCK_CLICKED,
+ LAST_SIGNAL
+};
+static guint signals[LAST_SIGNAL] = { 0 };
+
static GObjectClass *parent_class = NULL;
GType
@@ -162,6 +169,13 @@ user_changed_cb (GtkWidget *proxy, EphyLocationAction *action)
}
static void
+lock_clicked_cb (GtkWidget *proxy,
+ EphyLocationAction *action)
+{
+ g_signal_emit (action, signals[LOCK_CLICKED], 0);
+}
+
+static void
sync_address (GtkAction *gaction,
GParamSpec *pspec,
GtkWidget *proxy)
@@ -362,6 +376,8 @@ connect_proxy (GtkAction *action, GtkWidget *proxy)
action, 0);
g_signal_connect_object (proxy, "user_changed",
G_CALLBACK (user_changed_cb), action, 0);
+ g_signal_connect_object (proxy, "lock-clicked",
+ G_CALLBACK (lock_clicked_cb), action, 0);
g_signal_connect_object (proxy, "get-location",
G_CALLBACK (get_location_cb), action, 0);
g_signal_connect_object (proxy, "get-title",
@@ -479,6 +495,16 @@ ephy_location_action_class_init (EphyLocationActionClass *class)
action_class->connect_proxy = connect_proxy;
action_class->disconnect_proxy = disconnect_proxy;
+ signals[LOCK_CLICKED] = g_signal_new (
+ "lock-clicked",
+ EPHY_TYPE_LOCATION_ACTION,
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyLocationActionClass, lock_clicked),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
g_object_class_install_property (object_class,
PROP_ADDRESS,
g_param_spec_string ("address",
diff --git a/src/ephy-location-action.h b/src/ephy-location-action.h
index 78053b27c..15ad6f123 100644
--- a/src/ephy-location-action.h
+++ b/src/ephy-location-action.h
@@ -47,6 +47,9 @@ struct _EphyLocationAction
struct _EphyLocationActionClass
{
EphyLinkActionClass parent_class;
+
+ /* Signals */
+ void (* lock_clicked) (EphyLocationAction *action);
};
GType ephy_location_action_get_type (void);
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index abb2cf8c6..41368a6c4 100755
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -253,6 +253,13 @@ sync_user_input_cb (EphyLocationAction *action,
}
static void
+lock_clicked_cb (EphyLocationAction *action,
+ EphyToolbar *toolbar)
+{
+ g_signal_emit (toolbar, signals[LOCK_CLICKED], 0);
+}
+
+static void
zoom_to_level_cb (GtkAction *action,
float zoom,
EphyToolbar *toolbar)
@@ -357,6 +364,8 @@ ephy_toolbar_set_window (EphyToolbar *toolbar,
G_CALLBACK (ephy_link_open), toolbar);
g_signal_connect (action, "notify::address",
G_CALLBACK (sync_user_input_cb), toolbar);
+ g_signal_connect (action, "lock-clicked",
+ G_CALLBACK (lock_clicked_cb), toolbar);
gtk_action_group_add_action (priv->action_group, action);
update_location_editable (toolbar);
g_object_unref (action);