plugin_obj = new PluginObj();
modules = new ArrayList<Module*>;
nodes = new ArrayList<VirtualNode*>;
+ tip = 0;
}
PluginServer::PluginServer()
plugin_obj = that.plugin_obj;
plugin_obj->add_user();
title = !that.title ? 0 : cstrdup(that.title);
+ tip = !that.tip ? 0 : cstrdup(that.tip);
path = !that.path ? 0 : cstrdup(that.path);
ff_name = !that.ff_name ? 0 : cstrdup(that.ff_name);
modules = new ArrayList<Module*>;
delete [] path;
delete [] ff_name;
delete [] title;
+ delete [] tip;
delete modules;
delete nodes;
delete picon;
uses_gui = 0;
transition = 0;
title = 0;
+ tip = 0;
path = 0;
data_text = 0;
for( int i=sizeof(args)/sizeof(args[0]); --i>=0; ) args[i] = 0;
}
-int PluginServer::get_theme_png_path(char *png_path, const char *theme_dir)
+int PluginServer::get_plugin_png_path(char *png_path, const char *plugin_icons)
{
- char *bp = strrchr(path, '/');
- if( !bp ) bp = path; else ++bp;
- char *sp = strrchr(bp,'.');
- if( !sp ) sp = bp + strlen(bp);
- char *cp = png_path, *dp = bp;
- cp += sprintf(cp,"%s/%s/", mwindow->preferences->plugin_dir, theme_dir);
- while( dp < sp ) *cp++ = *dp++;
- strcpy(cp, ".png");
- struct stat st;
- if( stat(png_path, &st) ) return 0;
- if( !S_ISREG(st.st_mode) ) return 0;
- if( st.st_size == 0 ) return 0;
- return st.st_size;
-}
-
-int PluginServer::get_theme_png_path(char *png_path, Theme *theme)
-{
- char *bp = strrchr(theme->path, '/');
- if( !bp ) bp = theme->path; else ++bp;
- char *sp = strrchr(bp,'.');
- if( !sp || ( strcmp(sp, ".plugin") && strcmp(sp,".so") ) ) return 0;
- char theme_dir[BCTEXTLEN], *cp = theme_dir;
- while( bp < sp ) *cp++ = *bp++;
- *cp = 0;
- return get_theme_png_path(png_path, theme_dir);
+ char *pp = png_path, *ep = pp + BCTEXTLEN-1;
+ pp += snprintf(pp, ep-pp, "%s/picon_%s/",
+ File::get_plugin_path(), plugin_icons);
+ char *cp = strrchr(path, '/');
+ cp = !cp ? path : cp+1;
+ char *sp = strrchr(cp, '.');
+ if( !sp ) sp = cp+strlen(cp);
+ while( pp < ep && cp < sp ) *pp++ = *cp++;
+ snprintf(pp, ep-pp, ".png");
+ return access(png_path,R_OK) ? 1 : 0;
}
int PluginServer::get_plugin_png_path(char *png_path)
{
- int len = get_theme_png_path(png_path, mwindow->theme);
- if( !len )
- len = get_theme_png_path(png_path, "picon");
- return len;
+ int ret = get_plugin_png_path(png_path, mwindow->preferences->plugin_icons);
+ if( ret ) ret = get_plugin_png_path(png_path, DEFAULT_PICON);
+ return ret;
}
VFrame *PluginServer::get_plugin_images()
{
char png_path[BCTEXTLEN];
- if( !get_plugin_png_path(png_path) ) return 0;
+ if( get_plugin_png_path(png_path) ) return 0;
return VFramePng::vframe_png(png_path,0,0);
}