00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 #include <gtk/gtk.h>
00059 #include "config.h"
00060 #include "gxsm/plugin.h"
00061 #include "include/dsp-pci32/xsm/xsmcmd.h"
00062
00063 using namespace std;
00064
00065
00066
00067
00068
00069
00070 static void extra_scan_info_init( void );
00071 static void extra_scan_info_query( void );
00072 static void extra_scan_info_cleanup( void );
00073 static void extra_scan_info_configure( void );
00074 static void extra_scan_info_about( void );
00075 static void extra_scan_info_run(GtkWidget *w, void *data);
00076
00077 static void extra_scan_info_SaveValues_callback ( gpointer );
00078 static void extra_scan_info_LoadValues_callback ( gpointer );
00079
00080
00081 GxsmPlugin extra_scan_info_pi = {
00082 NULL,
00083 NULL,
00084 0,
00085 NULL,
00086 "extra_scan_info",
00087 NULL,
00088 NULL,
00089 "Percy Zahl",
00090 N_("_Tools/"),
00091 N_("Extra Scan Info"),
00092 N_("Show, save and load extra scan informations"),
00093 "no more info",
00094 NULL,
00095 NULL,
00096 extra_scan_info_init,
00097 extra_scan_info_query,
00098 extra_scan_info_about,
00099 extra_scan_info_configure,
00100 extra_scan_info_run,
00101 extra_scan_info_cleanup
00102 };
00103
00104 GxsmPlugin *get_gxsm_plugin_info ( void ){
00105 extra_scan_info_pi.description = g_strdup_printf(N_("extra_scan_info Plugin %s"), VERSION);
00106 return &extra_scan_info_pi;
00107 }
00108
00109 static void extra_scan_info_init(void){
00110 XsmRescourceManager xrm("extra_scan_info");
00111
00112 xrm.Put ("info_0", "extra scan info null");
00113 }
00114
00115 static void extra_scan_info_query(void){
00116 PI_DEBUG (DBG_L4, "Extra Scan Info::Query, connecting callbacks\n");
00117 extra_scan_info_pi.app->ConnectPluginToCDFSaveEvent (extra_scan_info_SaveValues_callback);
00118 extra_scan_info_pi.app->ConnectPluginToCDFLoadEvent (extra_scan_info_LoadValues_callback);
00119
00120 if (extra_scan_info_pi.status)
00121 g_free (extra_scan_info_pi.status);
00122
00123 extra_scan_info_pi.status = g_strdup ("query::command=install_menus");
00124 }
00125
00126 static void extra_scan_info_configure(void){
00127 }
00128
00129 static void extra_scan_info_about(void){
00130 const gchar *authors[] = { "Percy Zahl", NULL};
00131 gtk_widget_show (
00132 gnome_about_new ( extra_scan_info_pi.name,
00133 VERSION,
00134 N_("(C) 2000 the Free Software Foundation"),
00135 "This PlugIn does show, load and save handling of "
00136 "extra scan informations.",
00137 authors,
00138 NULL, NULL, NULL
00139 ));
00140 }
00141
00142 static void extra_scan_info_run(GtkWidget *w, void *data){
00143 PI_DEBUG (DBG_L4, "Extra Scan Info::ShowValues (run) callback\n");
00144 GString *gs_info=NULL;
00145 ifstream f_info;
00146 f_info.open("gxsm_extra_scan_info", ios::in);
00147
00148 if(!f_info.good())
00149 gs_info = g_string_new ("Extra Scan Info: N/A");
00150 else
00151 gs_info = g_string_new ("Extra Scan Info: OK\n");
00152
00153 while(f_info.good()){
00154 gchar line[0x4000];
00155 f_info.getline (line, 0x4000);
00156
00157
00158 g_string_append (gs_info, line);
00159 g_string_append (gs_info, "\n");
00160 }
00161
00162 f_info.close ();
00163 PI_DEBUG (DBG_L4, gs_info->str);
00164
00165 gapp->message (gs_info->str);
00166
00167 g_string_free(gs_info, TRUE);
00168 }
00169
00170 static void extra_scan_info_cleanup( void ){
00171 }
00172
00173 static void extra_scan_info_SaveValues_callback ( gpointer gp_ncf ){
00174 GString *gs_info=NULL;
00175 NcFile *ncf = (NcFile *) gp_ncf;
00176 PI_DEBUG (DBG_L4, "Extra Scan Info::SaveValues_callback\n");
00177 ifstream f_info;
00178 f_info.open("gxsm_extra_scan_info", ios::in);
00179
00180 if(!f_info.good())
00181 gs_info = g_string_new ("Extra Scan Info: N/A");
00182 else
00183 gs_info = g_string_new ("Extra Scan Info: OK\n");
00184
00185 while(f_info.good()){
00186 gchar line[0x4000];
00187 f_info.getline (line, 0x4000);
00188
00189
00190 g_string_append (gs_info, line);
00191 g_string_append (gs_info, "\n");
00192 }
00193
00194 f_info.close ();
00195
00196 NcDim* infod = ncf->add_dim("extra_scan_info_dim", strlen(gs_info->str));
00197 NcVar* info = ncf->add_var("extra_scan_info", ncChar, infod);
00198 info->add_att("long_name", "extra scan information");
00199 info->put(gs_info->str, strlen(gs_info->str));
00200 g_string_free(gs_info, TRUE);
00201 }
00202
00203 #define NC_GET_VARIABLE(VNAME, VAR) if(ncf->get_var(VNAME)) ncf->get_var(VNAME)->get(VAR)
00204
00205 static void extra_scan_info_LoadValues_callback ( gpointer gp_ncf ){
00206 NcFile *ncf = (NcFile *) gp_ncf;
00207 PI_DEBUG (DBG_L4, "Extra Scan Info::LoadValues_callback\n");
00208
00209 }