Set version number to 0.5.99.5

2001-03-05  Jon Trowbridge  <trow@gnu.org>

        * configure.in: Set version number to 0.5.99.5

        * gal/e-text/e-entry.c (e_entry_class_init): Add a "popup" signal.
        If you have trepidations about this, see the technical argument
        below.
        (e_entry_init): Connect to the EText's popup signal.
        (e_entry_proxy_popup): Proxy emitter for popup signals from the
        EText.

        * gal/e-text/e-text.c (e_text_class_init): Added a "popup" signal.
        (e_text_event): Emit the "popup" signal on right-clicks.  Now you
        could ask yourself: "should there be a signal named 'popup' in
        EText that gets emitted on right-clicks?"  And this is a
        reasonable question, since... well, this has a funny feeling to
        it.  But the whole point of GNOME, or at least one of the original
        points of GNOME, was to impose policy in a reasonable way when it
        made sense in order to simplify the user's experience.  Convention
        dictates that popup menus are tied to right-clicks --- so rather
        than setting up some elaborate forwarding of button-press signals,
        why not just impose a little policy and set up a signal that is
        closely tied to a familiar set of semantics?  Maybe it isn't the
        best thing to do from a aesthetics-of-the-API point of view, but I
        doubt anyone could condemn it as being anything more than mostly
        harmless.

svn path=/trunk/; revision=8565
This commit is contained in:
Jon Trowbridge
2001-03-06 00:13:23 +00:00
committed by Jon Trowbridge
parent 9b8456b4d1
commit 1bdc6e147f
5 changed files with 66 additions and 10 deletions

View File

@ -142,6 +142,12 @@ end_dict_search (ECompletion *complete, gpointer user_data)
}
}
static void
popup_cb (EEntry *popup, GdkEventButton *ev, gint pos, gpointer user_data)
{
g_print ("popup at pos %d\n", pos);
}
int
main (int argc, gchar **argv)
{
@ -172,6 +178,11 @@ main (int argc, gchar **argv)
e_entry_enable_completion_full (E_ENTRY (entry), complete, -1, NULL);
e_entry_set_editable (E_ENTRY (entry), TRUE);
gtk_signal_connect (GTK_OBJECT (entry),
"popup",
GTK_SIGNAL_FUNC (popup_cb),
NULL);
gtk_container_add (GTK_CONTAINER (win), entry);
gtk_widget_show_all (win);

View File

@ -58,6 +58,7 @@ static GtkObjectClass *parent_class;
enum {
E_ENTRY_CHANGED,
E_ENTRY_ACTIVATE,
E_ENTRY_POPUP,
E_ENTRY_LAST_SIGNAL
};
@ -100,6 +101,7 @@ struct _EEntryPrivate {
guint changed_proxy_tag;
guint activate_proxy_tag;
guint popup_proxy_tag;
/* Data related to completions */
ECompletion *completion;
@ -214,6 +216,12 @@ e_entry_proxy_activate (EText *text, EEntry *entry)
gtk_signal_emit (GTK_OBJECT (entry), e_entry_signals [E_ENTRY_ACTIVATE]);
}
static void
e_entry_proxy_popup (EText *text, GdkEventButton *ev, gint pos, EEntry *entry)
{
gtk_signal_emit (GTK_OBJECT (entry), e_entry_signals [E_ENTRY_POPUP], ev, pos);
}
static void
e_entry_init (GtkObject *object)
{
@ -272,6 +280,10 @@ e_entry_init (GtkObject *object)
"activate",
GTK_SIGNAL_FUNC (e_entry_proxy_activate),
entry);
entry->priv->popup_proxy_tag = gtk_signal_connect (GTK_OBJECT (entry->priv->item),
"popup",
GTK_SIGNAL_FUNC (e_entry_proxy_popup),
entry);
entry->priv->completion_delay = 1;
}
@ -1025,6 +1037,13 @@ e_entry_class_init (GtkObjectClass *object_class)
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
e_entry_signals[E_ENTRY_POPUP] = gtk_signal_new ("popup",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (EEntryClass, popup),
gtk_marshal_NONE__POINTER_INT,
GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT);
gtk_object_class_add_signals (object_class, e_entry_signals, E_ENTRY_LAST_SIGNAL);

View File

@ -58,8 +58,9 @@ struct _EEntry {
struct _EEntryClass {
GtkTableClass parent_class;
void (* changed) (EEntry *entry);
void (* changed) (EEntry *entry);
void (* activate) (EEntry *entry);
void (* popup) (EEntry *entry, GdkEventButton *ev, gint pos);
};
GtkType e_entry_get_type (void);

View File

@ -1,8 +1,9 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* EText - Text item for evolution.
* Copyright (C) 2000 Helix Code, Inc.
* Copyright (C) 2000, 2001 Ximian Inc.
*
* Author: Chris Lahey <clahey@umich.edu>
* Author: Chris Lahey <clahey@ximian.com>
* Further hacking by Jon Trowbridge <trow@ximian.com>
*
* A majority of code taken from:
*
@ -37,6 +38,7 @@
enum {
E_TEXT_CHANGED,
E_TEXT_ACTIVATE,
E_TEXT_POPUP,
E_TEXT_LAST_SIGNAL
};
@ -225,6 +227,14 @@ e_text_class_init (ETextClass *klass)
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
e_text_signals[E_TEXT_POPUP] =
gtk_signal_new ("popup",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (ETextClass, popup),
gtk_marshal_NONE__POINTER_INT,
GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT);
gtk_object_class_add_signals (object_class, e_text_signals, E_TEXT_LAST_SIGNAL);
@ -2993,6 +3003,17 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event)
e_canvas_item_grab_focus (item);
}
#endif
/* We follow convention and emit popup events on right-clicks. */
if (event->type == GDK_BUTTON_PRESS && event->button.button == 3) {
gtk_signal_emit (GTK_OBJECT (text),
e_text_signals[E_TEXT_POPUP],
&(event->button),
_get_position_from_xy (text, event->button.x, event->button.y));
break;
}
/* Create our own double and triple click events,
as gnome-canvas doesn't forward them to us */
if (event->type == GDK_BUTTON_PRESS) {
@ -3507,13 +3528,15 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text));
}
static void _invisible_destroy (GtkInvisible *invisible,
static void
_invisible_destroy (GtkInvisible *invisible,
EText *text)
{
text->invisible = NULL;
}
static GtkWidget *e_text_get_invisible(EText *text)
static GtkWidget *
e_text_get_invisible(EText *text)
{
GtkWidget *invisible;
if (text->invisible) {
@ -3607,7 +3630,8 @@ _selection_received (GtkInvisible *invisible,
}
}
static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length)
static void
e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length)
{
gboolean successful;
GtkWidget *invisible;

View File

@ -1,8 +1,9 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* EText - Text item for evolution.
* Copyright (C) 2000 Helix Code, Inc.
* Copyright (C) 2000, 2001 Ximian Inc.
*
* Author: Chris Lahey <clahey@umich.edu>
* Author: Chris Lahey <clahey@ximian.com>
* Further hacking by Jon Trowbridge <trow@ximian.com>
*
* A majority of code taken from:
*
@ -216,15 +217,15 @@ struct _EText {
struct _ETextClass {
GnomeCanvasItemClass parent_class;
void (* changed) (EText *text);
void (* changed) (EText *text);
void (* activate) (EText *text);
void (* popup) (EText *text, GdkEventButton *ev, gint pos);
};
/* Standard Gtk function */
GtkType e_text_get_type (void);
END_GNOME_DECLS
#endif