Mercurial > pidgin
changeset 12838:cb36bc2db7c5
[gaim-migrate @ 15186]
Adding a log-displaying signal. I'm using this in a patch I'm writing for gaim-encryption.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Wed, 11 Jan 2006 23:26:51 +0000 |
parents | 1096bdfef887 |
children | 2bf82fdddf5e |
files | doc/Makefile.am doc/gtklog-signals.dox plugins/ChangeLog.API src/gtklog.c src/gtklog.h src/gtkmain.c |
diffstat | 6 files changed, 87 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/Makefile.am Wed Jan 11 23:23:38 2006 +0000 +++ b/doc/Makefile.am Wed Jan 11 23:26:51 2006 +0000 @@ -18,6 +18,7 @@ gtkaccount-signals.dox \ gtkblist-signals.dox \ gtkconv-signals.dox \ + gtklog-signals.dox \ gtkimhtml-signals.dox \ gtkrc-2.0 \ log-signals.dox \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/gtklog-signals.dox Wed Jan 11 23:26:51 2006 +0000 @@ -0,0 +1,20 @@ +/** @page gtklog-signals GtkLog Signals + + @signals + @signal log-displaying + @endsignals + + <hr> + + @signaldef log-displaying + @signalproto +void (*log_displaying)(GaimGtkLogViewer *viewer, GaimLog *log); + @endsignalproto + @signaldesc + Emitted when a log is being displayed. + @param viewer The log viewer + @param log The log being displayed + @endsignaldef + +*/ +// vim: syntax=c tw=75 et
--- a/plugins/ChangeLog.API Wed Jan 11 23:23:38 2006 +0000 +++ b/plugins/ChangeLog.API Wed Jan 11 23:26:51 2006 +0000 @@ -226,6 +226,9 @@ * GAIM_SUBTYPE_LOG * gaim_marshal_POINTER__POINTER_POINTER * gaim_utf8_ncr_encode() + * gaim_gtk_log_init() + * gaim_gtk_log_get_handle() + * gaim_gtk_log_uninit() Signals - Changed: (See the Doxygen docs for details on all signals.) * Signal propagation now stops after a handler returns a non-NULL value. @@ -269,9 +272,10 @@ * "buddy-status-changed" * "buddy-idle-changed": A buddy's idle status changed. * "buddy-icon-changed" + * "displaying-userinfo" * "gtkblist-hiding" * "gtkblist-unhiding" - * "displaying-userinfo" + * "log-displaying" Signals - Removed: * "account-away": replaced by account-status-changed
--- a/src/gtklog.c Wed Jan 11 23:23:38 2006 +0000 +++ b/src/gtklog.c Wed Jan 11 23:26:51 2006 +0000 @@ -174,7 +174,7 @@ } static void log_select_cb(GtkTreeSelection *sel, GaimGtkLogViewer *viewer) { - GtkTreeIter iter; + GtkTreeIter iter; GValue val; GtkTreeModel *model = GTK_TREE_MODEL(viewer->treestore); GaimLog *log = NULL; @@ -231,6 +231,9 @@ gtk_imhtml_clear(GTK_IMHTML(viewer->imhtml)); gtk_imhtml_set_protocol_name(GTK_IMHTML(viewer->imhtml), gaim_account_get_protocol_name(log->account)); + + gaim_signal_emit(gaim_gtk_log_get_handle(), "log-displaying", viewer, log); + gtk_imhtml_append_text(GTK_IMHTML(viewer->imhtml), read, GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_SCROLL | ((flags & GAIM_LOG_READ_NO_NEWLINE) ? GTK_IMHTML_NO_NEWLINE : 0)); @@ -572,3 +575,34 @@ syslog_viewer = display_log_viewer(NULL, logs, _("System Log"), NULL, 0); } + +/**************************************************************************** + * GTK+ LOG SUBSYSTEM ******************************************************* + ****************************************************************************/ + +void * +gaim_gtk_log_get_handle(void) +{ + static int handle; + + return &handle; +} + +void gaim_gtk_log_init(void) +{ + void *handle = gaim_gtk_log_get_handle(); + + gaim_signal_register(handle, "log-displaying", + gaim_marshal_VOID__POINTER_POINTER, + NULL, 2, + gaim_value_new(GAIM_TYPE_BOXED, + "GaimGtkLogViewer *"), + gaim_value_new(GAIM_TYPE_SUBTYPE, + GAIM_SUBTYPE_LOG)); +} + +void +gaim_gtk_log_uninit(void) +{ + gaim_signals_unregister_by_instance(gaim_gtk_log_get_handle()); +}
--- a/src/gtklog.h Wed Jan 11 23:23:38 2006 +0000 +++ b/src/gtklog.h Wed Jan 11 23:26:51 2006 +0000 @@ -56,4 +56,28 @@ void gaim_gtk_syslog_show(void); +/**************************************************************************/ +/** @name GTK+ Log Subsystem */ +/**************************************************************************/ +/*@{*/ + +/** + * Initializes the GTK+ log subsystem. + */ +void gaim_gtk_log_init(void); + +/** + * Returns the GTK+ log subsystem handle. + * + * @return The GTK+ log subsystem handle. + */ +void *gaim_gtk_log_get_handle(void); + +/** + * Uninitializes the GTK+ log subsystem. + */ +void gaim_gtk_log_uninit(void); + +/*@}*/ + #endif
--- a/src/gtkmain.c Wed Jan 11 23:23:38 2006 +0000 +++ b/src/gtkmain.c Wed Jan 11 23:26:51 2006 +0000 @@ -50,6 +50,7 @@ #include "gtkft.h" #include "gtkmedia.h" #include "gtkidle.h" +#include "gtklog.h" #include "gtknotify.h" #include "gtkplugin.h" #include "gtkpounce.h" @@ -257,6 +258,7 @@ gaim_gtk_privacy_init(); gaim_gtk_xfers_init(); gaim_gtk_roomlist_init(); + gaim_gtk_log_init(); #ifdef HAVE_VV gaim_gtk_media_init(); #endif