[GnomeMeeting-devel-list] [PRE-PATCH] private text chat



Hi,

This patch implements what had been discussed in the previous mail, and
as a consequence, is less intrusive:
* it modifies common.h to remove struct GmTextChat's definition ;
* it adds it back in chat_window.h, with a private part;
* the private part is defined in chat_window.cpp, and the code is
modified accordingly ;
* everywhere else, the only needed modification has been to add an
include of chat_window.h since common.h wasn't providing anymore what
was needed.

Snark
diff -ur gnomemeeting-cvs-20040126.CVS/src/chat_window.cpp gnomemeeting-cvs-20040126.CVS.patched/src/chat_window.cpp
--- gnomemeeting-cvs-20040126.CVS/src/chat_window.cpp	2004-01-22 22:07:29.000000000 +0100
+++ gnomemeeting-cvs-20040126.CVS.patched/src/chat_window.cpp	2004-01-26 11:19:01.000000000 +0100
@@ -54,6 +54,16 @@
 #include "gtk-text-view-addon.h"
 #include "gtk_menu_extensions.h"
 
+struct _GmTextChatPrivate
+{
+  GtkWidget     *text_view;
+  GtkTextBuffer *text_buffer;
+  gboolean	 something_typed;
+  gchar       	 *begin_msg;
+};
+
+
+
 extern GtkWidget *gm;
 
 
@@ -185,10 +195,10 @@
 
   gw = GnomeMeeting::Process ()->GetMainWindow ();
   
-  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_get_start_iter (chat->internal->text_buffer, &start_iter);
+  gtk_text_buffer_get_end_iter (chat->internal->text_buffer, &end_iter);
 
-  gtk_text_buffer_delete (chat->text_buffer, &start_iter, &end_iter);
+  gtk_text_buffer_delete (chat->internal->text_buffer, &start_iter, &end_iter);
 
   gtk_menu_set_sensitive (gw->main_menu, "clear_text_chat", FALSE);
 }
@@ -196,11 +206,11 @@
 void
 gnomemeeting_text_chat_call_start_notification (void)
 {
-  GmTextChat *chat = NULL;
+  GmTextChatPrivate *chat = NULL;
   GmWindow *gw = NULL;
 
   gw = GnomeMeeting::Process ()->GetMainWindow ();
-  chat = GnomeMeeting::Process ()->GetTextChat ();
+  chat = GnomeMeeting::Process ()->GetTextChat ()->internal;
 	
   // find the time at which the event occured
   time_t *timeptr;
@@ -227,7 +237,7 @@
 gnomemeeting_text_chat_call_stop_notification (void)
 {
   GtkTextIter iter;
-  GmTextChat *chat = NULL;
+  GmTextChatPrivate *chat = NULL;
   GmWindow *gw = NULL;
   gchar *text = NULL;
 
@@ -246,7 +256,7 @@
 
   // displays the message
   gw = GnomeMeeting::Process ()->GetMainWindow ();
-  chat = GnomeMeeting::Process ()->GetTextChat ();
+  chat = GnomeMeeting::Process ()->GetTextChat ()->internal;
   gtk_text_buffer_get_end_iter (chat->text_buffer, &iter);
 
   if (chat->something_typed == TRUE)
@@ -266,11 +276,11 @@
   GtkTextIter iter;
   GtkTextMark *mark;
   
-  GmTextChat *chat = NULL;
+  GmTextChatPrivate *chat = NULL;
   GmWindow *gw = NULL;
 
   gw = GnomeMeeting::Process ()->GetMainWindow ();
-  chat = GnomeMeeting::Process ()->GetTextChat ();
+  chat = GnomeMeeting::Process ()->GetTextChat ()->internal ;
 
   gtk_text_buffer_get_end_iter (chat->text_buffer, &iter);
 
@@ -337,36 +347,36 @@
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scr),
 				  GTK_POLICY_AUTOMATIC,
 				  GTK_POLICY_ALWAYS);
-
-  chat->begin_msg = NULL;
-  chat->something_typed = FALSE;
-
-  chat->text_view = gtk_text_view_new_with_regex ();
-  gtk_text_view_set_editable (GTK_TEXT_VIEW (chat->text_view), FALSE);
-  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (chat->text_view),
+  chat->internal = new _GmTextChatPrivate ();
+  chat->internal->begin_msg = NULL;
+  chat->internal->something_typed = FALSE;
+
+  chat->internal->text_view = gtk_text_view_new_with_regex ();
+  gtk_text_view_set_editable (GTK_TEXT_VIEW (chat->internal->text_view), FALSE);
+  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (chat->internal->text_view),
 			       GTK_WRAP_WORD);
 
-  chat->text_buffer = 
-    gtk_text_view_get_buffer (GTK_TEXT_VIEW (chat->text_view));
+  chat->internal->text_buffer = 
+    gtk_text_view_get_buffer (GTK_TEXT_VIEW (chat->internal->text_view));
 
-  gtk_text_buffer_get_end_iter (chat->text_buffer, &iter);
-  gtk_text_view_set_cursor_visible  (GTK_TEXT_VIEW (chat->text_view), false);
+  gtk_text_buffer_get_end_iter (chat->internal->text_buffer, &iter);
+  gtk_text_view_set_cursor_visible  (GTK_TEXT_VIEW (chat->internal->text_view), false);
 
-  mark = gtk_text_buffer_create_mark (chat->text_buffer, 
+  mark = gtk_text_buffer_create_mark (chat->internal->text_buffer, 
 				      "current-position", &iter, FALSE);
 
-  gtk_text_buffer_create_tag (chat->text_buffer, "primary-user",
+  gtk_text_buffer_create_tag (chat->internal->text_buffer, "primary-user",
 			      "foreground", "red", 
 			      "weight", 900, NULL);
 
-  gtk_text_buffer_create_tag (chat->text_buffer,
+  gtk_text_buffer_create_tag (chat->internal->text_buffer,
 			      "secondary-user",
 			      "foreground", "darkblue", 
 			      "weight", 900, NULL);
 
   
   /* Create the various tags for the different urls types */
-  regex_tag = gtk_text_buffer_create_tag (chat->text_buffer,
+  regex_tag = gtk_text_buffer_create_tag (chat->internal->text_buffer,
 					  "uri-http",
 					  "foreground", "blue",
 					  NULL);
@@ -383,7 +393,7 @@
   }
 
   
-  regex_tag = gtk_text_buffer_create_tag (chat->text_buffer, "uri-h323",
+  regex_tag = gtk_text_buffer_create_tag (chat->internal->text_buffer, "uri-h323",
 					  "foreground", "pink",
 					  NULL);
   if (gtk_text_tag_set_regex (regex_tag,
@@ -398,14 +408,14 @@
 				       NULL);
   }
 
-  regex_tag = gtk_text_buffer_create_tag (chat->text_buffer, "smileys",
+  regex_tag = gtk_text_buffer_create_tag (chat->internal->text_buffer, "smileys",
 					  "foreground", "grey",
 					  NULL);
   if (gtk_text_tag_set_regex (regex_tag,
 			      "(:[-]?(\\)|\\(|o|O|p|P|D|\\||/)|\\}:(\\(|\\))|\\|[-]?(\\(|\\))|:'\\(|:\\[|:-(\\.|\\*|x)|;[-]?\\)|(8|B)[-]?\\)|X(\\(|\\||\\))|\\((\\.|\\|)\\)|x\\*O)"))
     gtk_text_tag_set_regex_display (regex_tag, gtk_text_buffer_insert_smiley);
 
-  regex_tag = gtk_text_buffer_create_tag (chat->text_buffer, "latex",
+  regex_tag = gtk_text_buffer_create_tag (chat->internal->text_buffer, "latex",
 					  "foreground", "grey",
 					  NULL);
   if (gtk_text_tag_set_regex (regex_tag,
@@ -417,7 +427,7 @@
   /* */
   frame = gtk_frame_new (NULL);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
-  gtk_container_add (GTK_CONTAINER (scr), chat->text_view);
+  gtk_container_add (GTK_CONTAINER (scr), chat->internal->text_view);
   gtk_container_add (GTK_CONTAINER (frame), scr);
   
   gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (frame), 
@@ -448,7 +458,7 @@
 		    0, 0);
 
   g_signal_connect (GTK_OBJECT (entry), "activate",
-		    G_CALLBACK (chat_entry_activate), chat->text_view);
+		    G_CALLBACK (chat_entry_activate), chat->internal->text_view);
 
   return chat_window;
 }
diff -ur gnomemeeting-cvs-20040126.CVS/src/chat_window.h gnomemeeting-cvs-20040126.CVS.patched/src/chat_window.h
--- gnomemeeting-cvs-20040126.CVS/src/chat_window.h	2004-01-20 12:46:57.000000000 +0100
+++ gnomemeeting-cvs-20040126.CVS.patched/src/chat_window.h	2004-01-26 09:42:08.000000000 +0100
@@ -46,6 +46,14 @@
 
 G_BEGIN_DECLS
 
+typedef struct _GmTextChat GmTextChat;
+typedef struct _GmTextChatPrivate GmTextChatPrivate;
+
+struct _GmTextChat
+{
+  GtkWidget *window;
+  GmTextChatPrivate *internal;
+};
 
 /* DESCRIPTION  :  /
  * BEHAVIOR     :  Initializes the text chat view.
diff -ur gnomemeeting-cvs-20040126.CVS/src/common.h gnomemeeting-cvs-20040126.CVS.patched/src/common.h
--- gnomemeeting-cvs-20040126.CVS/src/common.h	2004-01-24 23:27:39.000000000 +0100
+++ gnomemeeting-cvs-20040126.CVS.patched/src/common.h	2004-01-26 09:29:23.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-20040126.CVS/src/endpoint.h gnomemeeting-cvs-20040126.CVS.patched/src/endpoint.h
--- gnomemeeting-cvs-20040126.CVS/src/endpoint.h	2004-01-24 23:27:40.000000000 +0100
+++ gnomemeeting-cvs-20040126.CVS.patched/src/endpoint.h	2004-01-26 09:32:01.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-20040126.CVS/src/gnomemeeting.h gnomemeeting-cvs-20040126.CVS.patched/src/gnomemeeting.h
--- gnomemeeting-cvs-20040126.CVS/src/gnomemeeting.h	2004-01-20 12:46:57.000000000 +0100
+++ gnomemeeting-cvs-20040126.CVS.patched/src/gnomemeeting.h	2004-01-26 09:32:37.000000000 +0100
@@ -40,6 +40,7 @@
 #define _GNOMEMEETING_H_
 
 #include "common.h"
+#include "chat_window.h"
 #include "endpoint.h"
 
 


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