[GnomeMeeting-devel-list] [PRE-PATCH] private struct _GmTextChat



Hi,

this is not a patch yet, since it didn't get as much testing as I like,
but I thought I would share it before going to bed, to get comments (the
discussion on global/local variables was heated enough that I prefer
being cautious).

Snark
diff -ur gnomemeeting-cvs-20040125.CVS/src/chat_window.cpp gnomemeeting-cvs-20040125.CVS.patched/src/chat_window.cpp
--- gnomemeeting-cvs-20040125.CVS/src/chat_window.cpp	2004-01-22 22:07:29.000000000 +0100
+++ gnomemeeting-cvs-20040125.CVS.patched/src/chat_window.cpp	2004-01-25 20:48:20.000000000 +0100
@@ -54,6 +54,15 @@
 #include "gtk-text-view-addon.h"
 #include "gtk_menu_extensions.h"
 
+struct _GmTextChat
+{
+  GtkWidget	*window;
+  GtkWidget     *text_view;
+  GtkTextBuffer *text_buffer;
+  gboolean	something_typed;
+  gchar		*begin_msg;
+};
+
 extern GtkWidget *gm;
 
 
@@ -309,8 +318,21 @@
 }
 
 
+
 GtkWidget *
-gnomemeeting_text_chat_new (GmTextChat *chat)
+gnomemeeting_text_chat_window (GmTextChat *chat)
+{
+  return chat->window;
+}
+
+void
+gnomemeeting_text_chat_free (GmTextChat *chat)
+{
+  free (chat);
+}
+
+GmTextChat *
+gnomemeeting_text_chat_new ()
 {
   GtkWidget *entry = NULL;
   GtkWidget *scr = NULL;
@@ -318,6 +340,7 @@
   GtkWidget *table = NULL;
   GtkWidget *frame = NULL;
   GtkWidget *hbox = NULL;
+  GmTextChat *chat = NULL;
   GtkWidget *chat_window = NULL;
 
   GtkTextIter  iter;
@@ -338,6 +361,8 @@
 				  GTK_POLICY_AUTOMATIC,
 				  GTK_POLICY_ALWAYS);
 
+  chat = (GmTextChat*)malloc (sizeof (struct _GmTextChat));
+  chat->window = chat_window;
   chat->begin_msg = NULL;
   chat->something_typed = FALSE;
 
@@ -450,5 +475,5 @@
   g_signal_connect (GTK_OBJECT (entry), "activate",
 		    G_CALLBACK (chat_entry_activate), chat->text_view);
 
-  return chat_window;
+  return chat;
 }
diff -ur gnomemeeting-cvs-20040125.CVS/src/chat_window.h gnomemeeting-cvs-20040125.CVS.patched/src/chat_window.h
--- gnomemeeting-cvs-20040125.CVS/src/chat_window.h	2004-01-20 12:46:57.000000000 +0100
+++ gnomemeeting-cvs-20040125.CVS.patched/src/chat_window.h	2004-01-25 20:41:21.000000000 +0100
@@ -46,13 +46,17 @@
 
 G_BEGIN_DECLS
 
+typedef struct _GmTextChat GmTextChat;
+
+GmTextChat *gnomemeeting_text_chat_new ();
+void gnomemeeting_text_chat_free (GmTextChat *);
 
 /* DESCRIPTION  :  /
  * BEHAVIOR     :  Initializes the text chat view.
  * PRE          :  /
  */
 GtkWidget *
-gnomemeeting_text_chat_new (GmTextChat *);
+gnomemeeting_text_chat_window (GmTextChat *);
 
 
 /* DESCRIPTION  :  /
diff -ur gnomemeeting-cvs-20040125.CVS/src/common.h gnomemeeting-cvs-20040125.CVS.patched/src/common.h
--- gnomemeeting-cvs-20040125.CVS/src/common.h	2004-01-24 23:27:39.000000000 +0100
+++ gnomemeeting-cvs-20040125.CVS.patched/src/common.h	2004-01-25 20:21:32.000000000 +0100
@@ -120,7 +120,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;
@@ -156,14 +155,6 @@
 } ControlPanelSection;
 
 
-struct _GmTextChat
-{
-  GtkWidget     *text_view;
-  GtkTextBuffer *text_buffer;
-  gboolean	something_typed;
-  gchar		*begin_msg;
-};
-
 
 struct _GmRtpData
 {
diff -ur gnomemeeting-cvs-20040125.CVS/src/endpoint.h gnomemeeting-cvs-20040125.CVS.patched/src/endpoint.h
--- gnomemeeting-cvs-20040125.CVS/src/endpoint.h	2004-01-24 23:27:40.000000000 +0100
+++ gnomemeeting-cvs-20040125.CVS.patched/src/endpoint.h	2004-01-25 20:19:52.000000000 +0100
@@ -43,6 +43,7 @@
 #include "../config.h"
 
 #include "common.h"
+#include "chat_window.h"
 
 #ifdef HAS_IXJ
 #include <ixjlid.h>
diff -ur gnomemeeting-cvs-20040125.CVS/src/gnomemeeting.cpp gnomemeeting-cvs-20040125.CVS.patched/src/gnomemeeting.cpp
--- gnomemeeting-cvs-20040125.CVS/src/gnomemeeting.cpp	2004-01-24 23:27:40.000000000 +0100
+++ gnomemeeting-cvs-20040125.CVS.patched/src/gnomemeeting.cpp	2004-01-25 20:41:16.000000000 +0100
@@ -109,7 +109,7 @@
   pw = new GmPrefWindow ();
   lw = new GmLdapWindow ();
   dw = new GmDruidWindow ();
-  chat = new GmTextChat ();
+  chat = gnomemeeting_text_chat_new ();
   chw = new GmCallsHistoryWindow ();
   rtp = new GmRtpData ();
 
@@ -164,7 +164,7 @@
   delete (pw);
   delete (lw);
   delete (dw);
-  delete (chat);
+  gnomemeeting_text_chat_free (chat);
   delete (chw);
   delete (rtp);
 }
diff -ur gnomemeeting-cvs-20040125.CVS/src/gnomemeeting.h gnomemeeting-cvs-20040125.CVS.patched/src/gnomemeeting.h
--- gnomemeeting-cvs-20040125.CVS/src/gnomemeeting.h	2004-01-20 12:46:57.000000000 +0100
+++ gnomemeeting-cvs-20040125.CVS.patched/src/gnomemeeting.h	2004-01-25 20:19:22.000000000 +0100
@@ -41,7 +41,7 @@
 
 #include "common.h"
 #include "endpoint.h"
-
+#include "chat_window.h"
 
 /**
  * COMMON NOTICE: The Application must be initialized with Init after its
diff -ur gnomemeeting-cvs-20040125.CVS/src/main_window.cpp gnomemeeting-cvs-20040125.CVS.patched/src/main_window.cpp
--- gnomemeeting-cvs-20040125.CVS/src/main_window.cpp	2004-01-20 12:46:58.000000000 +0100
+++ gnomemeeting-cvs-20040125.CVS.patched/src/main_window.cpp	2004-01-25 20:44:59.000000000 +0100
@@ -1135,7 +1135,7 @@
 
 
   /* The Chat Window */
-  gw->chat_window = gnomemeeting_text_chat_new (chat);
+  gw->chat_window = gnomemeeting_text_chat_window (chat);
   gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (gw->chat_window), 
  		    2, 4, 0, 3,
  		    (GtkAttachOptions) (GTK_FILL | GTK_EXPAND),


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