[GnomeMeeting-devel-list] [PATCH] gnomemeeting_log_insert cleaning
- From: PUYDT Julien <julien puydt laposte net>
- To: GnomeMeeting Devel Liste <gnomemeeting-devel-list gnome org>
- Subject: [GnomeMeeting-devel-list] [PATCH] gnomemeeting_log_insert cleaning
- Date: Wed, 21 Jan 2004 21:54:02 +0100
Hi,
the following patch does several (closely related) things:
* the gnomemeeting_log_insert function now lives in tools.* instead of
misc.* (it is just a move, the source didn't change on that part)(the
includes have been changed accordingly);
* the current function did take a text view as arguments, but it was the
same all over the place ; now it is not an argument anymore (all the
places that used the function where changed accordingly);
* some places in the code didn't use that function's formatting
features: now they do (little quirk: in lid.cpp [a place in the code I
can't test for lack of proper hardware], there are two places where I'm
not sure the pre-formatting in a msg outside a lock claim wasn't on
purpose to avoid problems -- search for "FIXME" in the patch).
Snark
diff -ur gnomemeeting-cvs-20040121.CVS/src/callbacks.cpp gnomemeeting-cvs-20040121.CVS.patched/src/callbacks.cpp
--- gnomemeeting-cvs-20040121.CVS/src/callbacks.cpp 2004-01-20 12:46:57.000000000 +0100
+++ gnomemeeting-cvs-20040121.CVS.patched/src/callbacks.cpp 2004-01-21 21:28:54.000000000 +0100
@@ -44,6 +44,7 @@
#include "gnomemeeting.h"
#include "menu.h"
#include "misc.h"
+#include "tools.h"
#include "urlhandler.h"
#include "gmentrydialog.h"
@@ -266,7 +267,7 @@
gtk_label_set_text_with_mnemonic (GTK_LABEL (child),
menu_suspend_msg);
- gnomemeeting_log_insert (gw->history_text_view, history_resume_msg);
+ gnomemeeting_log_insert (history_resume_msg);
gnomemeeting_statusbar_flash (gw->statusbar, history_resume_msg);
g_signal_handlers_block_by_func (G_OBJECT (b),
@@ -288,7 +289,7 @@
gtk_label_set_text_with_mnemonic (GTK_LABEL (child),
menu_resume_msg);
- gnomemeeting_log_insert (gw->history_text_view, history_suspend_msg);
+ gnomemeeting_log_insert (history_suspend_msg);
gnomemeeting_statusbar_flash (gw->statusbar, history_suspend_msg);
g_signal_handlers_block_by_func (G_OBJECT (b),
diff -ur gnomemeeting-cvs-20040121.CVS/src/config.cpp gnomemeeting-cvs-20040121.CVS.patched/src/config.cpp
--- gnomemeeting-cvs-20040121.CVS/src/config.cpp 2004-01-20 12:46:57.000000000 +0100
+++ gnomemeeting-cvs-20040121.CVS.patched/src/config.cpp 2004-01-21 21:28:54.000000000 +0100
@@ -360,8 +360,7 @@
ep->DisableH245Tunneling (!gconf_value_get_bool (entry->value));
gdk_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view,
- ep->IsH245TunnelingDisabled ()?
+ gnomemeeting_log_insert (ep->IsH245TunnelingDisabled ()?
_("H.245 Tunneling disabled"):
_("H.245 Tunneling enabled"));
gdk_threads_leave ();
@@ -391,8 +390,7 @@
ep->DisableH245inSetup (!gconf_value_get_bool (entry->value));
gdk_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view,
- ep->IsH245inSetupDisabled ()?
+ gnomemeeting_log_insert (ep->IsH245inSetupDisabled ()?
_("Early H.245 disabled"):
_("Early H.245 enabled"));
gdk_threads_leave ();
@@ -422,8 +420,7 @@
ep->DisableFastStart (!gconf_value_get_bool (entry->value));
gdk_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view,
- ep->IsFastStartDisabled ()?
+ gnomemeeting_log_insert (ep->IsFastStartDisabled ()?
_("Fast Start disabled"):
_("Fast Start enabled"));
gdk_threads_leave ();
@@ -610,14 +607,12 @@
if (mode == H323AudioCodec::AdaptiveSilenceDetection) {
mode = H323AudioCodec::NoSilenceDetection;
- gnomemeeting_log_insert (gw->history_text_view,
- _("Disabled Silence Detection"));
+ gnomemeeting_log_insert (_("Disabled Silence Detection"));
}
else {
mode = H323AudioCodec::AdaptiveSilenceDetection;
- gnomemeeting_log_insert (gw->history_text_view,
- _("Enabled Silence Detection"));
+ gnomemeeting_log_insert (_("Enabled Silence Detection"));
}
gdk_threads_leave ();
diff -ur gnomemeeting-cvs-20040121.CVS/src/connection.cpp gnomemeeting-cvs-20040121.CVS.patched/src/connection.cpp
--- gnomemeeting-cvs-20040121.CVS/src/connection.cpp 2004-01-20 12:46:57.000000000 +0100
+++ gnomemeeting-cvs-20040121.CVS.patched/src/connection.cpp 2004-01-21 21:28:54.000000000 +0100
@@ -42,6 +42,7 @@
#include "endpoint.h"
#include "gnomemeeting.h"
#include "misc.h"
+#include "tools.h"
#include "chat_window.h"
#include "main_window.h"
@@ -166,7 +167,7 @@
/* Update the GUI and menus wrt opened channels */
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ gnomemeeting_log_insert (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)
@@ -184,7 +185,6 @@
H323Channel::Directions dir)
{
GmWindow *gw = NULL;
- gchar *msg = NULL;
BOOL success = FALSE;
gw = GnomeMeeting::Process ()->GetMainWindow ();
@@ -196,18 +196,13 @@
will ..." or "Failure opening XXX for reception, will ..." where
XXX is for example GSM-06.10 */
if (!success) {
-
- msg =
- g_strdup_printf ((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_enter ();
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ 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_threads_leave ();
-
- g_free (msg);
}
return success;
@@ -321,7 +316,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 (gw->history_text_view, _("Call transfer failed"));
+ gnomemeeting_log_insert (_("Call transfer failed"));
gnomemeeting_threads_leave ();
}
diff -ur gnomemeeting-cvs-20040121.CVS/src/endpoint.cpp gnomemeeting-cvs-20040121.CVS.patched/src/endpoint.cpp
--- gnomemeeting-cvs-20040121.CVS/src/endpoint.cpp 2004-01-20 12:46:57.000000000 +0100
+++ gnomemeeting-cvs-20040121.CVS.patched/src/endpoint.cpp 2004-01-21 21:28:54.000000000 +0100
@@ -725,7 +725,7 @@
msg = g_strdup_printf (_("Call from %s"), (const char *) utf8_name);
gnomemeeting_threads_enter ();
gnomemeeting_statusbar_push (gw->statusbar, msg);
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ gnomemeeting_log_insert (msg);
gnomemeeting_threads_leave ();
g_free (msg);
@@ -783,7 +783,7 @@
/* Add the full message in the history */
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ gnomemeeting_log_insert (msg);
gnomemeeting_threads_leave ();
/* Free things, we will return */
@@ -885,7 +885,7 @@
msg = g_strdup_printf (_("Forwarding call to %s"),
(const char*) forward_party);
gnomemeeting_statusbar_push (gw->statusbar, msg);
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ gnomemeeting_log_insert (msg);
gnomemeeting_threads_leave ();
g_free (msg);
@@ -916,7 +916,6 @@
gchar *utf8_app = NULL;
gchar *utf8_name = NULL;
gchar *utf8_local_name = NULL;
- char *msg = NULL;
BOOL reg = FALSE;
#ifdef HAS_IXJ
@@ -942,10 +941,9 @@
/* Connected */
gnomemeeting_threads_enter ();
- msg = g_strdup_printf (_("Connected with %s using %s"),
- utf8_name, utf8_app);
gnomemeeting_statusbar_push (gw->statusbar, _("Connected"));
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ gnomemeeting_log_insert (_("Connected with %s using %s"),
+ utf8_name, utf8_app);
gnomemeeting_text_chat_call_start_notification ();
gtk_label_set_text (GTK_LABEL (gw->remote_name), (const char *) utf8_name);
@@ -1009,7 +1007,6 @@
if (reg)
ILSRegister ();
- g_free (msg);
g_free (utf8_name);
g_free (utf8_local_name);
g_free (utf8_app);
@@ -1230,7 +1227,7 @@
utf8_app);
- gnomemeeting_log_insert (gw->history_text_view, msg_reason);
+ gnomemeeting_log_insert (msg_reason);
gnomemeeting_text_chat_call_stop_notification ();
gnomemeeting_statusbar_flash (gw->statusbar, msg_reason);
gnomemeeting_threads_leave ();
@@ -1596,10 +1593,8 @@
BOOL sd = FALSE;
BOOL no_error = TRUE;
-
- gchar *msg = NULL;
-
+
/* Wait that the primary call has terminated (in case of transfer)
before opening the channels for the second call */
TransferCallWait ();
@@ -1645,9 +1640,7 @@
l->Unlock ();
gnomemeeting_threads_enter ();
- gchar *msg = g_strdup_printf (_("Attaching lid hardware to codec"));
- gnomemeeting_log_insert (gw->history_text_view, msg);
- g_free (msg);
+ gnomemeeting_log_insert (_("Attaching lid hardware to codec"));
gnomemeeting_threads_leave ();
}
else
@@ -1678,15 +1671,13 @@
/* Translators : the full sentence is "Opening %s for playing with
plugin %s" or "Opening %s for recording with plugin" */
- msg = g_strdup_printf (is_encoding ?
- _("Opened %s for recording with plugin %s")
- : _("Opened %s for playing with plugin %s"),
- (const char *) device, (const char *) plugin);
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ gnomemeeting_log_insert (is_encoding ?
+ _("Opened %s for recording with plugin %s")
+ : _("Opened %s for playing with plugin %s"),
+ (const char *) device, (const char *) plugin);
gnomemeeting_threads_leave ();
- g_free (msg);
/* Control the channel and attach it to the codec, do not
auto delete it */
@@ -2072,7 +2063,6 @@
H323Connection *connection = NULL;
- gchar *msg = NULL;
gchar *forward_host_gconf = NULL;
PString forward_host;
@@ -2114,12 +2104,10 @@
connection->ForwardCall (PString ((const char *) forward_host));
gdk_threads_enter ();
- msg = g_strdup_printf (_("Forwarding Call to %s (No Answer)"),
- (const char *) forward_host);
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ gnomemeeting_log_insert (_("Forwarding Call to %s (No Answer)"),
+ (const char *) forward_host);
gnomemeeting_statusbar_push (gw->statusbar, _("Call forwarded"));
- g_free (msg);
gdk_threads_leave ();
connection->Unlock ();
diff -ur gnomemeeting-cvs-20040121.CVS/src/gatekeeper.cpp gnomemeeting-cvs-20040121.CVS.patched/src/gatekeeper.cpp
--- gnomemeeting-cvs-20040121.CVS/src/gatekeeper.cpp 2004-01-20 12:46:57.000000000 +0100
+++ gnomemeeting-cvs-20040121.CVS.patched/src/gatekeeper.cpp 2004-01-21 21:28:54.000000000 +0100
@@ -42,6 +42,7 @@
#include "gatekeeper.h"
#include "gnomemeeting.h"
#include "misc.h"
+#include "tools.h"
#include "dialog.h"
#include "gconf_widgets_extensions.h"
@@ -127,7 +128,7 @@
gk_name = gatekeeper->GetName ();
msg = g_strdup_printf (_("Unregistered from gatekeeper %s"),
(const char *) gk_name);
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ gnomemeeting_log_insert (msg);
gnomemeeting_statusbar_flash (gw->statusbar, msg);
g_free (msg);
}
@@ -212,7 +213,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 (gw->history_text_view, msg);
+ gnomemeeting_log_insert (msg);
g_free (msg);
}
@@ -229,7 +230,7 @@
g_strdup_printf (_("Gatekeeper set to %s"), (const char *) gk_name);
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ gnomemeeting_log_insert (msg);
gnomemeeting_statusbar_flash (gw->statusbar, msg);
gnomemeeting_threads_leave ();
diff -ur gnomemeeting-cvs-20040121.CVS/src/gnomemeeting.cpp gnomemeeting-cvs-20040121.CVS.patched/src/gnomemeeting.cpp
--- gnomemeeting-cvs-20040121.CVS/src/gnomemeeting.cpp 2004-01-20 12:46:57.000000000 +0100
+++ gnomemeeting-cvs-20040121.CVS.patched/src/gnomemeeting.cpp 2004-01-21 21:28:54.000000000 +0100
@@ -185,8 +185,7 @@
if (endpoint->GetCallingState () == 3) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view,
- _("Answering incoming call"));
+ gnomemeeting_log_insert (_("Answering incoming call"));
connect_button_update_pixmap (GTK_TOGGLE_BUTTON (gw->connect_button), 1);
gnomemeeting_threads_leave ();
@@ -235,8 +234,7 @@
if (endpoint->GetCallingState () == 1) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view,
- _("Trying to stop calling"));
+ gnomemeeting_log_insert (_("Trying to stop calling"));
gnomemeeting_threads_leave ();
endpoint->ClearCall (endpoint->GetCurrentCallToken (), reason);
@@ -247,8 +245,7 @@
if (endpoint->GetCallingState () == 2) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view,
- _("Stopping current call"));
+ gnomemeeting_log_insert (_("Stopping current call"));
connect_button_update_pixmap (GTK_TOGGLE_BUTTON (gw->connect_button),
0);
gnomemeeting_threads_leave ();
@@ -258,8 +255,7 @@
else if (endpoint->GetCallingState () == 3) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view,
- _("Refusing Incoming call"));
+ gnomemeeting_log_insert (_("Refusing Incoming call"));
connect_button_update_pixmap (GTK_TOGGLE_BUTTON (gw->connect_button),
0);
gnomemeeting_threads_leave ();
@@ -419,7 +415,6 @@
void GnomeMeeting::BuildGUI ()
{
- gchar *msg = NULL;
bool show_splash = TRUE;
@@ -489,10 +484,8 @@
/* GM is started */
- msg = g_strdup_printf (_("Started GnomeMeeting V%d.%d for %s\n"),
- MAJOR_VERSION, MINOR_VERSION, g_get_user_name ());
- gnomemeeting_log_insert (gw->history_text_view, msg);
- g_free (msg);
+ gnomemeeting_log_insert (_("Started GnomeMeeting V%d.%d for %s\n"),
+ MAJOR_VERSION, MINOR_VERSION, g_get_user_name ());
}
diff -ur gnomemeeting-cvs-20040121.CVS/src/ils.cpp gnomemeeting-cvs-20040121.CVS.patched/src/ils.cpp
--- gnomemeeting-cvs-20040121.CVS/src/ils.cpp 2004-01-20 12:46:57.000000000 +0100
+++ gnomemeeting-cvs-20040121.CVS.patched/src/ils.cpp 2004-01-21 21:28:54.000000000 +0100
@@ -42,6 +42,7 @@
#include "gnomemeeting.h"
#include "ldap_window.h"
#include "misc.h"
+#include "tools.h"
#include "stock-icons.h"
#include "dialog.h"
@@ -293,7 +294,7 @@
msg = g_strdup_printf (_("Unregistered from the users directory %s."), ldap_server);
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ gnomemeeting_log_insert (msg);
g_free (msg);
gnomemeeting_threads_leave ();
}
@@ -314,7 +315,7 @@
gnomemeeting_threads_enter ();
msg = g_strdup_printf (_("Error while registering to %s."),
ldap_server);
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ gnomemeeting_log_insert (msg);
gnomemeeting_statusbar_flash (gw->statusbar, msg);
g_free (msg);
gnomemeeting_threads_leave ();
diff -ur gnomemeeting-cvs-20040121.CVS/src/lid.cpp gnomemeeting-cvs-20040121.CVS.patched/src/lid.cpp
--- gnomemeeting-cvs-20040121.CVS/src/lid.cpp 2004-01-20 12:46:58.000000000 +0100
+++ gnomemeeting-cvs-20040121.CVS.patched/src/lid.cpp 2004-01-21 21:39:01.000000000 +0100
@@ -43,6 +43,7 @@
#include "gnomemeeting.h"
#include "urlhandler.h"
#include "misc.h"
+#include "tools.h"
#include "main_window.h"
#include "pref_window.h"
#include "callbacks.h"
@@ -106,7 +107,6 @@
GMH323EndPoint *ep = NULL;
GmWindow *gw = NULL;
- gchar *msg = NULL;
gchar *lid_country = NULL;
int lid_aec = 0;
@@ -129,15 +129,11 @@
gnomemeeting_threads_leave ();
if (OpalIxJDevice::Open (dev_name)) {
-
- msg = g_strdup_printf (_("Opened Quicknet device %s"),
- (const char *) GetName ());
-
+
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ gnomemeeting_log_insert (_("Opened Quicknet device %s"),
+ (const char *) GetName ()); // FIXME: is it thread-safe!?
gnomemeeting_threads_leave ();
-
- g_free (msg);
if (lid_country)
SetCountryCodeName(lid_country);
@@ -175,7 +171,6 @@
GMLid::Close ()
{
GmWindow *gw = NULL;
- gchar *msg = NULL;
PWaitAndSignal m(device_access_mutex);
@@ -183,19 +178,14 @@
if (IsOpen ()) {
- msg =
- g_strdup_printf (_("Closed Quicknet device %s"),
- (const char *) GetName ());
-
OpalIxJDevice::Close ();
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ gnomemeeting_log_insert (_("Closed Quicknet device %s"),
+ (const char *) GetName ()); // FIXME: is it thread-safe?!
gnomemeeting_threads_leave ();
}
- g_free (msg);
-
return TRUE;
}
@@ -279,7 +269,7 @@
if (off_hook == TRUE && last_off_hook == FALSE) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view, _("Phone is off hook"));
+ gnomemeeting_log_insert (_("Phone is off hook"));
gnomemeeting_statusbar_flash (gw->statusbar, _("Phone is off hook"));
gnomemeeting_threads_leave ();
@@ -315,7 +305,7 @@
if (off_hook == FALSE && last_off_hook == TRUE) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view, _("Phone is on hook"));
+ gnomemeeting_log_insert (_("Phone is on hook"));
gnomemeeting_statusbar_flash (gw->statusbar, _("Phone is on hook"));
/* Remove the current called number */
diff -ur gnomemeeting-cvs-20040121.CVS/src/misc.cpp gnomemeeting-cvs-20040121.CVS.patched/src/misc.cpp
--- gnomemeeting-cvs-20040121.CVS/src/misc.cpp 2004-01-20 12:46:58.000000000 +0100
+++ gnomemeeting-cvs-20040121.CVS.patched/src/misc.cpp 2004-01-21 21:28:54.000000000 +0100
@@ -99,56 +99,6 @@
return button;
}
-
-void
-gnomemeeting_log_insert (GtkWidget *text_view,
- const char *format,
- ...)
-{
- va_list args;
-
- 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);
-}
-
-
void gnomemeeting_init_main_window_logo (GtkWidget *image)
{
GdkPixbuf *tmp = NULL;
diff -ur gnomemeeting-cvs-20040121.CVS/src/misc.h gnomemeeting-cvs-20040121.CVS.patched/src/misc.h
--- gnomemeeting-cvs-20040121.CVS/src/misc.h 2004-01-20 12:46:58.000000000 +0100
+++ gnomemeeting-cvs-20040121.CVS.patched/src/misc.h 2004-01-21 21:28:54.000000000 +0100
@@ -74,18 +74,6 @@
/* DESCRIPTION : /
- * BEHAVIOR : Add text (gchar *) with timestamps into the given
- * GtkTextView.
- * PRE : The text to add (printf compatible),
- * and the text view to add the text into.
- */
-void
-gnomemeeting_log_insert (GtkWidget *,
- const char *,
- ...);
-
-
-/* DESCRIPTION : /
* BEHAVIOR : Displays the gnomemeeting logo in the drawing area.
* PRE : The GtkImage where to put the logo (pixbuf).
*/
diff -ur gnomemeeting-cvs-20040121.CVS/src/tools.cpp gnomemeeting-cvs-20040121.CVS.patched/src/tools.cpp
--- gnomemeeting-cvs-20040121.CVS/src/tools.cpp 2004-01-20 12:46:58.000000000 +0100
+++ gnomemeeting-cvs-20040121.CVS.patched/src/tools.cpp 2004-01-21 21:28:54.000000000 +0100
@@ -660,3 +660,53 @@
return window;
}
+
+void
+gnomemeeting_log_insert (const char *format,
+ ...)
+{
+ va_list args;
+
+ GmWindow *gw = GnomeMeeting::Process ()->GetMainWindow ();
+ GtkWidget *text_view = gw->history_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 -ur gnomemeeting-cvs-20040121.CVS/src/tools.h gnomemeeting-cvs-20040121.CVS.patched/src/tools.h
--- gnomemeeting-cvs-20040121.CVS/src/tools.h 2004-01-20 12:46:58.000000000 +0100
+++ gnomemeeting-cvs-20040121.CVS.patched/src/tools.h 2004-01-21 21:28:54.000000000 +0100
@@ -83,4 +83,12 @@
*/
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 -ur gnomemeeting-cvs-20040121.CVS/src/urlhandler.cpp gnomemeeting-cvs-20040121.CVS.patched/src/urlhandler.cpp
--- gnomemeeting-cvs-20040121.CVS/src/urlhandler.cpp 2004-01-20 12:46:58.000000000 +0100
+++ gnomemeeting-cvs-20040121.CVS.patched/src/urlhandler.cpp 2004-01-21 21:28:54.000000000 +0100
@@ -75,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 (gw->history_text_view, _("Call transfer failed"));
+ gnomemeeting_log_insert (_("Call transfer failed"));
}
gdk_threads_leave ();
@@ -285,11 +285,9 @@
if (url.IsEmpty ()) {
- msg = g_strdup_printf (_("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_enter ();
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ 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_threads_leave ();
- g_free (msg);
url = GMURL (GMURL ().GetDefaultURL () + old_url.GetValidURL ());
}
@@ -329,7 +327,7 @@
else
msg = g_strdup_printf (_("Transferring call to %s"),
(const char *) call_address);
- gnomemeeting_log_insert (gw->history_text_view, msg);
+ gnomemeeting_log_insert (msg);
gnomemeeting_statusbar_push (gw->statusbar, msg);
}
g_free (msg);
diff -ur gnomemeeting-cvs-20040121.CVS/src/videograbber.cpp gnomemeeting-cvs-20040121.CVS.patched/src/videograbber.cpp
--- gnomemeeting-cvs-20040121.CVS/src/videograbber.cpp 2004-01-20 12:46:58.000000000 +0100
+++ gnomemeeting-cvs-20040121.CVS.patched/src/videograbber.cpp 2004-01-21 21:28:54.000000000 +0100
@@ -42,6 +42,7 @@
#include "videograbber.h"
#include "gnomemeeting.h"
#include "misc.h"
+#include "tools.h"
#include "dialog.h"
#include "gconf_widgets_extensions.h"
@@ -301,7 +302,7 @@
if (!no_device_found) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view, _("Opening video device %s with plugin %s"), (const char *) input_device, (const char *) plugin);
+ gnomemeeting_log_insert (_("Opening video device %s with plugin %s"), (const char *) input_device, (const char *) plugin);
gnomemeeting_threads_leave ();
var_mutex.Wait ();
@@ -326,7 +327,7 @@
if (!error_code) {
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view, _("Successfully opened video device %s, channel %d"), (const char *) input_device, channel);
+ gnomemeeting_log_insert (_("Successfully opened video device %s, channel %d"), (const char *) input_device, channel);
gnomemeeting_threads_leave ();
}
else {
@@ -340,8 +341,7 @@
/* 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 (gw->history_text_view,
- _("Couldn't open the video device"));
+ gnomemeeting_log_insert (_("Couldn't open the video device"));
switch (error_code) {
case 1:
@@ -404,7 +404,7 @@
grabber->SetFrameSizeConverter (width, height, FALSE);
gnomemeeting_threads_enter ();
- gnomemeeting_log_insert (gw->history_text_view, _("Opened the video device using the \"Picture\" video plugin"));
+ gnomemeeting_log_insert (_("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]