[GnomeMeeting-devel-list] [PATCH] making log window cleaner
- From: PUYDT Julien <julien puydt laposte net>
- To: GnomeMeeting Devel Liste <gnomemeeting-devel-list gnome org>
- Subject: [GnomeMeeting-devel-list] [PATCH] making log window cleaner
- Date: Mon, 12 Apr 2004 12:46:28 +0200
Hi,
this patch makes the log window fit the get-a-widget-as-first-argument
api, and puts it in a separate set of files.
Snark
PS: no, I still don't have an account.
diff -urN gnomemeeting-cvs-20040409.CVS/src/callbacks.cpp gnomemeeting-cvs-20040409.CVS.patched/src/callbacks.cpp
--- gnomemeeting-cvs-20040409.CVS/src/callbacks.cpp 2004-04-07 11:37:44.000000000 +0200
+++ gnomemeeting-cvs-20040409.CVS.patched/src/callbacks.cpp 2004-04-12 12:36:10.000000000 +0200
@@ -40,11 +40,11 @@
#include "../config.h"
#include "ldap_window.h"
+#include "log_window.h"
#include "callbacks.h"
#include "gnomemeeting.h"
#include "menu.h"
#include "misc.h"
-#include "tools.h"
#include "urlhandler.h"
#include "gmentrydialog.h"
@@ -262,7 +262,7 @@
gtk_label_set_text_with_mnemonic (GTK_LABEL (child),
menu_suspend_msg);
- gnomemeeting_log_insert (log_resume_msg);
+ gnomemeeting_log_insert (gw->log_window, log_resume_msg);
gnomemeeting_statusbar_flash (gw->statusbar, log_resume_msg);
g_signal_handlers_block_by_func (G_OBJECT (b),
@@ -284,7 +284,7 @@
gtk_label_set_text_with_mnemonic (GTK_LABEL (child),
menu_resume_msg);
- gnomemeeting_log_insert (log_suspend_msg);
+ gnomemeeting_log_insert (gw->log_window, log_suspend_msg);
gnomemeeting_statusbar_flash (gw->statusbar, log_suspend_msg);
g_signal_handlers_block_by_func (G_OBJECT (b),
diff -urN gnomemeeting-cvs-20040409.CVS/src/common.h gnomemeeting-cvs-20040409.CVS.patched/src/common.h
--- gnomemeeting-cvs-20040409.CVS/src/common.h 2004-04-07 11:37:44.000000000 +0200
+++ gnomemeeting-cvs-20040409.CVS.patched/src/common.h 2004-04-12 12:36:10.000000000 +0200
@@ -61,6 +61,7 @@
#define vsnprintf _vsnprintf
#endif
+
#define GENERAL_KEY "/apps/gnomemeeting/general/"
#define USER_INTERFACE_KEY "/apps/gnomemeeting/general/user_interface/"
@@ -188,7 +189,6 @@
GtkWidget *splash_win;
GtkWidget *combo;
GtkWidget *log_window;
- GtkWidget *log_text_view;
GtkWidget *main_notebook;
GtkWidget *main_video_image;
GtkWidget *local_video_image;
diff -urN gnomemeeting-cvs-20040409.CVS/src/config.cpp gnomemeeting-cvs-20040409.CVS.patched/src/config.cpp
--- gnomemeeting-cvs-20040409.CVS/src/config.cpp 2004-04-07 10:08:13.000000000 +0200
+++ gnomemeeting-cvs-20040409.CVS.patched/src/config.cpp 2004-04-12 12:36:10.000000000 +0200
@@ -50,6 +50,7 @@
#include "menu.h"
#include "pref_window.h"
#include "ldap_window.h"
+#include "log_window.h"
#include "tray.h"
#include "misc.h"
#include "tools.h"
@@ -369,7 +370,8 @@
ep->DisableH245Tunneling (!gm_conf_entry_get_bool (entry));
gdk_threads_enter ();
- gnomemeeting_log_insert (ep->IsH245TunnelingDisabled ()?
+ gnomemeeting_log_insert (gw->log_window,
+ ep->IsH245TunnelingDisabled ()?
_("H.245 Tunneling disabled"):
_("H.245 Tunneling enabled"));
gdk_threads_leave ();
@@ -398,7 +400,8 @@
ep->DisableH245inSetup (!gm_conf_entry_get_bool (entry));
gdk_threads_enter ();
- gnomemeeting_log_insert (ep->IsH245inSetupDisabled ()?
+ gnomemeeting_log_insert (gw->log_window,
+ ep->IsH245inSetupDisabled ()?
_("Early H.245 disabled"):
_("Early H.245 enabled"));
gdk_threads_leave ();
@@ -427,7 +430,8 @@
ep->DisableFastStart (!gm_conf_entry_get_bool (entry));
gdk_threads_enter ();
- gnomemeeting_log_insert (ep->IsFastStartDisabled ()?
+ gnomemeeting_log_insert (gw->log_window,
+ ep->IsFastStartDisabled ()?
_("Fast Start disabled"):
_("Fast Start enabled"));
gdk_threads_leave ();
@@ -607,12 +611,14 @@
if (mode == H323AudioCodec::AdaptiveSilenceDetection) {
mode = H323AudioCodec::NoSilenceDetection;
- gnomemeeting_log_insert (_("Disabled silence detection"));
+ gnomemeeting_log_insert (gw->log_window,
+ _("Disabled silence detection"));
}
else {
mode = H323AudioCodec::AdaptiveSilenceDetection;
- gnomemeeting_log_insert (_("Enabled silence detection"));
+ gnomemeeting_log_insert (gw->log_window,
+ _("Enabled silence detection"));
}
gdk_threads_leave ();
diff -urN gnomemeeting-cvs-20040409.CVS/src/connection.cpp gnomemeeting-cvs-20040409.CVS.patched/src/connection.cpp
--- gnomemeeting-cvs-20040409.CVS/src/connection.cpp 2004-04-07 10:08:13.000000000 +0200
+++ gnomemeeting-cvs-20040409.CVS.patched/src/connection.cpp 2004-04-12 12:36:10.000000000 +0200
@@ -43,8 +43,8 @@
#include "gnomemeeting.h"
#include "menu.h"
#include "misc.h"
-#include "tools.h"
#include "chat_window.h"
+#include "log_window.h"
#include "main_window.h"
#include "dialog.h"
@@ -166,7 +166,7 @@
/* Update the GUI and menus wrt opened channels */
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (msg);
+ gnomemeeting_log_insert (gw->log_window, msg);
gnomemeeting_menu_update_sensitivity (is_video, is_video?is_receiving_video:is_receiving_audio, is_video?is_transmitting_video:is_transmitting_audio);
gnomemeeting_main_window_update_sensitivity (is_video, is_video?is_receiving_video:is_receiving_audio, is_video?is_transmitting_video:is_transmitting_audio);
if (!is_receiving_video && !is_transmitting_video && !preview)
@@ -197,10 +197,11 @@
if (!success) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert ((dir == H323Channel::IsTransmitter)
- ? _("Failure opening %s for transmission, will try with next common codec")
- : _("Failure opening %s for reception, will try with next common codec"),
- (const char *) capability.GetFormatName ());
+ gnomemeeting_log_insert (gw->log_window,
+ (dir == H323Channel::IsTransmitter)
+ ? _("Failure opening %s for transmission, will try with next common codec")
+ : _("Failure opening %s for reception, will try with next common codec"),
+ (const char *) capability.GetFormatName ());
gnomemeeting_threads_leave ();
}
@@ -313,7 +314,7 @@
gnomemeeting_threads_enter ();
gw = GnomeMeeting::Process ()->GetMainWindow ();
gnomemeeting_error_dialog (GTK_WINDOW (gm), _("Call transfer failed"), _("The remote user tried to transfer your call to another user, but it failed."));
- gnomemeeting_log_insert (_("Call transfer failed"));
+ gnomemeeting_log_insert (gw->log_window, _("Call transfer failed"));
gnomemeeting_threads_leave ();
}
diff -urN gnomemeeting-cvs-20040409.CVS/src/endpoint.cpp gnomemeeting-cvs-20040409.CVS.patched/src/endpoint.cpp
--- gnomemeeting-cvs-20040409.CVS/src/endpoint.cpp 2004-04-07 10:08:13.000000000 +0200
+++ gnomemeeting-cvs-20040409.CVS.patched/src/endpoint.cpp 2004-04-12 12:36:10.000000000 +0200
@@ -52,6 +52,7 @@
#include "toolbar.h"
#include "chat_window.h"
#include "ldap_window.h"
+#include "log_window.h"
#include "pref_window.h"
#include "main_window.h"
#include "tools.h"
@@ -747,7 +748,7 @@
msg = g_strdup_printf (_("Call from %s"), (const char *) utf8_name);
gnomemeeting_threads_enter ();
gnomemeeting_statusbar_push (gw->statusbar, msg);
- gnomemeeting_log_insert (msg);
+ gnomemeeting_log_insert (gw->log_window, msg);
gnomemeeting_threads_leave ();
g_free (msg);
@@ -805,7 +806,7 @@
/* Add the full message in the log */
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (msg);
+ gnomemeeting_log_insert (gw->log_window, msg);
gnomemeeting_threads_leave ();
/* Free things, we will return */
@@ -912,7 +913,7 @@
msg = g_strdup_printf (_("Forwarding call to %s"),
(const char*) forward_party);
gnomemeeting_statusbar_push (gw->statusbar, msg);
- gnomemeeting_log_insert (msg);
+ gnomemeeting_log_insert (gw->log_window, msg);
gnomemeeting_threads_leave ();
g_free (msg);
@@ -974,8 +975,9 @@
gnomemeeting_threads_enter ();
gnomemeeting_statusbar_push (gw->statusbar, _("Connected"));
- gnomemeeting_log_insert (_("Connected with %s using %s"),
- utf8_name, utf8_app);
+ gnomemeeting_log_insert (gw->log_window,
+ _("Connected with %s using %s"),
+ utf8_name, utf8_app);
gnomemeeting_text_chat_call_start_notification (GnomeMeeting::Process ()->GetMainWindow ()->chat_window);
gtk_label_set_text (GTK_LABEL (gw->remote_name), (const char *) utf8_name);
@@ -1267,7 +1269,7 @@
utf8_app);
- gnomemeeting_log_insert (msg_reason);
+ gnomemeeting_log_insert (gw->log_window, msg_reason);
gnomemeeting_text_chat_call_stop_notification (GnomeMeeting::Process ()->GetMainWindow ()->chat_window);
gnomemeeting_statusbar_flash (gw->statusbar, msg_reason);
gnomemeeting_threads_leave ();
@@ -1682,7 +1684,8 @@
l->Unlock ();
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (_("Attaching lid hardware to codec"));
+ gnomemeeting_log_insert (gw->log_window,
+ _("Attaching lid hardware to codec"));
gnomemeeting_threads_leave ();
}
else
@@ -1715,7 +1718,7 @@
plugin %s" or "Opening %s for recording with plugin" */
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (is_encoding ?
+ gnomemeeting_log_insert (gw->log_window, is_encoding ?
_("Opened %s for recording with plugin %s")
: _("Opened %s for playing with plugin %s"),
(const char *) device,
@@ -2136,8 +2139,9 @@
connection->ForwardCall (PString ((const char *) forward_host));
gdk_threads_enter ();
- gnomemeeting_log_insert (_("Forwarding Call to %s (No Answer)"),
- (const char *) forward_host);
+ gnomemeeting_log_insert (gw->log_window,
+ _("Forwarding Call to %s (No Answer)"),
+ (const char *) forward_host);
gnomemeeting_statusbar_push (gw->statusbar, _("Call forwarded"));
gdk_threads_leave ();
diff -urN gnomemeeting-cvs-20040409.CVS/src/gatekeeper.cpp gnomemeeting-cvs-20040409.CVS.patched/src/gatekeeper.cpp
--- gnomemeeting-cvs-20040409.CVS/src/gatekeeper.cpp 2004-03-27 20:03:13.000000000 +0100
+++ gnomemeeting-cvs-20040409.CVS.patched/src/gatekeeper.cpp 2004-04-12 12:36:10.000000000 +0200
@@ -42,7 +42,7 @@
#include "gatekeeper.h"
#include "gnomemeeting.h"
#include "misc.h"
-#include "tools.h"
+#include "log_window.h"
#include "dialog.h"
#include "gm_conf.h"
@@ -130,7 +130,7 @@
gk_name = gatekeeper->GetName ();
msg = g_strdup_printf (_("Unregistered from gatekeeper %s"),
(const char *) gk_name);
- gnomemeeting_log_insert (msg);
+ gnomemeeting_log_insert (gw->log_window, msg);
gnomemeeting_statusbar_flash (gw->statusbar, msg);
g_free (msg);
}
@@ -215,7 +215,7 @@
msg = g_strdup (_("No gatekeeper corresponding to your options has been found."));
gnomemeeting_error_dialog (GTK_WINDOW (gm), _("Error while registering with gatekeeper"), msg);
- gnomemeeting_log_insert (msg);
+ gnomemeeting_log_insert (gw->log_window, msg);
g_free (msg);
}
@@ -232,7 +232,7 @@
g_strdup_printf (_("Gatekeeper set to %s"), (const char *) gk_name);
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (msg);
+ gnomemeeting_log_insert (gw->log_window, msg);
gnomemeeting_statusbar_flash (gw->statusbar, msg);
gnomemeeting_threads_leave ();
diff -urN gnomemeeting-cvs-20040409.CVS/src/gnomemeeting.cpp gnomemeeting-cvs-20040409.CVS.patched/src/gnomemeeting.cpp
--- gnomemeeting-cvs-20040409.CVS/src/gnomemeeting.cpp 2004-04-07 10:08:13.000000000 +0200
+++ gnomemeeting-cvs-20040409.CVS.patched/src/gnomemeeting.cpp 2004-04-12 12:36:10.000000000 +0200
@@ -49,6 +49,7 @@
#include "druid.h"
#include "tools.h"
#include "tray.h"
+#include "log_window.h"
#include "main_window.h"
#include "toolbar.h"
#include "misc.h"
@@ -178,7 +179,7 @@
if (endpoint->GetCallingState () == 3) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (_("Answering incoming call"));
+ gnomemeeting_log_insert (gw->log_window, _("Answering incoming call"));
connect_button_update_pixmap (GTK_TOGGLE_BUTTON (gw->connect_button), 1);
gnomemeeting_threads_leave ();
@@ -227,7 +228,7 @@
if (endpoint->GetCallingState () == 1) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (_("Trying to stop calling"));
+ gnomemeeting_log_insert (gw->log_window, _("Trying to stop calling"));
gnomemeeting_threads_leave ();
endpoint->ClearCall (endpoint->GetCurrentCallToken (), reason);
@@ -238,7 +239,7 @@
if (endpoint->GetCallingState () == 2) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (_("Stopping current call"));
+ gnomemeeting_log_insert (gw->log_window, _("Stopping current call"));
connect_button_update_pixmap (GTK_TOGGLE_BUTTON (gw->connect_button),
0);
gnomemeeting_threads_leave ();
@@ -248,7 +249,7 @@
else if (endpoint->GetCallingState () == 3) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (_("Refusing Incoming call"));
+ gnomemeeting_log_insert (gw->log_window, _("Refusing Incoming call"));
connect_button_update_pixmap (GTK_TOGGLE_BUTTON (gw->connect_button),
0);
gnomemeeting_threads_leave ();
@@ -466,7 +467,8 @@
/* GM is started */
- gnomemeeting_log_insert (_("Started GnomeMeeting V%d.%d.%d for %s\n"),
+ gnomemeeting_log_insert (gw->log_window,
+ _("Started GnomeMeeting V%d.%d.%d for %s\n"),
MAJOR_VERSION, MINOR_VERSION, BUILD_NUMBER,
g_get_user_name ());
}
diff -urN gnomemeeting-cvs-20040409.CVS/src/ils.cpp gnomemeeting-cvs-20040409.CVS.patched/src/ils.cpp
--- gnomemeeting-cvs-20040409.CVS/src/ils.cpp 2004-04-09 13:05:39.000000000 +0200
+++ gnomemeeting-cvs-20040409.CVS.patched/src/ils.cpp 2004-04-12 12:36:10.000000000 +0200
@@ -41,8 +41,8 @@
#include "ils.h"
#include "gnomemeeting.h"
#include "ldap_window.h"
+#include "log_window.h"
#include "misc.h"
-#include "tools.h"
#include "gm_conf.h"
#include "stock-icons.h"
#include "dialog.h"
@@ -283,7 +283,7 @@
msg = g_strdup_printf (_("Unregistered from the users directory %s."), ldap_server);
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (msg);
+ gnomemeeting_log_insert (gw->log_window, msg);
g_free (msg);
gnomemeeting_threads_leave ();
}
@@ -304,7 +304,7 @@
gnomemeeting_threads_enter ();
msg = g_strdup_printf (_("Error while registering to %s"),
ldap_server);
- gnomemeeting_log_insert (msg);
+ gnomemeeting_log_insert (gw->log_window, msg);
gnomemeeting_statusbar_flash (gw->statusbar, msg);
g_free (msg);
gnomemeeting_threads_leave ();
diff -urN gnomemeeting-cvs-20040409.CVS/src/lid.cpp gnomemeeting-cvs-20040409.CVS.patched/src/lid.cpp
--- gnomemeeting-cvs-20040409.CVS/src/lid.cpp 2004-03-27 20:03:14.000000000 +0100
+++ gnomemeeting-cvs-20040409.CVS.patched/src/lid.cpp 2004-04-12 12:36:10.000000000 +0200
@@ -43,7 +43,7 @@
#include "gnomemeeting.h"
#include "urlhandler.h"
#include "misc.h"
-#include "tools.h"
+#include "log_window.h"
#include "main_window.h"
#include "pref_window.h"
#include "callbacks.h"
@@ -131,8 +131,9 @@
if (OpalIxJDevice::Open (dev_name)) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (_("Opened Quicknet device %s"),
- (const char *) GetName ()); // FIXME: is it thread-safe!?
+ gnomemeeting_log_insert (gw->log_window,
+ _("Opened Quicknet device %s"),
+ (const char *) GetName ()); // FIXME: is it thread-safe!?
gnomemeeting_threads_leave ();
if (lid_country)
@@ -181,7 +182,8 @@
OpalIxJDevice::Close ();
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (_("Closed Quicknet device %s"),
+ gnomemeeting_log_insert (gw->log_window,
+ _("Closed Quicknet device %s"),
(const char *) GetName ()); // FIXME: is it thread-safe?!
gnomemeeting_threads_leave ();
}
@@ -269,7 +271,7 @@
if (off_hook == TRUE && last_off_hook == FALSE) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (_("Phone is off hook"));
+ gnomemeeting_log_insert (gw->log_window, _("Phone is off hook"));
gnomemeeting_statusbar_flash (gw->statusbar, _("Phone is off hook"));
gnomemeeting_threads_leave ();
@@ -305,7 +307,7 @@
if (off_hook == FALSE && last_off_hook == TRUE) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (_("Phone is on hook"));
+ gnomemeeting_log_insert (gw->log_window, _("Phone is on hook"));
gnomemeeting_statusbar_flash (gw->statusbar, _("Phone is on hook"));
/* Remove the current called number */
diff -urN gnomemeeting-cvs-20040409.CVS/src/log_window.cpp gnomemeeting-cvs-20040409.CVS.patched/src/log_window.cpp
--- gnomemeeting-cvs-20040409.CVS/src/log_window.cpp 1970-01-01 01:00:00.000000000 +0100
+++ gnomemeeting-cvs-20040409.CVS.patched/src/log_window.cpp 2004-04-12 12:37:34.000000000 +0200
@@ -0,0 +1,147 @@
+
+/* GnomeMeeting -- A Video-Conferencing application
+ * Copyright (C) 2000-2004 Damien Sandras
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * GnomeMeting is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OpenH323 and Pwlib, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OpenH323 program, as long
+ * as you do follow the requirements of the GNU GPL for all the rest of the
+ * software thus combined.
+ */
+
+
+/*
+ * log_window.cpp - description
+ * -------------------------
+ * begin : Sun Sep 1 2002
+ * copyright : (C) 2000-2004 by Damien Sandras
+ * description : This file defines functions to manage the log
+ *
+ */
+
+#include "common.h"
+
+#include "log_window.h"
+
+#include "callbacks.h"
+#include "misc.h"
+
+GtkWidget *
+gnomemeeting_log_window_new ()
+{
+ GtkWidget *window = NULL;
+ GtkWidget *scr = NULL;
+ GtkWidget *text_view = NULL;
+ GtkTextMark *mark = NULL;
+ GtkTextBuffer *buffer = NULL;
+ GtkTextIter end;
+
+ window = gtk_dialog_new ();
+ gtk_dialog_add_button (GTK_DIALOG (window), GTK_STOCK_CLOSE, 0);
+ g_object_set_data_full (G_OBJECT (window), "window_name",
+ g_strdup ("log_window"), g_free);
+
+ gtk_window_set_title (GTK_WINDOW (window), _("General History"));
+ gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
+
+ text_view = gtk_text_view_new ();
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
+
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
+ gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
+ gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE);
+ g_object_set_data (G_OBJECT (window), "text_view", (gpointer)text_view);
+
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
+ gtk_text_buffer_get_end_iter (buffer, &end);
+ mark = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (buffer),
+ "current-position", &end, FALSE);
+
+ scr = gtk_scrolled_window_new (NULL, NULL);
+ gtk_container_set_border_width (GTK_CONTAINER (scr), 6);
+
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scr),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_ALWAYS);
+
+ gtk_container_add (GTK_CONTAINER (scr), text_view);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), scr,
+ TRUE, TRUE, 0);
+
+ g_signal_connect_swapped (GTK_OBJECT (window),
+ "response",
+ G_CALLBACK (gnomemeeting_window_hide),
+ (gpointer) window);
+
+ g_signal_connect (GTK_OBJECT (window), "delete-event",
+ G_CALLBACK (delete_window_cb), NULL);
+
+ gtk_widget_show_all (GTK_WIDGET (GTK_DIALOG (window)->vbox));
+
+ return window;
+}
+
+void
+gnomemeeting_log_insert (GtkWidget *log_window, const char *format,
+ ...)
+{
+ va_list args;
+ GtkWidget *text_view = NULL;
+ GtkTextIter end;
+ GtkTextMark *mark;
+ GtkTextBuffer *buffer;
+
+ time_t *timeptr;
+ char *time_str;
+ gchar *text_buffer = NULL;
+ char buf [1025];
+
+ g_return_if_fail (log_window != NULL && format != NULL);
+
+ text_view = GTK_WIDGET (g_object_get_data (G_OBJECT (log_window),
+ "text_view"));
+
+ va_start (args, format);
+
+ vsnprintf (buf, 1024, format, args);
+
+ time_str = (char *) malloc (21);
+ timeptr = new (time_t);
+
+ time (timeptr);
+ strftime(time_str, 20, "%H:%M:%S", localtime (timeptr));
+
+ text_buffer = g_strdup_printf ("%s %s\n", time_str, buf);
+
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
+
+ gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (buffer), &end, -1);
+ gtk_text_buffer_insert (GTK_TEXT_BUFFER (buffer), &end, text_buffer, -1);
+
+ mark = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (buffer),
+ "current-position");
+
+ if (mark)
+ gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (text_view), mark,
+ 0.0, FALSE, 0,0);
+
+ g_free (text_buffer);
+ free (time_str);
+ delete (timeptr);
+}
diff -urN gnomemeeting-cvs-20040409.CVS/src/log_window.h gnomemeeting-cvs-20040409.CVS.patched/src/log_window.h
--- gnomemeeting-cvs-20040409.CVS/src/log_window.h 1970-01-01 01:00:00.000000000 +0100
+++ gnomemeeting-cvs-20040409.CVS.patched/src/log_window.h 2004-04-12 12:36:10.000000000 +0200
@@ -0,0 +1,55 @@
+
+/* GnomeMeeting -- A Video-Conferencing application
+ * Copyright (C) 2000-2004 Damien Sandras
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * GnomeMeting is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OpenH323 and Pwlib, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OpenH323 program, as long
+ * as you do follow the requirements of the GNU GPL for all the rest of the
+ * software thus combined.
+ */
+
+
+/*
+ * log_window.h - description
+ * -----------------------
+ * begin : Sun Sep 1 2002
+ * copyright : (C) 2000-2004 by Damien Sandras
+ * description : This file declares functions to manage the log
+ *
+ */
+
+#ifndef _LOG_WINDOW_H_
+#define _LOG_WINDOW_H_
+
+/* DESCRIPTION : /
+ * BEHAVIOR : Build the log window and returns it.
+ * PRE : /
+ */
+GtkWidget *gnomemeeting_log_window_new ();
+
+/* DESCRIPTION : /
+ * BEHAVIOR : Add text (gchar *) with timestamps into the log textview
+ * PRE : The text to add (printf compatible)
+ */
+void
+gnomemeeting_log_insert (GtkWidget *, const char *,
+ ...);
+
+#endif /* _LOG_WINDOW_H_ */
diff -urN gnomemeeting-cvs-20040409.CVS/src/Makefile.am gnomemeeting-cvs-20040409.CVS.patched/src/Makefile.am
--- gnomemeeting-cvs-20040409.CVS/src/Makefile.am 2004-04-07 10:08:13.000000000 +0200
+++ gnomemeeting-cvs-20040409.CVS.patched/src/Makefile.am 2004-04-12 12:36:10.000000000 +0200
@@ -50,6 +50,8 @@
tray.cpp \
tools.cpp \
tools.h \
+ log_window.cpp \
+ log_window.h \
lid.cpp \
lid.h \
codec_info.cpp \
diff -urN gnomemeeting-cvs-20040409.CVS/src/tools.cpp gnomemeeting-cvs-20040409.CVS.patched/src/tools.cpp
--- gnomemeeting-cvs-20040409.CVS/src/tools.cpp 2004-04-07 10:08:13.000000000 +0200
+++ gnomemeeting-cvs-20040409.CVS.patched/src/tools.cpp 2004-04-12 12:36:10.000000000 +0200
@@ -741,114 +741,3 @@
return window;
}
-
-GtkWidget *
-gnomemeeting_log_window_new ()
-{
- GtkWidget *window = NULL;
- GtkWidget *scr = NULL;
- GtkTextMark *mark = NULL;
- GtkTextBuffer *buffer = NULL;
- GtkTextIter end;
-
- GmWindow *gw = GnomeMeeting::Process ()->GetMainWindow ();
-
- /* Fix me, create a structure for that so that we don't use
- gw here */
- window = gtk_dialog_new ();
- gtk_dialog_add_button (GTK_DIALOG (window), GTK_STOCK_CLOSE, 0);
- g_object_set_data_full (G_OBJECT (window), "window_name",
- g_strdup ("log_window"), g_free);
-
- gtk_window_set_title (GTK_WINDOW (window), _("General History"));
- gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
-
- gw->log_text_view = gtk_text_view_new ();
- gtk_text_view_set_editable (GTK_TEXT_VIEW (gw->log_text_view),
- FALSE);
-
- gtk_text_view_set_editable (GTK_TEXT_VIEW (gw->log_text_view),
- FALSE);
- gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (gw->log_text_view),
- GTK_WRAP_WORD);
- gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (gw->log_text_view),
- FALSE);
-
- buffer =
- gtk_text_view_get_buffer (GTK_TEXT_VIEW (gw->log_text_view));
- gtk_text_buffer_get_end_iter (buffer, &end);
- mark = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (buffer),
- "current-position", &end, FALSE);
-
- scr = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_set_border_width (GTK_CONTAINER (scr), 6);
-
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scr),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_ALWAYS);
-
- gtk_container_add (GTK_CONTAINER (scr), gw->log_text_view);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), scr,
- TRUE, TRUE, 0);
-
- g_signal_connect_swapped (GTK_OBJECT (window),
- "response",
- G_CALLBACK (gnomemeeting_window_hide),
- (gpointer) window);
-
- g_signal_connect (GTK_OBJECT (window), "delete-event",
- G_CALLBACK (delete_window_cb), NULL);
-
- gtk_widget_show_all (GTK_WIDGET (GTK_DIALOG (window)->vbox));
-
- return window;
-}
-
-void
-gnomemeeting_log_insert (const char *format,
- ...)
-{
- va_list args;
-
- GmWindow *gw = GnomeMeeting::Process ()->GetMainWindow ();
- GtkWidget *text_view = gw->log_text_view;
- GtkTextIter end;
- GtkTextMark *mark;
- GtkTextBuffer *buffer;
-
- time_t *timeptr;
- char *time_str;
- gchar *text_buffer = NULL;
- char buf [1025];
-
- if (!text_view || !format)
- return;
-
- va_start (args, format);
-
- vsnprintf (buf, 1024, format, args);
-
- time_str = (char *) malloc (21);
- timeptr = new (time_t);
-
- time (timeptr);
- strftime(time_str, 20, "%H:%M:%S", localtime (timeptr));
-
- text_buffer = g_strdup_printf ("%s %s\n", time_str, buf);
-
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
-
- gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (buffer), &end, -1);
- gtk_text_buffer_insert (GTK_TEXT_BUFFER (buffer), &end, text_buffer, -1);
-
- mark = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (buffer),
- "current-position");
-
- if (mark)
- gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (text_view), mark,
- 0.0, FALSE, 0,0);
-
- g_free (text_buffer);
- free (time_str);
- delete (timeptr);
-}
diff -urN gnomemeeting-cvs-20040409.CVS/src/tools.h gnomemeeting-cvs-20040409.CVS.patched/src/tools.h
--- gnomemeeting-cvs-20040409.CVS/src/tools.h 2004-01-25 17:54:06.000000000 +0100
+++ gnomemeeting-cvs-20040409.CVS.patched/src/tools.h 2004-04-12 12:36:10.000000000 +0200
@@ -77,24 +77,9 @@
const char *);
/* DESCRIPTION : /
- * BEHAVIOR : Build the log window and returns it.
- * PRE : /
- */
-GtkWidget *gnomemeeting_log_window_new ();
-
-
-/* DESCRIPTION : /
* BEHAVIOR : Build the PC-To-Phone window and returns it.
* PRE : /
*/
GtkWidget *gnomemeeting_pc_to_phone_window_new ();
-/* DESCRIPTION : /
- * BEHAVIOR : Add text (gchar *) with timestamps into the log textview
- * PRE : The text to add (printf compatible)
- */
-void
-gnomemeeting_log_insert (const char *,
- ...);
-
#endif
diff -urN gnomemeeting-cvs-20040409.CVS/src/urlhandler.cpp gnomemeeting-cvs-20040409.CVS.patched/src/urlhandler.cpp
--- gnomemeeting-cvs-20040409.CVS/src/urlhandler.cpp 2004-04-07 10:08:13.000000000 +0200
+++ gnomemeeting-cvs-20040409.CVS.patched/src/urlhandler.cpp 2004-04-12 12:36:10.000000000 +0200
@@ -43,6 +43,7 @@
#include "urlhandler.h"
#include "gnomemeeting.h"
#include "misc.h"
+#include "log_window.h"
#include "ldap_window.h"
#include "main_window.h"
#include "toolbar.h"
@@ -74,7 +75,7 @@
gw = GnomeMeeting::Process ()->GetMainWindow ();
gnomemeeting_error_dialog (GTK_WINDOW (gm), _("Call transfer failed"), _("The call transfer failed, the user was either unreachable, or simply busy when he received the call transfer request."));
- gnomemeeting_log_insert (_("Call transfer failed"));
+ gnomemeeting_log_insert (gw->log_window, _("Call transfer failed"));
}
gdk_threads_leave ();
@@ -285,7 +286,10 @@
if (url.IsEmpty ()) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (_("No contact with speed dial %s# found, will call number %s instead"), (const char *) old_url.GetValidURL (), (const char *) (GMURL ().GetDefaultURL () + old_url.GetValidURL ()));
+ gnomemeeting_log_insert (gw->log_window,
+ _("No contact with speed dial %s# found, will call number %s instead"),
+ (const char *) old_url.GetValidURL (),
+ (const char *) (GMURL ().GetDefaultURL () + old_url.GetValidURL ()));
gnomemeeting_threads_leave ();
url = GMURL (GMURL ().GetDefaultURL () + old_url.GetValidURL ());
@@ -326,7 +330,7 @@
else
msg = g_strdup_printf (_("Transferring call to %s"),
(const char *) call_address);
- gnomemeeting_log_insert (msg);
+ gnomemeeting_log_insert (gw->log_window, msg);
gnomemeeting_statusbar_push (gw->statusbar, msg);
}
g_free (msg);
diff -urN gnomemeeting-cvs-20040409.CVS/src/videograbber.cpp gnomemeeting-cvs-20040409.CVS.patched/src/videograbber.cpp
--- gnomemeeting-cvs-20040409.CVS/src/videograbber.cpp 2004-04-07 10:08:13.000000000 +0200
+++ gnomemeeting-cvs-20040409.CVS.patched/src/videograbber.cpp 2004-04-12 12:36:10.000000000 +0200
@@ -43,7 +43,7 @@
#include "gnomemeeting.h"
#include "menu.h"
#include "misc.h"
-#include "tools.h"
+#include "log_window.h"
#include "dialog.h"
#include "gm_conf.h"
@@ -315,7 +315,10 @@
if (!no_device_found) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (_("Opening video device %s with plugin %s"), (const char *) input_device, (const char *) plugin);
+ gnomemeeting_log_insert (gw->log_window,
+ _("Opening video device %s with plugin %s"),
+ (const char *) input_device,
+ (const char *) plugin);
gnomemeeting_threads_leave ();
var_mutex.Wait ();
@@ -340,7 +343,10 @@
if (!error_code) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (_("Successfully opened video device %s, channel %d"), (const char *) input_device, channel);
+ gnomemeeting_log_insert (gw->log_window,
+ _("Successfully opened video device %s, channel %d"),
+ (const char *) input_device,
+ channel);
gnomemeeting_threads_leave ();
}
else {
@@ -354,7 +360,8 @@
/* Translators: Do not translate MovingLogo and Picture */
tmp_msg = g_strdup (_("A moving GnomeMeeting logo will be transmitted during calls. Notice that you can always transmit a given image or the moving GnomeMeeting logo by choosing \"Picture\" as video plugin and \"MovingLogo\" or \"StaticPicture\" as device."));
- gnomemeeting_log_insert (_("Couldn't open the video device"));
+ gnomemeeting_log_insert (gw->log_window,
+ _("Couldn't open the video device"));
switch (error_code) {
case 1:
@@ -417,7 +424,8 @@
grabber->SetFrameSizeConverter (width, height, FALSE);
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (_("Opened the video device using the \"Picture\" video plugin"));
+ gnomemeeting_log_insert (gw->log_window,
+ _("Opened the video device using the \"Picture\" video plugin"));
gnomemeeting_threads_leave ();
}
var_mutex.Signal ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]