# HG changeset patch # User Christian Hammond # Date 1060211944 0 # Node ID c9894c0fbc6f9f37a7284421d48725d895204da2 # Parent b6d204635cd25c214068b9c60a3b4c143b67763f [gaim-migrate @ 6903] The "Escape closes window" pref is now back. When enabled, escape will close conversation windows. Otherwise, Control-W will close the window. committer: Tailor Script diff -r b6d204635cd2 -r c9894c0fbc6f src/gtkconv.c --- a/src/gtkconv.c Wed Aug 06 19:36:53 2003 +0000 +++ b/src/gtkconv.c Wed Aug 06 23:19:04 2003 +0000 @@ -1143,13 +1143,7 @@ win = gaim_conversation_get_window(conv); gtkwin = GAIM_GTK_WINDOW(win); - if (event->keyval == GDK_Escape) { - if (gaim_prefs_get_bool("/gaim/gtk/conversations/escape_closes")) { - g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); - gaim_conversation_destroy(conv); - } - } - else if (event->keyval == GDK_Page_Up) { + if (event->keyval == GDK_Page_Up) { g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); if (!(event->state & GDK_CONTROL_MASK)) @@ -1346,13 +1340,6 @@ g_string_free(conv->history, TRUE); conv->history = g_string_new(""); } - else if (event->keyval == 'w') { - g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); - - gaim_conversation_destroy(conv); - - return TRUE; - } else if (event->keyval == 'n') { g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); @@ -2844,9 +2831,9 @@ GtkAccelGroup *accel_group; gtkwin = GAIM_GTK_WINDOW(win); - accel_group = gtk_accel_group_new (); - gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); - g_object_unref (accel_group); + accel_group = gtk_accel_group_new (); + gtk_window_add_accel_group (GTK_WINDOW (gtkwin->window), accel_group); + g_object_unref (accel_group); gtkwin->menu.item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "
", accel_group); @@ -2923,6 +2910,9 @@ generate_send_as_items(win, NULL); +// if (gaim_prefs_get_bool("/gaim/gtk/conversations/escape_closes")) +// / + gtk_widget_show(gtkwin->menu.menubar); return gtkwin->menu.menubar; @@ -5535,8 +5525,20 @@ } static void +escape_closes_pref_cb(const char *name, GaimPrefType type, gpointer value, + gpointer data) +{ + if (value) + gtk_accel_map_change_entry(N_("
/Conversation/Close"), + GDK_Escape, 0, TRUE); + else + gtk_accel_map_change_entry(N_("
/Conversation/Close"), + GDK_W, GDK_CONTROL_MASK, TRUE); +} + +static void icons_on_tabs_pref_cb(const char *name, GaimPrefType type, gpointer value, - gpointer data) + gpointer data) { GList *l; GaimConversation *conv; @@ -5841,6 +5843,8 @@ gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); /* Connect callbacks. */ + gaim_prefs_connect_callback("/gaim/gtk/conversations/escape_closes", + escape_closes_pref_cb, NULL); gaim_prefs_connect_callback("/gaim/gtk/conversations/icons_on_tabs", icons_on_tabs_pref_cb, NULL); gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs",