ekiga r6828 - in trunk: . lib/engine/gui/gtk-frontend



Author: jschamp
Date: Fri Sep  5 03:50:01 2008
New Revision: 6828
URL: http://svn.gnome.org/viewvc/ekiga?rev=6828&view=rev

Log:
Finally fixes #549269 (chat message entry focus).

Modified:
   trunk/ChangeLog
   trunk/lib/engine/gui/gtk-frontend/chat-area.cpp
   trunk/lib/engine/gui/gtk-frontend/chat-window.cpp
   trunk/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp
   trunk/lib/engine/gui/gtk-frontend/multiple-chat-page.h
   trunk/lib/engine/gui/gtk-frontend/simple-chat-page.cpp
   trunk/lib/engine/gui/gtk-frontend/simple-chat-page.h

Modified: trunk/lib/engine/gui/gtk-frontend/chat-area.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/chat-area.cpp	(original)
+++ trunk/lib/engine/gui/gtk-frontend/chat-area.cpp	Fri Sep  5 03:50:01 2008
@@ -157,8 +157,12 @@
 
 static void on_chat_removed (ChatArea* self);
 
-static void on_chat_area_show (GtkWidget*,
-			       gpointer);
+static void on_chat_area_grab_focus (GtkWidget*,
+				     gpointer);
+
+static gboolean on_chat_area_focus (GtkWidget*,
+				    GtkDirectionType,
+				    gpointer);
 
 /* implementation of internal api */
 
@@ -556,14 +560,29 @@
   gtk_widget_hide (self->priv->message);
 }
 
-static void on_chat_area_show (GtkWidget* widget,
-                               G_GNUC_UNUSED gpointer data)
+static void
+on_chat_area_grab_focus (GtkWidget* widget,
+			 G_GNUC_UNUSED gpointer data)
+{
+  ChatArea* self = NULL;
+
+  self = (ChatArea*)widget;
+
+  gtk_widget_grab_focus (self->priv->message);
+}
+
+static gboolean
+on_chat_area_focus (GtkWidget* widget,
+		    G_GNUC_UNUSED GtkDirectionType direction,
+		    G_GNUC_UNUSED gpointer data)
 {
   ChatArea* self = NULL;
 
   self = (ChatArea*)widget;
 
   gtk_widget_grab_focus (self->priv->message);
+
+  return TRUE;
 }
 
 /* GObject code */
@@ -941,8 +960,10 @@
   gtk_widget_set_size_request (GTK_WIDGET (vbox), 175, -1);
   gtk_widget_show_all (vbox);
 
-  g_signal_connect (G_OBJECT (self), "show",
-		    G_CALLBACK (on_chat_area_show), NULL);
+  g_signal_connect (G_OBJECT (self), "focus",
+		    G_CALLBACK (on_chat_area_focus), NULL);
+  g_signal_connect (G_OBJECT (self), "grab-focus",
+		    G_CALLBACK (on_chat_area_grab_focus), self->priv->message);
   gtk_widget_grab_focus (self->priv->message);
 }
 

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	Fri Sep  5 03:50:01 2008
@@ -179,6 +179,8 @@
 		     GUINT_TO_POINTER (0));
 
   update_unread (self);
+
+  gtk_widget_grab_focus (page);
 }
 
 static gboolean
@@ -352,7 +354,6 @@
   gtk_window_present (GTK_WINDOW (self));
 }
 
-
 /* GObject code */
 
 static void

Modified: trunk/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp	(original)
+++ trunk/lib/engine/gui/gtk-frontend/multiple-chat-page.cpp	Fri Sep  5 03:50:01 2008
@@ -38,11 +38,34 @@
 #include "multiple-chat-page.h"
 #include "chat-area.h"
 
+struct _MultipleChatPagePrivate {
+  GtkWidget* area;
+};
+
 static GObjectClass *parent_class = NULL;
 
+static void on_page_grab_focus (GtkWidget*,
+				gpointer);
+
+static void on_page_grab_focus (GtkWidget* widget,
+				G_GNUC_UNUSED gpointer data)
+{
+  MultipleChatPage* self = NULL;
+
+  self = (MultipleChatPage*)widget;
+
+  if (self->priv->area)
+    gtk_widget_grab_focus (self->priv->area);
+}
+
 static void
 multiple_chat_page_dispose (GObject *obj)
 {
+  MultipleChatPage* self = NULL;
+
+  self = (MultipleChatPage*)obj;
+
+  self->priv->area = NULL;
 
   parent_class->dispose (obj);
 }
@@ -61,6 +84,12 @@
   MultipleChatPage* self = NULL;
 
   self = (MultipleChatPage*)instance;
+
+  self->priv = g_new (MultipleChatPagePrivate, 1);
+  self->priv->area = NULL;
+
+  g_signal_connect (G_OBJECT (self), "grab-focus",
+                    G_CALLBACK (on_page_grab_focus), NULL);
 }
 
 static void
@@ -112,6 +141,7 @@
   result = (MultipleChatPage*)g_object_new (TYPE_MULTIPLE_CHAT_PAGE, NULL);
 
   area = chat_area_new (chat);
+  result->priv->area = area;
   gtk_box_pack_start (GTK_BOX (result), area,
 		      TRUE,TRUE, 2);
   gtk_widget_show (area);

Modified: trunk/lib/engine/gui/gtk-frontend/multiple-chat-page.h
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/multiple-chat-page.h	(original)
+++ trunk/lib/engine/gui/gtk-frontend/multiple-chat-page.h	Fri Sep  5 03:50:01 2008
@@ -50,10 +50,13 @@
 /* GObject boilerplate */
 
 typedef struct _MultipleChatPage MultipleChatPage;
+typedef struct _MultipleChatPagePrivate MultipleChatPagePrivate;
 typedef struct _MultipleChatPageClass MultipleChatPageClass;
 
 struct _MultipleChatPage {
   GtkHBox parent;
+
+  MultipleChatPagePrivate* priv;
 };
 
 struct _MultipleChatPageClass {

Modified: trunk/lib/engine/gui/gtk-frontend/simple-chat-page.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/simple-chat-page.cpp	(original)
+++ trunk/lib/engine/gui/gtk-frontend/simple-chat-page.cpp	Fri Sep  5 03:50:01 2008
@@ -39,6 +39,10 @@
 #include "presentity-view.h"
 #include "chat-area.h"
 
+struct _SimpleChatPagePrivate {
+  GtkWidget* area;
+};
+
 enum {
   MESSAGE_NOTICE_EVENT,
   LAST_SIGNAL
@@ -48,6 +52,20 @@
 
 static GObjectClass *parent_class = NULL;
 
+static void on_page_grab_focus (GtkWidget*,
+				gpointer);
+
+static void on_page_grab_focus (GtkWidget* widget,
+                                G_GNUC_UNUSED gpointer data)
+{
+  SimpleChatPage* self = NULL;
+
+  self = (SimpleChatPage*)widget;
+
+  if (self->priv->area)
+    gtk_widget_grab_focus (self->priv->area);
+}
+
 static void
 on_message_notice_event (G_GNUC_UNUSED GtkWidget* widget,
 			 gpointer data)
@@ -58,6 +76,12 @@
 static void
 simple_chat_page_dispose (GObject *obj)
 {
+  SimpleChatPage* self = NULL;
+
+  self = (SimpleChatPage*)obj;
+
+  self->priv->area = NULL;
+
   parent_class->dispose (obj);
 }
 
@@ -75,6 +99,12 @@
   SimpleChatPage* self = NULL;
 
   self = (SimpleChatPage*)instance;
+
+  self->priv = g_new (SimpleChatPagePrivate, 1);
+  self->priv->area = NULL;
+
+  g_signal_connect (G_OBJECT (self), "grab-focus",
+		    G_CALLBACK (on_page_grab_focus), NULL);
 }
 
 static void
@@ -146,6 +176,7 @@
   gtk_widget_show (presentity_view);
 
   area = chat_area_new (chat);
+  result->priv->area = area;
   gtk_box_pack_start (GTK_BOX (result), area,
 		      TRUE, TRUE, 2);
   gtk_widget_show (area);

Modified: trunk/lib/engine/gui/gtk-frontend/simple-chat-page.h
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/simple-chat-page.h	(original)
+++ trunk/lib/engine/gui/gtk-frontend/simple-chat-page.h	Fri Sep  5 03:50:01 2008
@@ -50,10 +50,13 @@
 /* GObject boilerplate */
 
 typedef struct _SimpleChatPage SimpleChatPage;
+typedef struct _SimpleChatPagePrivate SimpleChatPagePrivate;
 typedef struct _SimpleChatPageClass SimpleChatPageClass;
 
 struct _SimpleChatPage {
   GtkVBox parent;
+
+  SimpleChatPagePrivate* priv;
 };
 
 struct _SimpleChatPageClass {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]