Re: [GnomeMeeting-devel-list] [PATCH] private (and object-like) text chat



On mar, 2004-04-06 at 15:32, Damien Sandras wrote:
> The GetTextChat function returned a structure and was thus needed. Now
> that we are moving to a GtkWidget object type, it has to be removed as
> we have back a normal GtkWidget part of the GmWindow. I never liked the
> fact that there was a public structure for something as simple as the
> text chat, but I am not the author of the text chat code...

Done.

> That kind of comment is non-sense, please remove it.

Done.

> Yes, then I'm 100% right as it is what I meant ;-)

Ok, done.

> > > 4) Please don't forget to add forward declarations in C code at the top
> > > of the file.

Done.

New version attached.

Snark
diff -ur gnomemeeting-cvs-20040405.CVS/src/chat_window.cpp gnomemeeting-cvs-20040405.CVS.patched/src/chat_window.cpp
--- gnomemeeting-cvs-20040405.CVS/src/chat_window.cpp	2004-04-06 15:18:24.000000000 +0200
+++ gnomemeeting-cvs-20040405.CVS.patched/src/chat_window.cpp	2004-04-06 17:14:58.000000000 +0200
@@ -43,18 +43,49 @@
 #include "chat_window.h"
 #include "ldap_window.h"
 #include "gnomemeeting.h"
-#include "ldap_window.h"
 #include "callbacks.h"
 #include "misc.h"
-#include "callbacks.h"
 
 #include "gtk-text-tag-addon.h"
 #include "gtk-text-buffer-addon.h"
 #include "gtk-text-view-addon.h"
 #include "gtk_menu_extensions.h"
 
-extern GtkWidget *gm;
+/* internal structure used by the text chat */
+typedef struct _GmTextChat
+{
+  GtkWidget     *text_view;
+  GtkTextBuffer *text_buffer;
+  gboolean	something_typed;
+  gchar		*begin_msg;
+} GmTextChat;
+
+/* declaration of the static functions */
+static void gm_text_chat_destroy (gpointer chat_pointer);
+static void open_uri_callback (const gchar *uri);
+static void copy_uri_callback (const gchar *uri);
+static void connect_uri_callback (const gchar *uri);
+static void add_uri_callback (const gchar *uri);
+static void chat_entry_activate (GtkEditable *w, gpointer data);
+
+
+/* DESCRIPTION  :  Called when the chat window is destroyed
+ * BEHAVIOR     :  Frees the GmTextChat* that is embedded in the window
+ * PRE          :  /
+ */
+static void
+gm_text_chat_destroy (gpointer chat_pointer)
+{
+  GmTextChat *chat = (GmTextChat *)chat_pointer;
 
+  g_return_if_fail (chat != NULL);
+  
+  if (chat->begin_msg != NULL) {
+     g_free (chat->begin_msg);
+     chat->begin_msg = NULL;
+  }
+  delete chat;
+}
 
 #ifndef DISABLE_GNOME
 /* DESCRIPTION  :  Called when an URL is clicked.
@@ -64,8 +95,9 @@
 static void
 open_uri_callback (const gchar *uri)
 {
-  if (uri)
-    gnome_url_show (uri, NULL);
+  g_return_if_fail (uri != NULL);
+  
+  gnome_url_show (uri, NULL);
 }
 #endif
 
@@ -77,12 +109,12 @@
 static void
 copy_uri_callback (const gchar *uri)
 {
-  if (uri) {
-    gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_PRIMARY),
-			    uri, -1);
-    gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD),
-			    uri, -1);
-  }
+  g_return_if_fail (uri != NULL);
+
+  gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_PRIMARY),
+			  uri, -1);
+  gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD),
+			  uri, -1);
 }
 
 
@@ -96,23 +128,16 @@
   GMH323EndPoint *ep = NULL;
   GmWindow *gw = NULL;
   
-  ep = GnomeMeeting::Process ()->Endpoint ();
-  gw = GnomeMeeting::Process ()->GetMainWindow ();
-    
-  if (uri) {
-
-    if (ep->GetCallingState () == GMH323EndPoint::Standby) {
+  g_return_if_fail (uri != NULL);
 
-      gw = GnomeMeeting::Process ()->GetMainWindow ();
-      gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (gw->combo)->entry),
-			  uri);
-      
-      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gw->connect_button),
-				    true);
-    }
-    else if (ep->GetCallingState () == GMH323EndPoint::Connected)
-      transfer_call_cb (NULL, (gpointer) uri);
+  if (ep->GetCallingState () == GMH323EndPoint::Standby) {    
+    gw = GnomeMeeting::Process ()->GetMainWindow ();
+    gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (gw->combo)->entry), uri);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gw->connect_button),
+				  true);
   }
+  else if (ep->GetCallingState () == GMH323EndPoint::Connected)
+    transfer_call_cb (NULL, (gpointer) uri);
 }
 
 
@@ -123,8 +148,9 @@
 static void
 add_uri_callback (const gchar *uri)
 {
-  if (uri)
-    gnomemeeting_addressbook_edit_contact_dialog ((gchar *) uri);
+  g_return_if_fail (uri != NULL);
+
+  gnomemeeting_addressbook_edit_contact_dialog ((gchar *) uri);
 }  
 
 
@@ -137,6 +163,7 @@
 		     gpointer data)
 {
   GMH323EndPoint *endpoint = GnomeMeeting::Process ()->Endpoint ();
+  GtkWidget *chat_window = GnomeMeeting::Process ()->GetMainWindow ()->chat_window;
   PString s;
     
   if (endpoint) {
@@ -168,7 +195,7 @@
 	  utf8_local = gnomemeeting_from_iso88591_to_utf8 (local);
 
 	if (utf8_local)
-	  gnomemeeting_text_chat_insert (utf8_local, s, 0);
+	  gnomemeeting_text_chat_insert (chat_window, utf8_local, s, 0);
 	g_free (utf8_local);
                 
 	gtk_entry_set_text (GTK_ENTRY (w), "");
@@ -179,30 +206,30 @@
   }
 }
 
-void gnomemeeting_text_chat_clear (GtkWidget *w,
-				   GmTextChat *chat)
+void gnomemeeting_text_chat_clear (GtkWidget *chat_window)
 {
   GmWindow *gw = NULL;
+  GmTextChat *chat = NULL;
   GtkTextIter start_iter, end_iter;
 
-  gw = GnomeMeeting::Process ()->GetMainWindow ();
+  g_return_if_fail (chat_window != NULL);
   
+  chat = (GmTextChat *)g_object_get_data (G_OBJECT (chat_window), "GMObject");
   gtk_text_buffer_get_start_iter (chat->text_buffer, &start_iter);
   gtk_text_buffer_get_end_iter (chat->text_buffer, &end_iter);
 
   gtk_text_buffer_delete (chat->text_buffer, &start_iter, &end_iter);
 
+  gw = GnomeMeeting::Process ()->GetMainWindow ();
   gtk_menu_set_sensitive (gw->main_menu, "clear_text_chat", FALSE);
 }
 
 void
-gnomemeeting_text_chat_call_start_notification (void)
+gnomemeeting_text_chat_call_start_notification (GtkWidget *chat_window)
 {
   GmTextChat *chat = NULL;
-  GmWindow *gw = NULL;
 
-  gw = GnomeMeeting::Process ()->GetMainWindow ();
-  chat = GnomeMeeting::Process ()->GetTextChat ();
+  g_return_if_fail (chat_window != NULL);
 	
   // find the time at which the event occured
   time_t *timeptr;
@@ -215,6 +242,7 @@
   strftime(time_str, 20, "%H:%M:%S", localtime (timeptr));
 
   // prepare the message
+  chat = (GmTextChat *)g_object_get_data (G_OBJECT (chat_window), "GMObject");
   if (chat->begin_msg) g_free (chat->begin_msg); // shouldn't happen...
   chat->begin_msg = g_strdup_printf ("---- Call begins at %s\n", time_str);
 
@@ -226,13 +254,14 @@
 }
 
 void
-gnomemeeting_text_chat_call_stop_notification (void)
+gnomemeeting_text_chat_call_stop_notification (GtkWidget *chat_window)
 {
   GtkTextIter iter;
   GmTextChat *chat = NULL;
-  GmWindow *gw = NULL;
   gchar *text = NULL;
 
+  g_return_if_fail (chat_window != NULL);
+
   // find the time at which the event occured	
   time_t *timeptr;
   char *time_str;
@@ -247,8 +276,7 @@
   text = g_strdup_printf ("---- Call ends at %s\n", time_str);
 
   // displays the message
-  gw = GnomeMeeting::Process ()->GetMainWindow ();
-  chat = GnomeMeeting::Process ()->GetTextChat ();
+  chat = (GmTextChat *)g_object_get_data (G_OBJECT (chat_window), "GMObject");
   gtk_text_buffer_get_end_iter (chat->text_buffer, &iter);
 
   if (chat->something_typed == TRUE)
@@ -260,20 +288,18 @@
 }
 
 void 
-gnomemeeting_text_chat_insert (PString local,
-			       PString str,
-			       int user)
+gnomemeeting_text_chat_insert (GtkWidget *chat_window, PString name,
+			       PString str, int user)
 {
   gchar *msg = NULL;
   GtkTextIter iter;
   GtkTextMark *mark;
-  
   GmTextChat *chat = NULL;
   GmWindow *gw = NULL;
 
-  gw = GnomeMeeting::Process ()->GetMainWindow ();
-  chat = GnomeMeeting::Process ()->GetTextChat ();
+  g_return_if_fail (chat_window != NULL);
 
+  chat = (GmTextChat *)g_object_get_data (G_OBJECT (chat_window), "GMObject");
   gtk_text_buffer_get_end_iter (chat->text_buffer, &iter);
 
   // delayed call begin notification first!
@@ -286,7 +312,7 @@
     }
   }
 
-  msg = g_strdup_printf ("%s: ", (const char *) local);
+  msg = g_strdup_printf ("%s: ", (const char *) name);
 
   if (user == 1)
     gtk_text_buffer_insert_with_tags_by_name (chat->text_buffer, &iter, msg, 
@@ -307,12 +333,13 @@
   gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (chat->text_view), mark, 
 				0.0, FALSE, 0,0);
 
+  gw = GnomeMeeting::Process ()->GetMainWindow ();
   gtk_menu_set_sensitive (gw->main_menu, "clear_text_chat", TRUE);
 }
 
 
 GtkWidget *
-gnomemeeting_text_chat_new (GmTextChat *chat)
+gnomemeeting_text_chat_new ()
 {
   GtkWidget *entry = NULL;
   GtkWidget *scr = NULL;
@@ -321,14 +348,19 @@
   GtkWidget *frame = NULL;
   GtkWidget *hbox = NULL;
   GtkWidget *chat_window = NULL;
-
-  GtkTextIter  iter;
+  GmTextChat *chat = NULL;
+  GtkTextIter iter;
   GtkTextMark *mark = NULL;
   GtkTextTag *regex_tag = NULL;
 
 
   /* Get the structs from the application */
+  chat = new GmTextChat ();
   chat_window = gtk_frame_new (NULL);
+  g_object_set_data_full (G_OBJECT (chat_window), "GMObject",
+                          (gpointer) chat,
+			  (GDestroyNotify) (gm_text_chat_destroy));
+
   gtk_frame_set_shadow_type (GTK_FRAME (chat_window), GTK_SHADOW_NONE);
   table = gtk_table_new (1, 3, FALSE);
   
diff -ur gnomemeeting-cvs-20040405.CVS/src/chat_window.h gnomemeeting-cvs-20040405.CVS.patched/src/chat_window.h
--- gnomemeeting-cvs-20040405.CVS/src/chat_window.h	2004-01-20 12:00:38.000000000 +0100
+++ gnomemeeting-cvs-20040405.CVS.patched/src/chat_window.h	2004-04-06 15:18:58.000000000 +0200
@@ -43,47 +43,41 @@
 
 #include "common.h"
 
-
 G_BEGIN_DECLS
 
-
 /* DESCRIPTION  :  /
  * BEHAVIOR     :  Initializes the text chat view.
  * PRE          :  /
  */
 GtkWidget *
-gnomemeeting_text_chat_new (GmTextChat *);
+gnomemeeting_text_chat_new ();
 
 
 /* DESCRIPTION  :  /
  * BEHAVIOR     :  Clears the text chat view.
- * PRE          :  The first parameter is fictive so that the function
- *                 can be used in a callback.
+ * PRE          :  /
  */
 void
-gnomemeeting_text_chat_clear (GtkWidget *,
-			      GmTextChat *);
+gnomemeeting_text_chat_clear (GtkWidget *);
 
 
 /* DESCRIPTION: /
  * BEHAVIOR :  Signals the text chat that a connection begins or ends
  */
 void
-gnomemeeting_text_chat_call_start_notification (void);
+gnomemeeting_text_chat_call_start_notification (GtkWidget *);
 void
-gnomemeeting_text_chat_call_stop_notification (void);
+gnomemeeting_text_chat_call_stop_notification (GtkWidget *);
 
 /* DESCRIPTION  :  /
  * BEHAVIOR     :  Displays the colored text chat message,
- *		with some enhancements (context menu
- *		for uris, graphics for smileys, etc)
- * PRE          :  The name of the user, the name of the remote user,
+ *		   with some enhancements (context menu
+ *		   for uris, graphics for smileys, etc)
+ * PRE          :  The name of the (local or remote) user, the message and
  *                 0 for local user string, 1 for remote user received string.
  */
 void
-gnomemeeting_text_chat_insert (PString,
-			       PString,
-			       int);
+gnomemeeting_text_chat_insert (GtkWidget *, PString, PString, int);
 
 G_END_DECLS
 
diff -ur gnomemeeting-cvs-20040405.CVS/src/common.h gnomemeeting-cvs-20040405.CVS.patched/src/common.h
--- gnomemeeting-cvs-20040405.CVS/src/common.h	2004-04-06 15:18:24.000000000 +0200
+++ gnomemeeting-cvs-20040405.CVS.patched/src/common.h	2004-04-06 15:18:58.000000000 +0200
@@ -114,7 +114,6 @@
 typedef struct _GmPrefWindow GmPrefWindow;
 typedef struct _GmLdapWindow GmLdapWindow;
 typedef struct _GmLdapWindowPage GmLdapWindowPage;
-typedef struct _GmTextChat GmTextChat;
 typedef struct _GmDruidWindow GmDruidWindow;
 typedef struct _GmCallsHistoryWindow GmCallsHistoryWindow;
 typedef struct _GmRtpData GmRtpData;
@@ -149,16 +148,6 @@
   NUM_SECTIONS
 } ControlPanelSection;
 
-
-struct _GmTextChat
-{
-  GtkWidget     *text_view;
-  GtkTextBuffer *text_buffer;
-  gboolean	something_typed;
-  gchar		*begin_msg;
-};
-
-
 struct _GmRtpData
 {
   int   tr_audio_bytes;
diff -ur gnomemeeting-cvs-20040405.CVS/src/config.cpp gnomemeeting-cvs-20040405.CVS.patched/src/config.cpp
--- gnomemeeting-cvs-20040405.CVS/src/config.cpp	2004-04-06 15:18:24.000000000 +0200
+++ gnomemeeting-cvs-20040405.CVS.patched/src/config.cpp	2004-04-06 15:18:58.000000000 +0200
@@ -1625,8 +1625,8 @@
 			view_widget_changed_nt, gw->statusbar);
 
   gm_conf_notifier_add (USER_INTERFACE_KEY "main_window/show_chat_window",
-			menu_toggle_changed_nt,
-			gtk_menu_get_widget (gw->main_menu, "text_chat"));
+			menu_toggle_changed_nt, gtk_menu_get_widget (gw->main_menu, "text_chat"));
+
   gm_conf_notifier_add (USER_INTERFACE_KEY "main_window/show_chat_window",
 			view_widget_changed_nt, gw->chat_window);
 
diff -ur gnomemeeting-cvs-20040405.CVS/src/connection.cpp gnomemeeting-cvs-20040405.CVS.patched/src/connection.cpp
--- gnomemeeting-cvs-20040405.CVS/src/connection.cpp	2004-04-06 15:18:24.000000000 +0200
+++ gnomemeeting-cvs-20040405.CVS.patched/src/connection.cpp	2004-04-06 15:18:58.000000000 +0200
@@ -271,7 +271,7 @@
 
   gnomemeeting_threads_enter ();
   if (utf8_remote && strcmp (utf8_remote, "")) 
-    gnomemeeting_text_chat_insert (utf8_remote, val, 1);
+    gnomemeeting_text_chat_insert (gw->chat_window, utf8_remote, val, 1);
   
   if (!GTK_WIDGET_VISIBLE (gw->chat_window))
     gm_conf_set_bool (USER_INTERFACE_KEY "main_window/show_chat_window", true);
diff -ur gnomemeeting-cvs-20040405.CVS/src/endpoint.cpp gnomemeeting-cvs-20040405.CVS.patched/src/endpoint.cpp
--- gnomemeeting-cvs-20040405.CVS/src/endpoint.cpp	2004-04-06 15:18:24.000000000 +0200
+++ gnomemeeting-cvs-20040405.CVS.patched/src/endpoint.cpp	2004-04-06 17:21:06.000000000 +0200
@@ -82,7 +82,6 @@
   /* Get the GTK structures */
   gw = GnomeMeeting::Process ()->GetMainWindow ();
   lw = GnomeMeeting::Process ()->GetLdapWindow ();
-  chat = GnomeMeeting::Process ()->GetTextChat ();
   
   /* Initialise the endpoint paramaters */
   video_grabber = NULL;
@@ -947,7 +946,6 @@
   BOOL reg = FALSE;
   BOOL forward_on_busy = FALSE;
   IncomingCallMode icm = AVAILABLE;
-
   
 #ifdef HAS_IXJ
   GMLid *l = NULL;
@@ -978,7 +976,7 @@
   gnomemeeting_statusbar_push (gw->statusbar, _("Connected"));
   gnomemeeting_log_insert (_("Connected with %s using %s"), 
 			 utf8_name, utf8_app);
-  gnomemeeting_text_chat_call_start_notification ();
+  gnomemeeting_text_chat_call_start_notification (GnomeMeeting::Process ()->GetMainWindow ()->chat_window);
 
   gtk_label_set_text (GTK_LABEL (gw->remote_name), (const char *) utf8_name);
   gtk_window_set_title (GTK_WINDOW (gw->remote_video_window), 
@@ -1270,7 +1268,7 @@
 
 
   gnomemeeting_log_insert (msg_reason);
-  gnomemeeting_text_chat_call_stop_notification ();
+  gnomemeeting_text_chat_call_stop_notification (GnomeMeeting::Process ()->GetMainWindow ()->chat_window);
   gnomemeeting_statusbar_flash (gw->statusbar, msg_reason);
   gnomemeeting_threads_leave ();
 
@@ -1338,7 +1336,7 @@
   
   /* We empty the text chat buffer */
   if (auto_clear_text_chat)
-    gnomemeeting_text_chat_clear (NULL, chat);
+    gnomemeeting_text_chat_clear (GnomeMeeting::Process ()->GetMainWindow ()->chat_window);
 
 
   /* set-on-top to False */
diff -ur gnomemeeting-cvs-20040405.CVS/src/endpoint.h gnomemeeting-cvs-20040405.CVS.patched/src/endpoint.h
--- gnomemeeting-cvs-20040405.CVS/src/endpoint.h	2004-03-27 20:03:13.000000000 +0100
+++ gnomemeeting-cvs-20040405.CVS.patched/src/endpoint.h	2004-04-06 17:19:32.000000000 +0200
@@ -627,7 +627,6 @@
 
   GmWindow *gw; 
   GmLdapWindow *lw;
-  GmTextChat *chat;
 
 
   /* The encoding video grabber */
diff -ur gnomemeeting-cvs-20040405.CVS/src/gnomemeeting.cpp gnomemeeting-cvs-20040405.CVS.patched/src/gnomemeeting.cpp
--- gnomemeeting-cvs-20040405.CVS/src/gnomemeeting.cpp	2004-04-06 15:18:24.000000000 +0200
+++ gnomemeeting-cvs-20040405.CVS.patched/src/gnomemeeting.cpp	2004-04-06 16:03:30.000000000 +0200
@@ -108,7 +108,6 @@
   pw = new GmPrefWindow ();
   lw = new GmLdapWindow ();
   dw = new GmDruidWindow ();
-  chat = new GmTextChat ();
   chw = new GmCallsHistoryWindow ();
   rtp = new GmRtpData ();
 
@@ -159,7 +158,6 @@
   delete (pw);
   delete (lw);
   delete (dw);
-  delete (chat);
   delete (chw);
   delete (rtp);
 }
@@ -387,13 +385,6 @@
 }
 
 
-GmTextChat *
-GnomeMeeting::GetTextChat ()
-{
-  return chat;
-}
-
-
 GmRtpData *
 GnomeMeeting::GetRtpData ()
 {
@@ -429,6 +420,7 @@
   
   /* Build the GUI */
   gnomemeeting_stock_icons_init ();
+  gw->chat_window = gnomemeeting_text_chat_new ();
   gw->tips = gtk_tooltips_new ();
   gw->log_window = gnomemeeting_log_window_new ();
   gw->calls_history_window = gnomemeeting_calls_history_window_new (chw);
diff -ur gnomemeeting-cvs-20040405.CVS/src/gnomemeeting.h gnomemeeting-cvs-20040405.CVS.patched/src/gnomemeeting.h
--- gnomemeeting-cvs-20040405.CVS/src/gnomemeeting.h	2004-03-27 20:03:13.000000000 +0100
+++ gnomemeeting-cvs-20040405.CVS.patched/src/gnomemeeting.h	2004-04-06 16:03:51.000000000 +0200
@@ -144,14 +144,6 @@
 
 
   /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Returns a pointer to the GmTextChat
-   *                 structure of widgets.
-   * PRE          :  /
-   */
-  GmTextChat *GetTextChat ();
-
-
-  /* DESCRIPTION  :  /
    * BEHAVIOR     :  Returns a pointer to the GmRtpData
    *                 structure of widgets.
    * PRE          :  /
@@ -201,7 +193,6 @@
   GmDruidWindow *dw;
   GmCallsHistoryWindow *chw;
   GmPrefWindow *pw;
-  GmTextChat *chat;
   GmRtpData *rtp;
 
   PMutex ep_var_mutex;
diff -ur gnomemeeting-cvs-20040405.CVS/src/main_window.cpp gnomemeeting-cvs-20040405.CVS.patched/src/main_window.cpp
--- gnomemeeting-cvs-20040405.CVS/src/main_window.cpp	2004-04-06 15:18:24.000000000 +0200
+++ gnomemeeting-cvs-20040405.CVS.patched/src/main_window.cpp	2004-04-06 16:01:04.000000000 +0200
@@ -969,17 +969,14 @@
   GtkWidget *event_box = NULL;
   GtkWidget *main_toolbar = NULL;
   GtkWidget *left_toolbar = NULL;
+  GtkWidget *chat_window = NULL;
 
   int main_notebook_section = 0;
 
-  GmTextChat *chat = NULL;
-
   static GtkTargetEntry dnd_targets [] =
   {
     {"text/plain", GTK_TARGET_SAME_APP, 0}
   };
-
-  chat = GnomeMeeting::Process ()->GetTextChat ();
   
   accel = gtk_accel_group_new ();
   gtk_window_add_accel_group (GTK_WINDOW (window), accel);
@@ -1164,14 +1161,14 @@
 
 
   /* The Chat Window */
-  gw->chat_window = gnomemeeting_text_chat_new (chat);
-  gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (gw->chat_window), 
+  chat_window = GnomeMeeting::Process ()->GetMainWindow ()->chat_window;
+  gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (chat_window), 
  		    2, 4, 0, 3,
  		    (GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
  		    (GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
  		    6, 6);
   if (gm_conf_get_bool (USER_INTERFACE_KEY "main_window/show_chat_window"))
-    gtk_widget_show_all (GTK_WIDGET (gw->chat_window));
+    gtk_widget_show_all (GTK_WIDGET (chat_window));
   
   gtk_widget_set_size_request (GTK_WIDGET (gw->main_notebook),
 			       GM_QCIF_WIDTH + GM_FRAME_SIZE, -1);
diff -ur gnomemeeting-cvs-20040405.CVS/src/menu.cpp gnomemeeting-cvs-20040405.CVS.patched/src/menu.cpp
--- gnomemeeting-cvs-20040405.CVS/src/menu.cpp	2004-04-06 15:18:24.000000000 +0200
+++ gnomemeeting-cvs-20040405.CVS.patched/src/menu.cpp	2004-04-06 16:01:47.000000000 +0200
@@ -59,6 +59,8 @@
 
 
 /* Static functions */
+static void text_chat_clear_cb (GtkWidget *,
+				gpointer);
 static void zoom_changed_callback (GtkWidget *,
 				   gpointer);
 
@@ -80,6 +82,22 @@
 
 
 /* GTK Callbacks */
+/* DESCRIPTION  :  This callback is called when the user clicks on the
+ *                 clear text chat menu entry
+ * BEHAVIOR     :  clears text chat
+ * PRE          :  /
+ */
+static void 
+text_chat_clear_cb (GtkWidget *widget,
+		    gpointer data)
+{
+  GtkWidget *chat_window = NULL;
+
+  chat_window = GTK_WIDGET (data);
+  gnomemeeting_text_chat_clear (chat_window);
+}
+
+
 /* DESCRIPTION  :  This callback is called when the user changes the zoom
  *                 factor in the menu.
  * BEHAVIOR     :  Sets zoom to 1:2 if data == 0, 1:1 if data == 1, 
@@ -212,7 +230,6 @@
 gnomemeeting_init_menu (GtkAccelGroup *accel)
 {
   GmWindow *gw = NULL;
-  GmTextChat *chat = NULL;
 
   GtkWidget *menubar = NULL;
 
@@ -221,7 +238,6 @@
   bool show_status_bar = false;
   bool show_chat_window = false;
 
-  chat = GnomeMeeting::Process ()->GetTextChat ();
   gw = GnomeMeeting::Process ()->GetMainWindow ();
   
   menubar = gtk_menu_bar_new ();
@@ -387,8 +403,8 @@
       GTK_MENU_ENTRY("clear_text_chat", _("_Clear Text Chat"),
 		     _("Clear the text chat"), 
 		     GTK_STOCK_CLEAR, 'L',
-		     GTK_SIGNAL_FUNC (gnomemeeting_text_chat_clear),
-		     (gpointer) chat, FALSE),
+		     GTK_SIGNAL_FUNC (text_chat_clear_cb),
+		     (gpointer) gw->chat_window, FALSE),
 
       GTK_MENU_SEPARATOR,
 


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