- Add gkrellm_debugv() function to fix gkrellm_debug() for win32-plugins. Forwarding var args is not possible with plain C
This commit is contained in:
parent
eb074fa36e
commit
0d35922472
|
@ -85,3 +85,18 @@ GkrellmdTicks * gkrellmd_ticks(void)
|
|||
gint gkrellmd_get_timer_ticks(void)
|
||||
{return cb->gkrellmd_get_timer_ticks();}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// new since 2.3.2
|
||||
|
||||
void gkrellm_debug(guint debug_level, const gchar *format, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, format);
|
||||
cb->gkrellm_debugv(debug_level, format, arg);
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
void gkrellm_debugv(guint debug_level, const gchar *format, va_list arg)
|
||||
{
|
||||
cb->gkrellm_debugv(debug_level, format, arg);
|
||||
}
|
||||
|
|
|
@ -33,12 +33,12 @@ void win32_init_callbacks(void)
|
|||
gkrellmd_callbacks.gkrellmd_serve_data = gkrellmd_serve_data;
|
||||
gkrellmd_callbacks.gkrellmd_add_serveflag_done = gkrellmd_add_serveflag_done;
|
||||
gkrellmd_callbacks.gkrellmd_check_client_version = gkrellmd_check_client_version;
|
||||
|
||||
gkrellmd_callbacks.gkrellmd_config_getline = gkrellmd_config_getline;
|
||||
|
||||
|
||||
gkrellmd_callbacks.gkrellmd_config_getline = gkrellmd_config_getline;
|
||||
|
||||
gkrellmd_callbacks.gkrellmd_client_input_connect = gkrellmd_client_input_connect;
|
||||
|
||||
|
||||
|
||||
|
||||
/* Small set of useful functions duplicated from src/utils.c.
|
||||
| These really should just be in the gkrellm_ namespace for sysdep code
|
||||
| common to gkrellm and gkrellmd, but for convenience, offer them in
|
||||
|
@ -48,22 +48,27 @@ void win32_init_callbacks(void)
|
|||
gkrellmd_callbacks.gkrellmd_getline_from_gstring = gkrellmd_getline_from_gstring;
|
||||
gkrellmd_callbacks.gkrellmd_dup_token = gkrellmd_dup_token;
|
||||
gkrellmd_callbacks.gkrellmd_dup_string = gkrellmd_dup_string;
|
||||
|
||||
|
||||
gkrellmd_callbacks.gkrellm_free_glist_and_data = gkrellm_free_glist_and_data;
|
||||
gkrellmd_callbacks.gkrellm_getline_from_gstring = gkrellm_getline_from_gstring;
|
||||
gkrellmd_callbacks.gkrellm_dup_token = gkrellm_dup_token;
|
||||
gkrellmd_callbacks.gkrellm_dup_string = gkrellm_dup_string;
|
||||
|
||||
|
||||
|
||||
|
||||
/* Plugins should use above data serve functions instead of this.
|
||||
*/
|
||||
gkrellmd_callbacks.gkrellmd_send_to_client = gkrellmd_send_to_client;
|
||||
|
||||
|
||||
|
||||
|
||||
/* Misc
|
||||
*/
|
||||
gkrellmd_callbacks.gkrellmd_add_mailbox = gkrellmd_add_mailbox;
|
||||
gkrellmd_callbacks.gkrellmd_ticks = gkrellmd_ticks;
|
||||
gkrellmd_callbacks.gkrellmd_get_timer_ticks = gkrellmd_get_timer_ticks;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// new since 2.3.2
|
||||
|
||||
gkrellmd_callbacks.gkrellm_debugv = gkrellm_debugv;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,12 +34,12 @@ typedef struct
|
|||
void (*gkrellmd_serve_data)(GkrellmdMonitor *mon, gchar *line);
|
||||
void (*gkrellmd_add_serveflag_done)(gboolean *);
|
||||
gboolean (*gkrellmd_check_client_version)(GkrellmdMonitor *mon, gint major, gint minor, gint rev);
|
||||
|
||||
|
||||
const gchar *(*gkrellmd_config_getline)(GkrellmdMonitor *mon);
|
||||
|
||||
|
||||
void (*gkrellmd_client_input_connect)(GkrellmdMonitor *mon, void (*func)(GkrellmdClient *, gchar *));
|
||||
|
||||
|
||||
|
||||
|
||||
/* Small set of useful functions duplicated from src/utils.c.
|
||||
| These really should just be in the gkrellm_ namespace for sysdep code
|
||||
| common to gkrellm and gkrellmd, but for convenience, offer them in
|
||||
|
@ -49,30 +49,35 @@ typedef struct
|
|||
gboolean (*gkrellmd_getline_from_gstring)(GString **, gchar *, gint);
|
||||
gchar * (*gkrellmd_dup_token)(gchar **string, gchar *delimeters);
|
||||
gboolean (*gkrellmd_dup_string)(gchar **dst, gchar *src);
|
||||
|
||||
|
||||
void (*gkrellm_free_glist_and_data)(GList **list_head);
|
||||
gboolean (*gkrellm_getline_from_gstring)(GString **, gchar *, gint);
|
||||
gchar* (*gkrellm_dup_token)(gchar **string, gchar *delimeters);
|
||||
gboolean (*gkrellm_dup_string)(gchar **dst, gchar *src);
|
||||
|
||||
|
||||
|
||||
|
||||
/* Plugins should use above data serve functions instead of this.
|
||||
*/
|
||||
gint (*gkrellmd_send_to_client)(GkrellmdClient *client, gchar *buf);
|
||||
|
||||
|
||||
|
||||
|
||||
/* Misc
|
||||
*/
|
||||
void (*gkrellmd_add_mailbox)(gchar *);
|
||||
GkrellmdTicks * (*gkrellmd_ticks)(void);
|
||||
gint (*gkrellmd_get_timer_ticks)(void);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// new since 2.3.2
|
||||
|
||||
// gkrellm_debug is not called from libgkrellm, only gkrellm_debugv
|
||||
void (*gkrellm_debugv)(guint debug_level, const gchar *format, va_list arg);
|
||||
|
||||
} win32_plugin_callbacks;
|
||||
|
||||
|
||||
/// part of win32-plugin.c
|
||||
///
|
||||
///
|
||||
extern win32_plugin_callbacks gkrellmd_callbacks;
|
||||
|
||||
|
||||
|
|
|
@ -298,3 +298,12 @@ gkrellm_debug(guint debug_level, const gchar *format, ...)
|
|||
va_end(varargs);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gkrellm_debugv(guint debug_level, const gchar *format, va_list arg)
|
||||
{
|
||||
if (_GK.debug_level & debug_level)
|
||||
{
|
||||
g_logv(NULL, G_LOG_LEVEL_DEBUG, format, arg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,10 +39,11 @@
|
|||
|
||||
/**
|
||||
* @brief Prints our and/or logs a debug message.
|
||||
*
|
||||
*
|
||||
* If a logfile was set @see gkrellm_log_set_filename() the message will
|
||||
* be logged into the logfile as well.
|
||||
**/
|
||||
**/
|
||||
void gkrellm_debug(guint debug_level, const gchar *format, ...);
|
||||
void gkrellm_debugv(guint debug_level, const gchar *format, va_list arg);
|
||||
|
||||
#endif //GK_LOG_H
|
||||
|
|
|
@ -1519,24 +1519,39 @@ gboolean gkrellm_client_send_to_server(gchar *key_name, gchar *line)
|
|||
GkrellmDecal *gkrellm_create_decal_text_markup(GkrellmPanel *p, gchar *string, GkrellmTextstyle *ts, GkrellmStyle *style, gint x, gint y, gint w)
|
||||
{return callbacks->gkrellm_create_decal_text_markup(p,string,ts,style,x,y,w);}
|
||||
void gkrellm_decal_text_markup_insert(GkrellmDecal *d, gchar *s, GkrellmTextstyle *ts, gint x_off, gint y_off)
|
||||
{return callbacks->gkrellm_decal_text_markup_insert(d,s,ts,x_off,y_off);}
|
||||
{callbacks->gkrellm_decal_text_markup_insert(d,s,ts,x_off,y_off);}
|
||||
|
||||
void gkrellm_decal_text_nth_inserted_set_offset(GkrellmDecal *d, gint n, gint x_off, gint y_off)
|
||||
{return callbacks->gkrellm_decal_text_nth_inserted_set_offset(d, n, x_off, y_off);}
|
||||
{callbacks->gkrellm_decal_text_nth_inserted_set_offset(d, n, x_off, y_off);}
|
||||
void gkrellm_decal_text_nth_inserted_get_offset(GkrellmDecal *d, gint n, gint *x_off, gint *y_off)
|
||||
{return callbacks->gkrellm_decal_text_nth_inserted_get_offset(d,n,x_off,y_off);}
|
||||
{callbacks->gkrellm_decal_text_nth_inserted_get_offset(d,n,x_off,y_off);}
|
||||
void gkrellm_config_instant_apply(GkrellmMonitor *mon)
|
||||
{return callbacks->gkrellm_config_instant_apply(mon);}
|
||||
{callbacks->gkrellm_config_instant_apply(mon);}
|
||||
GtkTreeSelection *gkrellm_gtk_scrolled_selection(GtkTreeView *treeview, GtkWidget *box, GtkSelectionMode s_mode, GtkPolicyType h_policy, GtkPolicyType v_policy, void (*func_cb)(), gpointer data)
|
||||
{return callbacks->gkrellm_gtk_scrolled_selection(treeview, box, s_mode, h_policy, v_policy, func_cb, data);}
|
||||
void gkrellm_text_markup_extents(PangoFontDescription *font_desc, gchar *text, gint len, gint *width, gint *height, gint *baseline, gint *y_ink)
|
||||
{return callbacks->gkrellm_text_markup_extents(font_desc, text, len, width, height, baseline, y_ink);}
|
||||
{callbacks->gkrellm_text_markup_extents(font_desc, text, len, width, height, baseline, y_ink);}
|
||||
gint gkrellm_gdk_string_markup_width(PangoFontDescription *d, gchar *s)
|
||||
{return callbacks->gkrellm_gdk_string_markup_width(d,s);}
|
||||
gint gkrellm_gdk_text_markup_width(PangoFontDescription *font_desc, const gchar *string, gint len)
|
||||
{return callbacks->gkrellm_gdk_text_markup_width(font_desc, string, len);}
|
||||
void gkrellm_gdk_draw_string_markup(GdkDrawable *drawable, PangoFontDescription *font, GdkGC *gc, gint x, gint y, gchar *string)
|
||||
{return callbacks->gkrellm_gdk_draw_string_markup(drawable, font, gc, x, y, string);}
|
||||
{callbacks->gkrellm_gdk_draw_string_markup(drawable, font, gc, x, y, string);}
|
||||
void gkrellm_gdk_draw_text_markup(GdkDrawable *drawable, PangoFontDescription *font, GdkGC *gc, gint x, gint y, gchar *string, gint len)
|
||||
{return callbacks->gkrellm_gdk_draw_text_markup(drawable, font, gc, x, y, string, len);}
|
||||
{callbacks->gkrellm_gdk_draw_text_markup(drawable, font, gc, x, y, string, len);}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// new since 2.3.2
|
||||
|
||||
void gkrellm_debug(guint debug_level, const gchar *format, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, format);
|
||||
callbacks->gkrellm_debugv(debug_level, format, arg);
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
void gkrellm_debugv(guint debug_level, const gchar *format, va_list arg)
|
||||
{
|
||||
callbacks->gkrellm_debugv(debug_level, format, arg);
|
||||
}
|
||||
|
|
|
@ -451,7 +451,7 @@ void win32_init_callbacks(void)
|
|||
//---------------------------------------------------------------------------
|
||||
// new since 2.3.2
|
||||
|
||||
gkrellm_callbacks.gkrellm_debug = gkrellm_debug;
|
||||
gkrellm_callbacks.gkrellm_debugv = gkrellm_debugv;
|
||||
|
||||
} // win32_init_callbacks()
|
||||
|
||||
|
|
|
@ -579,7 +579,8 @@ typedef struct
|
|||
//---------------------------------------------------------------------------
|
||||
// new since 2.3.2
|
||||
|
||||
void (*gkrellm_debug)(guint debug_level, const gchar *format, ...);
|
||||
// gkrellm_debug is not called from libgkrellm, only gkrellm_debugv
|
||||
void (*gkrellm_debugv)(guint debug_level, const gchar *format, va_list arg);
|
||||
|
||||
} win32_plugin_callbacks;
|
||||
|
||||
|
|
Loading…
Reference in New Issue