ekiga r6669 - in trunk: . lib/engine/gui/gtk-frontend
- From: dsandras svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r6669 - in trunk: . lib/engine/gui/gtk-frontend
- Date: Wed, 20 Aug 2008 21:12:15 +0000 (UTC)
Author: dsandras
Date: Wed Aug 20 21:12:15 2008
New Revision: 6669
URL: http://svn.gnome.org/viewvc/ekiga?rev=6669&view=rev
Log:
When closing the last tab, hide the window. Fixes bug reported by
Fabrice.
When pressing Escape, close the current tab. Hide the window if there
are no more tabs. (Bug #547715).
Modified:
trunk/ChangeLog
trunk/lib/engine/gui/gtk-frontend/chat-window.cpp
Modified: trunk/lib/engine/gui/gtk-frontend/chat-window.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/chat-window.cpp (original)
+++ trunk/lib/engine/gui/gtk-frontend/chat-window.cpp Wed Aug 20 21:12:15 2008
@@ -37,6 +37,8 @@
#include "config.h"
+#include <gdk/gdkkeysyms.h>
+
#include "chat-window.h"
#include "simple-chat-page.h"
#include "multiple-chat-page.h"
@@ -70,6 +72,9 @@
static void on_close_button_clicked (GtkButton* button,
gpointer data);
+static void on_escaped (GtkWidget *widget,
+ gpointer data);
+
static void on_switch_page (GtkNotebook* notebook,
GtkNotebookPage* page,
guint num,
@@ -132,10 +137,24 @@
page = (GtkWidget*)g_object_get_data (G_OBJECT (button), "page-widget");
num = gtk_notebook_page_num (GTK_NOTEBOOK (self->priv->notebook), page);
- if (num != -1) {
+ gtk_notebook_remove_page (GTK_NOTEBOOK (self->priv->notebook), num);
- gtk_notebook_remove_page (GTK_NOTEBOOK (self->priv->notebook), num);
- }
+ if (num == 0)
+ gtk_widget_hide (GTK_WIDGET (self));
+}
+
+static void
+on_escaped (GtkWidget */*widget*/,
+ gpointer data)
+{
+ ChatWindow* self = (ChatWindow*)data;
+ gint num = 0;
+
+ num = gtk_notebook_get_current_page (GTK_NOTEBOOK (self->priv->notebook));
+ gtk_notebook_remove_page (GTK_NOTEBOOK (self->priv->notebook), num);
+
+ if (num == 0)
+ gtk_widget_hide (GTK_WIDGET (self));
}
static void
@@ -433,10 +452,12 @@
const std::string key)
{
ChatWindow* result = NULL;
+ GtkAccelGroup *accel = NULL;
result = (ChatWindow*)g_object_new (CHAT_WINDOW_TYPE,
- "key", key.c_str (),
- NULL);
+ "key", key.c_str (),
+ "hide_on_esc", FALSE,
+ NULL);
result->priv = new ChatWindowPrivate (core);
@@ -444,6 +465,12 @@
gtk_container_add (GTK_CONTAINER (result), result->priv->notebook);
gtk_widget_show (result->priv->notebook);
+ accel = gtk_accel_group_new ();
+ gtk_window_add_accel_group (GTK_WINDOW (result), accel);
+ gtk_accel_group_connect (accel, GDK_Escape, (GdkModifierType) 0, GTK_ACCEL_LOCKED,
+ g_cclosure_new_swap (G_CALLBACK (on_escaped), (gpointer) result, NULL));
+ g_object_unref (accel);
+
g_signal_connect (result, "focus-in-event",
G_CALLBACK (on_focus_in_event), result);
g_signal_connect (result->priv->notebook, "switch-page",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]