diff options
Diffstat (limited to 'eel')
-rw-r--r-- | eel/eel-gtk-extensions.c | 97 | ||||
-rw-r--r-- | eel/eel-gtk-extensions.h | 3 |
2 files changed, 0 insertions, 100 deletions
diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c index 7c75ef51..1453d5ef 100644 --- a/eel/eel-gtk-extensions.c +++ b/eel/eel-gtk-extensions.c @@ -83,103 +83,6 @@ eel_gtk_window_get_geometry_string (GtkWindow *window) } static void -send_delete_event (GtkWindow *window) -{ - /* Synthesize delete_event to close window. */ - - GdkEvent event; - GtkWidget *widget; - - widget = GTK_WIDGET (window); - - event.any.type = GDK_DELETE; - event.any.window = gtk_widget_get_window (widget); - event.any.send_event = TRUE; - - g_object_ref (event.any.window); - gtk_main_do_event (&event); - g_object_unref (event.any.window); -} - -static int -handle_standard_close_accelerator (GtkWindow *window, - GdkEventKey *event, - gpointer user_data) -{ - g_assert (GTK_IS_WINDOW (window)); - g_assert (event != NULL); - g_assert (user_data == NULL); - - if (eel_gtk_window_event_is_close_accelerator (window, event)) - { - send_delete_event (window); - g_signal_stop_emission_by_name ( - G_OBJECT (window), "key_press_event"); - return TRUE; - } - - return FALSE; -} - -/** - * eel_gtk_window_event_is_close_accelerator: - * - * Tests whether a key event is a standard window close accelerator. - * Not needed for clients that use eel_gtk_window_set_up_close_accelerator; - * use only if you must set up your own key_event handler for your own reasons. - **/ -gboolean -eel_gtk_window_event_is_close_accelerator (GtkWindow *window, GdkEventKey *event) -{ - g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - if (event->state & GDK_CONTROL_MASK) - { - /* Note: menu item equivalents are case-sensitive, so we will - * be case-sensitive here too. - */ - if (event->keyval == EEL_STANDARD_CLOSE_WINDOW_CONTROL_KEY) - { - return TRUE; - } - } - - - return FALSE; -} - -/** - * eel_gtk_window_set_up_close_accelerator: - * - * Sets up the standard keyboard equivalent to close the window. - * Call this for windows that don't set up a keyboard equivalent to - * close the window some other way, e.g. via a menu item accelerator. - * - * NOTE: do not use for GtkDialog, it already sets up the right - * stuff here. - * - * @window: The GtkWindow that should be hidden when the standard - * keyboard equivalent is typed. - **/ -void -eel_gtk_window_set_up_close_accelerator (GtkWindow *window) -{ - g_return_if_fail (GTK_IS_WINDOW (window)); - - if (GTK_IS_DIALOG (window)) - { - g_warning ("eel_gtk_window_set_up_close_accelerator: Should not mess with close accelerator on GtkDialogs"); - return; - } - - g_signal_connect (window, - "key_press_event", - G_CALLBACK (handle_standard_close_accelerator), - NULL); -} - -static void sanity_check_window_position (int *left, int *top) { g_assert (left != NULL); diff --git a/eel/eel-gtk-extensions.h b/eel/eel-gtk-extensions.h index 1da3e8f4..abc1db90 100644 --- a/eel/eel-gtk-extensions.h +++ b/eel/eel-gtk-extensions.h @@ -71,9 +71,6 @@ void eel_gtk_window_set_initial_geometry_from_string (GtkWindow guint minimum_width, guint minimum_height, gboolean ignore_position); -void eel_gtk_window_set_up_close_accelerator (GtkWindow *window); -gboolean eel_gtk_window_event_is_close_accelerator (GtkWindow *window, - GdkEventKey *event); char * eel_gtk_window_get_geometry_string (GtkWindow *window); |