- 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:
Stefan Gehn 2008-12-26 10:47:29 +00:00
parent eb074fa36e
commit 0d35922472
8 changed files with 82 additions and 31 deletions

View File

@ -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);
}

View File

@ -65,5 +65,10 @@ void win32_init_callbacks(void)
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;
}

View File

@ -67,6 +67,11 @@ typedef struct
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;

View File

@ -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);
}
}

View File

@ -44,5 +44,6 @@
* 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

View File

@ -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);
}

View File

@ -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()

View File

@ -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;