Changelog for GKrellM Plugins


Changes for version 2.1.2 - 2.1.3

None

Changes for version 2.1.1

Users can set a theme scale. Buttons made with gkrellm_make_scaled_button() and krells are automatically theme scaled, but plugins that have their own multi frame decal images will need a code change if they want the decal image to be user scalable. This fragment shows a clean way to do it:
	gkrellm_load_piximae("foo", foo_xpm, &foo_piximage, FOO_STYLE_NAME);
#if defined(GKRELLM_HAVE_THEME_SCALE)
	/* New function scales to multiple of frame height and does not require
	|  the plugin to maintain a pixmap and mask.
	*/
	foo_decal = gkrellm_make_scaled_decal_pixmap(panel, foo_piximage, style,
	              N_FOO_FRAMES, -1, -1, 0, 0);
#else
	gkrellm_scale_piximage_to_pixmap(foo_piximage, &foo_pixmap,
	              &foo_mask, 0, 0);
	foo_decal = gkrellm_create_decal_pixmap(p, foo_pixmap, foo_mask,
	              N_FOO_FRAMES, style, -1, -1);
#endif
However, if the plugin needs to maintain the pixmap and mask, you can handle things yourself by scaling the decal frame height by the theme_scale value and then creating the pixmap height to be a multiple of the frame height:
#if defined(GKRELLM_HAVE_THEME_SCALE)
	h = gdk_pixbuf_get_height(foo_piximage->pixbuf) / N_FOO_FRAMES;
	h *= gkrellm_get_theme_scale();     /* New function */
	h *= N_FOO_FRAMES;
	w = -1;			/* Scales to drawn image size * theme_scale */
#else
	h = 0;             /* Will scale to drawn image size */
	w = 0;
#endif
	gkrellm_scale_piximage_to_pixmap(foo_piximage, &foo_pixmap,
	              &foo_mask, w, h);
	foo_decal = gkrellm_create_decal_pixmap(panel, foo_pixmap, foo_mask,
	              N_FOO_FRAMES, style, -1, -1);
Code that places decals relative to margins or to other decal/krell positions and sizes should be fine, but if you place at hardwired locations, the x,y location values might need to be scaled by gkrellm_get_theme_scale() for things to look right when the user changes the theme scale.

Changes for version 2.1.0

There is an issue with the new theming features in 2.1.0. There are only two defined monitor types (chart and meter), but some monitors are hybrids. The new spacer and cap theme images are applied based on monitor type, but for hybrid monitors there is no way for gkrellm to determine which images should really be used. So there is a new function:
gkrellm_spacers_set_types(GkrellmMonitor *mon, gint top, gint bottom);
where top and bottom are GKRELLM_SPACER_CHART or GKRELLM_SPACER_METER. Hybrid monitors can now make this call to let gkrellm know what it is doing. See the builtin mem.c and my plugin gkrellmss (version 2.1) for examples of its usage.

Changes for version 2.0.4

None.

Changes for version 2.0.3

Changes for version 2.0.1 - 2.0.2

None.

Changes for version 2.0.0

See the gkrellm-2.0 porting guide.

Changes for version 1.2.10 - 1.2.11

None.

Changes for version 1.2.9

Some added functions (see the Plugin Programmers Reference for more functions):

Style   *gkrellm_meter_style_by_name(gchar *name);
Style   *gkrellm_panel_style_by_name(gchar *name);
Style   *gkrellm_chart_style_by_name(gchar *name);
	
which provide for using a custom style with values set with StyleMeter or StylePanel lines in the gkrellmrc. If you have extra krells you want to allow to be themed, this can clean up your code by eliminating a bunch of gkrellm_get_gkrellmrc_integer() or gkrellm_get_gkrellmrc_string() calls. See the Themes file and gkrellmss.c in GKrellMSS 0.4 (when I release it) for a working example of this.

Style margin changes for more layout control. Usually these will be set by a theme author in the gkrellmrc:

Changes for version 1.2.6 - 1.2.8

None.

Changes for version 1.2.5

Added some functions.

void    gkrellm_set_krell_expand(Style *, gchar *);
void    gkrellm_insert_krell_nth(Panel *, Krell *, gint);
void    gkrellm_insert_decal_nth(Panel *, Decal *, gint);
gboolean gkrellm_in_decal(Decal *, GdkEventButton *);
void    gkrellm_decal_button_connect(DecalButton *, void (*func)(), void *);
void    gkrellm_decal_button_right_connect(DecalButton *, void (*func)(), void *);
void    gkrellm_set_button_sensitive(DecalButton *, gboolean);
void    gkrellm_hide_button(DecalButton *);
void    gkrellm_show_button(DecalButton *);
	
The DecalButton callback function prototype adds a "gpointer data" so you don't have to reference button->data.

Changes for version 1.2.3 - 1.2.4

None.

Changes for version 1.2.2

Added some functions. Some of them are (for controlling decals and krells):

void          gkrellm_set_krell_margins(Panel *, Krell *k, gint, gint);
void          gkrellm_move_krell_yoff(Panel *, Krell *, gint);
void          gkrellm_draw_decal_on_chart(Chart *, Decal *, gint, gint);
void          gkrellm_move_decal(Panel *, Decal *, gint, gint);
void          gkrellm_decal_on_top_layer(Decal *, gboolean);
	

Changes for version 1.2.1

None.

Changes for version 1.2.0

Any plugin using charts will require coding changes and a recompile. Charts are now automatically user configurable with a right click on a chart. There are too many new functions to cover here, so look over the updated plugin programmers reference and especially the chart demo1.c program. All of the "chartconfig" and "chartdata" functions are new. The create and destroy functions are changed to gkrellm_chart_create() and gkrellm_chart_destroy(). You should no longer do awkward settings such as chart->previous = blah (use gkrellm_monotonic_chartdata()) or chart->scale_max = 0 (chart scaling is now handled properly) A couple of key points to note are: Plugins that use panels do not require a recompile, but I've made the chart and panel coding styles cleaner and more consistent by adding some functions you should migrate to. When you do, your plugin will depend on GKrellM version >= 1.2.0. These are for coding cleanups and some new functions:

Changes for version 1.0.8

None

Changes for version 1.0.7

None

Changes for version 1.0.6

/usr/lib/gkrellm/plugins and /usr/local/lib/gkrellm/plugins are now also searched to comply with the FHS.

Changes for version 1.0.5

None

Changes for version 1.0.4

Looking ahead a bit (some months?) when I get to 1.1.0 I want the gkrellm namespace to be cleaned up. I'm defining that to mean that if you do a "nm -u plugin.so" the undefined symbols expected to link to gkrellm will be only GK and gkrellm_XXX symbols. Starting with 1.0.4 gkrellm_private_proto.h is no longer included by gkrellm.h and it is not installed in the include directory. I have temporarily moved some symbols affecting a few plugins from private to public proto.h. I hope I moved enough so that all current plugins I know of will still compile. The plan is when 1.1.0 arrives I will do the "Cut Here" at the bottom of gkrellm_public_proto.h, so source will need to be in sync by then.
To check if you need changes, #ifdef out the part that will be cut and see if you get warnings compiling with -Wall.
If you have changes to make or want to use any new functions below, make your source dependent on version 1.0.4 as described in the changes for version 1.0.3.

Added some handy utility routines (most were already in gkrellm_private_proto.h without a gkrellm_ prefix):


	GtkWidget *gkrellm_create_tab(GtkWidget *, gchar *);
	gchar   *gkrellm_entry_get_text(GtkWidget **);
	void    gkrellm_spin_button(GtkWidget *, GtkWidget **, gfloat, gfloat, gfloat,
	                gfloat, gfloat, gint, gint, void (*func)(), gpointer, gboolean, gchar *);
	void    gkrellm_check_button(GtkWidget *, GtkWidget **, gboolean, gboolean, gint, gchar *);
	gchar   *gkrellm_homedir(void);
	gboolean gkrellm_dup_string(gchar **, gchar *);
	gchar   *gkrellm_make_config_file_name(gchar *, gchar *);
	struct tm *gkrellm_get_current_time();
	
Other uninteresting changes are: Added some session manager plugin helper functions so I could write the gkrellm-gnome plugin and exported sensor reading functions for special purpose sensor monitoring plugins.

Changes for version 1.0.3

Changes for version 1.0.0 - 1.0.2

None.

Changes for version 0.10.5

Added these routines: See the Plugins programmers reference for descriptions.

Changes for version 0.10.2 - 0.10.4

None.

Changes for version 0.10.1

Changes for version 0.10.0

Final release check list (some details are below):
Details
New functions (see plugin programmers reference):

gboolean gkrellm_load_image(gchar *name, gchar **xpm, GdkImlibImage **im, gchar *subdir);
gboolean gkrellm_set_image_border(gchar *name, gchar **xpm, Style *style);
gint     gkrellm_add_chart_style(Monitor *mon, gchar *name);
gint     gkrellm_add_meter_style(Monitor *mon, gchar *name);
gint     gkrellm_lookup_chart_style_id(gchar *name);
gint     gkrellm_lookup_meter_style_id(gchar *name);
gchar    *gkrellm_get_theme_path(void);
void     gkrellm_add_info_text_string(GtkWidget *text, gchar *string);
The GK structure is changing. It has always been the case that the only safe parts of GK to access are the debug and xxx_tick parts. If any plugin directly accesses the structure (does not use the gkrellm_XXX() helper functions) for image or style pointers it's pretty certain it will break. Also, even if you did use gkrellm_XXX() functions to access images or styles for other monitors (not the DEFAULT_STYLE) you will now get unexpected results (but should not crash). Use the gkrellm_lookup_xxxx_style_id() functions to get a style_id for other monitors. Some other references are OK for now, like GK.theme_path, but should be changed to the new gkrellm_get_theme_path() under 0.10.0 (but consider using the new gkrellm_load_image() function so you don't have to do any theme path processing at all).

Code references like these are a problem:

    GK.XXX_style[id]      where XXX is chart, panel, or meter.
    GK.bg_XXX_image[id]   where XXX is chart, panel, meter, or grid.
    GK.krell_XXX_image[]  where XXX is panel or meter
    GK.monitor_height += p->h;
    UC.chart_width
    GK.decal_misc_pixmap
    some_function(XXX_STYLE) where XXX is APM, FS, CLOCK, CAL, etc.
Fix them like this:
    gkrellm_XXX_style(id);
    gkrellm_bg_XXX_image(id);
    gkrellm_krell_XXX_image(id);
    gkrellm_monitor_height_adjust(h);
    gkrellm_chart_width();
    gkrellm_decal_misc_pixmap();
    some_function(gkrellm_lookup_meter_style_id(XXX_STYLE_NAME));
See the plugin programmers reference. It has updated documentation on the above new calls and the demo programs are updated as well. The short story is plugins can now be themed at the same level as builtins. Check the Styles and Themes section.

Here's something that might help:

Changes for version 0.9.9

Not much new for this release. About the only thing is I have followed the lead of several plugins and added a global function to get the nice bold (and added italic) text into the Info/Help pages. You can use it if you want or keep doing it the way you have been, but one benefit is that I have an alternate larger font size the user can select if he wants. Just insert <b> for bold or <i> for bold italic in front of strings in a string array, like this:

gchar	*info_text[] =
    {
    "<b>The first ",
    "two words of this line are bold\n"
    "and the last two words of this line ",
    "<i>are italic\n"
    };
...
GtkWidget *text;

...
text = gtk_text_new(NULL, NULL);
gkrellm_add_info_text(text, info_text, sizeof(info_text) / sizeof(gchar *));
...
If you look at the GKrellM source you will notice _( ) and N_( ) macros around text strings. There has been some interest in internationalizing the program (Turbolinux Japan) and these macros support that. I don't know if this will extend to the plugins, so my suggestion is do whatever you feel comfortable with (the macros are a no-op unless i18n is enabled). If you choose to do this, then the above info_text declaration would look like:

gchar	*info_text[] =
    {
    N_("<b>The first "),
    N_("two words of this line are bold\n"
    "and the last two words of this line "),
    N_("<i>are italic\n")
    };
I'm giving some thought to a way for plugins to have custom theme images (as do the builtins), but did not get to it for this release. Maybe next time.

Changes for version 0.9.8

Changes for version 0.9.7

Changes for version 0.9.6

As of 0.9.6 I want to make name changes (and one prototype change) for these four routines. But for several versions, I'll keep them around to avoid breaking plugins.


Decal   *gkrellm_create_text_decal(Panel *p, gchar *, TextStyle *, Style *, gint, gint, gint);
Decal   *gkrellm_create_pixmap_decal(Panel *, GdkPixmap *, GdkBitmap *, gint, Style *);
void    gkrellm_draw_pixmap_decal(Panel *, Decal *, gint);
void    gkrellm_draw_text_decal(Panel *, Decal *, gchar *, gint);

They are changed to:

Decal   *gkrellm_create_decal_text(Panel *p, gchar *, TextStyle *, Style *, gint, gint, gint);
Decal   *gkrellm_create_decal_pixmap(Panel *, GdkPixmap *, GdkBitmap *, gint, Style *, gint, gint);
void    gkrellm_draw_decal_pixmap(Panel *, Decal *, gint);
void    gkrellm_draw_decal_text(Panel *, Decal *, gchar *, gint);
Plugins writers should migrate these four routines at their convenience. This is simply done by replacing the names, and in the case of gkrellm_create_decal_pixmap(), the following two calls are equivalent:

    gkrellm_create_pixmap_decal(p, pixmap, mask, depth, style);
    gkrellm_create_decal_pixmap(p, pixmap, mask, depth, style, -1, -1);

Changes for version 0.9.0

The API for plugins is changed for version 0.9.0. There are a few prototype changes and coding style changes. One change is necessary because GKrellM now resizes and changes themes without restarting. This changes the create_plugin() routine from a one time create function to a create event function which can be repeatedly called.

-------------------------------------------------------------------
Coding style change: create_plugin() 

-------------The old style--------------:

static void
create_plugin(GtkWidget *vbox)
	{
	Chart	*chart;
	Panel	*p;

	chart = gkrellm_chart_new0();
	p = chart->panel = gkrellm_panel_new();
	...

	/* Create decals, krells. Configure panel, create panel, create chart */
	...

	gtk_signal_connect(GTK_OBJECT(p->drawing_area), "expose_event",
			(GtkSignalFunc) panel_expose_event, NULL);
	gtk_signal_connect(GTK_OBJECT(chart->drawing_area),"expose_event",
			(GtkSignalFunc) chart_expose_event, NULL);
	}

--------------The new style-------------:

static void
create_plugin(GtkWidget *vbox, gint first_create)
	{
	Chart	*chart;
	Panel	*p;

	if (first_create)
		{
		chart = gkrellm_chart_new0();
		p = chart->panel = gkrellm_panel_new();
		}
	else
		{
		gkrellm_destroy_krell_list(p);
		gkrellm_destroy_decal_list(p);
		}
	...

	/* Create decals, krells. Configure panel, create panel, create chart
	|  just as before.
	|
	| If you create any local pixmaps, widgets, etc you should destroy
	| them or not create them again if this is not the first_create to
	| avoid memory leaks.  You could test for first_create or objects != NULL.
	| See the plugin_example.c for code marked with MMM.
	*/
	...

	if (first_create)
		{
		gtk_signal_connect(GTK_OBJECT(p->drawing_area), "expose_event",
				(GtkSignalFunc) panel_expose_event, NULL);
		gtk_signal_connect(GTK_OBJECT(chart->drawing_area),"expose_event",
				(GtkSignalFunc) chart_expose_event, NULL);
		}
	}



================================================================
Coding style change: panel decal and krell lists are now a GList.

-------------The old style--------------:
Krell *k;

for (k = chart->panel->krell; k; k = k->next)
	{
	...
	}

-------------The new style--------------:
Krell   *k;
GList   *list;

for (list = chart->panel->krell; list; list = list->next)
	{
	k = (Krell *) list->data;
	...
	}

Same change for panel->decal.



================================================================
Coding style change: gkrellm_default_textstyle() function defunct:

-------------The old function--------------:
gkrellm_default_textstyle(p->textstyle, TEXTSTYLE_XXX, style);

-------------Is replaced with several functions--------------:
p->textstyle = gkrellm_panel_textstyle(DEFAULT_STYLE);
p->textstyle = gkrellm_chart_textstyle(DEFAULT_STYLE);
p->textstyle = gkrellm_meter_textstyle(DEFAULT_STYLE);
p->textstyle = gkrellm_chart_alt_textstyle(DEFAULT_STYLE);
p->textstyle = gkrellm_panel_alt_textstyle(DEFAULT_STYLE);
p->textstyle = gkrellm_meter_alt_textstyle(DEFAULT_STYLE);

Use these functions in context.  If you have created a chart with panel
and want to write text on the panel, use gkrellm_panel_textstyle().


================================================================
Function prototype changes (see gkrellm_public_proto.h):

Change gkrellm_create_krell() calls from:
	k = gkrellm_create_krell(krell_image, &p->krell, style);
to
	k = gkrellm_create_krell(p, krell_image, style);


Change gkrellm_create_xxx_decal() calls from:
	d = gkrellm_create_text_decal(label, TEXTSTYLE_XXX, &p->decal,
					style, x, y, w);
	d = gkrellm_create_pixmap_decal(pixmap, mask, n_decals, &p->decal, style);
to
	d = gkrellm_create_text_decal(p, label, textstyle, style, x, y, w);
	d = gkrellm_create_pixmap_decal(p, pixmap, mask, n_decals, style);


================================================================
Monitor structure change:
The pre-spacer and post-spacer members are gone.  There is no longer
a bg_spacer.



=================================================================
Notes:
If you create a krell you can reference it later in two ways (if
it is only a single krell in a panel or meter area):

1) save a pointer to the created krell, and reference that:
	my_krell = gkrellm_create_krell(p, krell_image, style);
	my_krell->full_scale = xx;

2) Don't save a pointer and reference the krell from the GList:
	gkrellm_create_krell(p, krell_image, style);
	KRELL(p)->full_scale = xx;

   Note that in this case you cannot use the old reference style:
	p->krell->full_scale = xx;

If you have more than one krell per panel or meter area, use the first
referencing method, save pointers to all the krells you create.

The same two referencing examples apply to decals as well.


=================================================================
New:
Decals can be converted to buttons.  The plugins_example.c now
creates two decal buttons, so look there.