LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-30-2002, 02:51 PM   #1
iceman47
Senior Member
 
Registered: Oct 2002
Location: Belgium
Distribution: Debian, Free/OpenBSD
Posts: 1,123

Rep: Reputation: 47
earth_anim


I'm having trouble compiling that plugin for gkrellm earth_anim.
This is the error I'm getting when I run make:
(it's in Dutch but maybe you can see what I'm doing wrong here. thanks
Code:
...
earth_anim.c:170: parse-fout before '*' token
earth_anim.c:172: warning: return type defaults to `int'
earth_anim.c: In function `init_plugin':
earth_anim.c:173: warning: impliciete declaratie van functie `gkrellm_add_meter_style'
make: *** [earth_anim.o] Fout 1
 
Old 10-31-2002, 05:14 AM   #2
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
Nice mix of english and dutch error messages, makes it only more confusing if you ask me.
Anyways I would have to see the code to see what it's reporting about line 170. But an implicit declaration means it hasn't defined the function before it's being used. Usually this means it's not finding the right include file. You should find out where the function gkrellm_add_meter_style is defined and make sure it's able to include that file.
 
Old 10-31-2002, 06:46 AM   #3
iceman47
Senior Member
 
Registered: Oct 2002
Location: Belgium
Distribution: Debian, Free/OpenBSD
Posts: 1,123

Original Poster
Rep: Reputation: 47
Code:
/* earth_anim.c   displays a rotating image of the earth*/
/* Copyright (C) 2001 Brad Abel */

#include <gkrellm/gkrellm.h>
#include "earth_18.xpm"  /* edit this file to change image animation */
                         /* adjust the 4 defines below to match image. */ 
#define EARTH_PANEL_HEIGHT 54    /* height of panel image displays in */
#define FRAME_WIDTH 50
#define FRAME_HEIGHT 48
#define FRAMES_COUNT 18   /* no. of frames in image */
#define IMAGE_ARRAY_NAME earth_18_xpm  /* points to array in xpm image  file  
*/
                                       /* use text editor to view xpm file and 
*/
				       /* see what the array name is */
#define TTSPEED 1     /* raise this value to slow the animation a '2' would */ 
                      /* make it twice as slow*/
#define PLUGIN_PLACEMENT  (MON_MAIL | GRAVITY(0))
#define STYLE_NAME "earth"
#define PLUGIN_CONFIG_KEYWORD    "earth"
#define EARTH_ANIM_VERSION "0.3"

static Panel   *panel;
static gint    style_id;
static GdkPixmap *earth_image = NULL;
static Decal     *earth = NULL; 
static GdkBitmap *earth_mask = NULL;
int start_stop_anim_value = 0;

static void
load_animation()
{
    GdkImlibImage  *image = NULL;

    gkrellm_load_image(NULL, IMAGE_ARRAY_NAME, &image, NULL);
    gkrellm_render_to_pixmap(image, &earth_image, &earth_mask, 0, 0);
}

static gint
panel_expose_event(GtkWidget *widget, GdkEventExpose *ev)
{
    gdk_draw_pixmap(widget->window,
		    widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
		    panel->pixmap, ev->area.x, ev->area.y, ev->area.x, ev->area.y,
		    ev->area.width, ev->area.height);
    return FALSE;
}

static void
earth_update_plugin()
{
    static int frame_number;
    if (start_stop_anim_value == 1) return;

if ((GK.timer_ticks % TTSPEED) == 0)
    {
    ++frame_number;
    frame_number %= FRAMES_COUNT;
    gkrellm_draw_decal_pixmap(panel, earth, frame_number);
    gkrellm_draw_layers(panel);
    }
}

static void
earth_create_tab(GtkWidget *tab_vbox)
{
    GtkWidget		*tabs;
    
    tabs = gtk_notebook_new();
    gtk_notebook_set_tab_pos(GTK_NOTEBOOK(tabs), GTK_POS_TOP);
    gtk_box_pack_start(GTK_BOX(tab_vbox), tabs, TRUE, TRUE, 0);
	
	{
	    gchar *plugin_about_text;
	    GtkWidget *label, *text;

	    plugin_about_text = g_strdup_printf(
		"Earth Animation %s\n"
		"GKrellM Earth Animation Plugin\n\n"
		"Copyright (C) 2001 Brad Abel\n"
		"envy@cybergoth.zzn.com\n\n"
		"Released under the GNU Public Licence",
		EARTH_ANIM_VERSION);
	    
	    text = gtk_label_new(plugin_about_text); 
	    label = gtk_label_new("About");
	    gtk_notebook_append_page(GTK_NOTEBOOK(tabs),text,label);
	    g_free(plugin_about_text);
	}
}    

static gint
start_stop_anim (GtkWidget *widget, GdkEventButton *ev)
{
	switch (ev->button)
	{
	case 1:
		if ( start_stop_anim_value == 1 )
			start_stop_anim_value = 0;
		else start_stop_anim_value = 1;
		break;
	case 3:
		if (start_stop_anim_value == 1)
			start_stop_anim_value = 0;
		else start_stop_anim_value = 1;
		break;
	}
	return FALSE;
}

static void
earth_create_plugin(GtkWidget *vbox, gint first_create)
{
   Style	   *style = NULL;
    int            frame_x_offset;
    int            frame_y_offset;

    load_animation();

    if (first_create) panel = gkrellm_panel_new0();
    else {gkrellm_destroy_decal_list(panel);}

    style = gkrellm_meter_style(style_id);

    frame_x_offset = (gkrellm_chart_width() - FRAME_WIDTH) / 2;
    frame_y_offset = (EARTH_PANEL_HEIGHT - FRAME_HEIGHT) / 2;

    earth = gkrellm_create_decal_pixmap(panel, earth_image, earth_mask,
				       FRAMES_COUNT,
				       style, frame_x_offset, frame_y_offset);

    panel->textstyle = gkrellm_meter_textstyle(style_id);
    panel->label->h_panel = EARTH_PANEL_HEIGHT;      
    gkrellm_create_panel(vbox, panel, gkrellm_bg_meter_image(style_id));
    gkrellm_monitor_height_adjust(panel->h);

    if (first_create) {
        gtk_signal_connect(GTK_OBJECT(panel->drawing_area),
			   "expose_event", (GtkSignalFunc) panel_expose_event,
			   NULL);
        gtk_signal_connect (GTK_OBJECT (panel->drawing_area),
		      "button_press_event", (GtkSignalFunc) start_stop_anim , NULL);
	              }
    gkrellm_draw_decal_pixmap(panel, earth, 0);
    gkrellm_draw_layers(panel);
}

static Monitor  plugin_mon  =
        {
        "Earth Animation",         /* Name, for config tab.  */
        0,              /* Id,  0 if a plugin           */
        earth_create_plugin,  /* The create_plugin() function */
        earth_update_plugin,  /* The update_plugin() function */
        earth_create_tab,     /* The create_plugin_tab() config function */
        NULL,           /* The apply_plugin_config() function  */

        NULL,           /* The save_plugin_config() function  */
        NULL,           /* The load_plugin_config() function  */
        PLUGIN_CONFIG_KEYWORD,     /* config keyword  */

        NULL,           /* Undefined 2  */
        NULL,           /* Undefined 1  */
        NULL,           /* Undefined 0  */

        MON_INSERT_AFTER|MON_CLOCK, /* Insert plugin before this monitor.*/
        NULL,           /* Handle if a plugin, filled in by GKrellM */
        NULL            /* path if a plugin, filled in by GKrellM   */
        };

//->this is line 170 
Monitor *
init_plugin(void)
        {
        style_id = gkrellm_add_meter_style(&plugin_mon, STYLE_NAME);
	return &plugin_mon;
        }
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration