Mercurial > pidgin
changeset 17794:8428beecff2f
Close smiley dialog on GDK_Escape or button 1 press.
author | Gabriel Schulhof <nix@go-nix.ca> |
---|---|
date | Sat, 26 May 2007 10:03:55 +0000 |
parents | 8c056932bcc2 |
children | 614cba328241 |
files | pidgin/gtkimhtmltoolbar.c |
diffstat | 1 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkimhtmltoolbar.c Fri May 25 20:06:37 2007 +0000 +++ b/pidgin/gtkimhtmltoolbar.c Sat May 26 10:03:55 2007 +0000 @@ -37,6 +37,8 @@ #include "gtkthemes.h" #include "gtkutils.h" +#include <gdk/gdkkeysyms.h> + static GtkHBoxClass *parent_class = NULL; static void toggle_button_set_active_block(GtkToggleButton *button, @@ -625,7 +627,6 @@ return ls; } - static gboolean smiley_is_unique(GSList *list, GtkIMHtmlSmiley *smiley) { @@ -638,6 +639,18 @@ return TRUE; } +static gboolean +smiley_dialog_input_cb(GtkWidget *dialog, GdkEvent *event, GtkIMHtmlToolbar *toolbar) +{ + gboolean close_dialog = + (GDK_EVENT_KEY == event->type) ? (GDK_Escape == event->key.keval) : + (GDK_EVENT_BUTTON == event->type) ? (1 == event->button.button) : FALSE; + + if (close_dialog) + close_smiley_dialog(NULL, NULL, toolbar); + + return close_dialog; +} static void insert_smiley_cb(GtkWidget *smiley, GtkIMHtmlToolbar *toolbar) @@ -721,6 +734,9 @@ smiley_table = gtk_label_new(_("This theme has no available smileys.")); } + gtk_widget_add_events (dialog, GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK) ; + g_signal_connect (G_OBJECT (dialog), "key-press-event", (GCallback)smiley_dialog_input_cb, toolbar) ; + g_signal_connect (G_OBJECT (dialog), "button-press-event", (GCallback)smiley_dialog_input_cb, toolbar) ; gtk_container_add(GTK_CONTAINER(dialog), smiley_table); gtk_widget_show(smiley_table);