Commit 8127d35d authored by Claes Sjofors's avatar Claes Sjofors

Distributor, display version info for package (refs #118)

parent 91f9f52f
...@@ -303,15 +303,15 @@ WPkgGtk::WPkgGtk( ...@@ -303,15 +303,15 @@ WPkgGtk::WPkgGtk(
GtkWidget *view_zoom_reset = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_100, NULL); GtkWidget *view_zoom_reset = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_100, NULL);
g_signal_connect(view_zoom_reset, "activate", G_CALLBACK(WPkgGtk::activate_zoom_reset), this); g_signal_connect(view_zoom_reset, "activate", G_CALLBACK(WPkgGtk::activate_zoom_reset), this);
GtkWidget *view_dmode_filediff = gtk_menu_item_new_with_mnemonic( "_Display File Differences"); GtkWidget *view_dmode_filediff = gtk_check_menu_item_new_with_mnemonic( "_Display File Differences");
g_signal_connect( view_dmode_filediff, "activate", g_signal_connect( view_dmode_filediff, "activate",
G_CALLBACK(WPkgGtk::activate_dmode_filediff), this); G_CALLBACK(WPkgGtk::activate_dmode_filediff), this);
GtkWidget *view_dmode_filetime = gtk_menu_item_new_with_mnemonic( "Display Files In _Time Order"); GtkWidget *view_dmode_filetime = gtk_check_menu_item_new_with_mnemonic( "Display Files In _Time Order");
g_signal_connect( view_dmode_filetime, "activate", g_signal_connect( view_dmode_filetime, "activate",
G_CALLBACK(WPkgGtk::activate_dmode_filetime), this); G_CALLBACK(WPkgGtk::activate_dmode_filetime), this);
GtkWidget *view_dmode_filepath = gtk_menu_item_new_with_mnemonic( "Display File _Path"); GtkWidget *view_dmode_filepath = gtk_check_menu_item_new_with_mnemonic( "Display File _Path");
g_signal_connect( view_dmode_filepath, "activate", g_signal_connect( view_dmode_filepath, "activate",
G_CALLBACK(WPkgGtk::activate_dmode_filepath), this); G_CALLBACK(WPkgGtk::activate_dmode_filepath), this);
......
...@@ -2755,8 +2755,13 @@ pwr_tStatus lfu_ReadBootFile( ...@@ -2755,8 +2755,13 @@ pwr_tStatus lfu_ReadBootFile(
} }
if ( utl_read_line( buff, sizeof(buff), file, NULL) == 0) { if ( utl_read_line( buff, sizeof(buff), file, NULL) == 0) {
// Sev node bootfile
fclose( file); fclose( file);
return LFU__FILECRP; *volcount = 0;
*plccount = 0;
if ( plclist)
*plclist = (pwr_tString80 *)0;
return LFU__SUCCESS;
} }
if ( plclist) { if ( plclist) {
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include "wb_wnav.h" #include "wb_wnav.h"
#include "wb_wnav_brow.h" #include "wb_wnav_brow.h"
#include "wb_wnav_item.h" #include "wb_wnav_item.h"
#include "wb_lfu.h"
#include "wb_error.h" #include "wb_error.h"
...@@ -575,15 +576,15 @@ int WItemPkgNode::open_children( WNavBrow *brow, double x, double y, int display ...@@ -575,15 +576,15 @@ int WItemPkgNode::open_children( WNavBrow *brow, double x, double y, int display
while ( ODD(sts)) { while ( ODD(sts)) {
brow_GetUserData( child, (void **)&item); brow_GetUserData( child, (void **)&item);
if ( item->time.tv_sec < time.tv_sec) { if ( item->time.tv_sec < time.tv_sec) {
new WItemPkgPackage( brow, file, file, time, child, new WItemPkgPackage( brow, file, file, time,
flow_eDest_Before); nodename, bus, child, flow_eDest_Before);
inserted = 1; inserted = 1;
break; break;
} }
sts = brow_GetNextSibling( brow->ctx, child, &child); sts = brow_GetNextSibling( brow->ctx, child, &child);
} }
if ( !inserted) if ( !inserted)
new WItemPkgPackage( brow, file, file, time, node, new WItemPkgPackage( brow, file, file, time, nodename, bus, node,
flow_eDest_IntoLast); flow_eDest_IntoLast);
pkg_cnt++; pkg_cnt++;
...@@ -604,12 +605,14 @@ int WItemPkgNode::open_children( WNavBrow *brow, double x, double y, int display ...@@ -604,12 +605,14 @@ int WItemPkgNode::open_children( WNavBrow *brow, double x, double y, int display
WItemPkgPackage::WItemPkgPackage( WNavBrow *brow, char *item_name, WItemPkgPackage::WItemPkgPackage( WNavBrow *brow, char *item_name,
char *item_packagename, pwr_tTime item_time, char *item_packagename, pwr_tTime item_time,
char *item_nodename, int item_bus,
brow_tNode dest, flow_eDest dest_code) brow_tNode dest, flow_eDest dest_code)
: time(item_time) : time(item_time), bus(item_bus)
{ {
char timestr[32]; char timestr[32];
strcpy( packagename, item_packagename); strcpy( packagename, item_packagename);
strcpy( nodename, item_nodename);
time_AtoAscii( &time, time_eFormat_DateAndTime, timestr, sizeof(timestr)); time_AtoAscii( &time, time_eFormat_DateAndTime, timestr, sizeof(timestr));
brow_CreateNode( brow->ctx, name, brow->nc_object, brow_CreateNode( brow->ctx, name, brow->nc_object,
...@@ -620,6 +623,106 @@ WItemPkgPackage::WItemPkgPackage( WNavBrow *brow, char *item_name, ...@@ -620,6 +623,106 @@ WItemPkgPackage::WItemPkgPackage( WNavBrow *brow, char *item_name,
} }
int WItemPkgPackage::open_children( WNavBrow *brow, double x, double y, int display_mode) int WItemPkgPackage::open_children( WNavBrow *brow, double x, double y, int display_mode)
{
if ( brow_IsOpen( node)) {
close( brow, 0, 0);
return 1;
}
brow_SetNodraw( brow->ctx);
new WItemPkgInfoHier( brow, "Info", packagename, nodename, bus, node, flow_eDest_IntoLast);
new WItemPkgFileHier( brow, "Files", packagename, node, flow_eDest_IntoLast);
brow_ResetNodraw( brow->ctx);
brow_Redraw( brow->ctx, 0);
brow_SetOpen( node, wnav_mOpen_Children);
return 1;
}
WItemPkgInfoHier::WItemPkgInfoHier( WNavBrow *brow, const char *item_name,
char *item_packagename, char *item_nodename, int item_bus,
brow_tNode dest, flow_eDest dest_code)
: bus(item_bus)
{
strcpy( packagename, item_packagename);
strcpy( nodename, item_nodename);
brow_CreateNode( brow->ctx, name, brow->nc_object,
dest, dest_code, (void *)this, 1, &node);
brow_SetAnnotPixmap( node, 0, brow->pixmap_map);
brow_SetAnnotation( node, 0, item_name, strlen(item_name));
}
int WItemPkgInfoHier::open_children( WNavBrow *brow, double x, double y, int display_mode)
{
pwr_tFileName bootfile;
pwr_tFileName bfile;
pwr_tTime date;
pwr_tString80 systemname;
pwr_tString80 systemgroup;
pwr_tVolumeId *vollist;
pwr_tString40 *volnamelist;
int volcount;
pwr_tString80 *plclist;
int plccount;
char version[40];
pwr_tCmd cmd;
pwr_tStatus sts;
if ( brow_IsOpen( node)) {
close( brow, 0, 0);
return 1;
}
sprintf( bootfile, load_cNameBoot, "pkg_build/", nodename, bus);
sprintf( cmd, "cd $pwrp_tmp; tar -xzf $pwrp_load/%s %s", packagename, bootfile);
system( cmd);
strcpy( bfile, "$pwrp_tmp/");
strcat( bfile, bootfile);
sts = lfu_ReadBootFile( bfile, &date, systemname, systemgroup, &vollist, &volnamelist,
&volcount, &plclist, &plccount);
if ( EVEN(sts)) return sts;
sts = time_AtoAscii( &date, time_eFormat_DateAndTime, version, sizeof(version));
brow_SetNodraw( brow->ctx);
new WItemPkgInfo( brow, "NodeName", nodename, node, flow_eDest_IntoLast);
if ( volcount > 0)
new WItemPkgInfo( brow, "RootVolume", volnamelist[0], node, flow_eDest_IntoLast);
new WItemPkgInfo( brow, "Version", version, node, flow_eDest_IntoLast);
brow_ResetNodraw( brow->ctx);
brow_Redraw( brow->ctx, 0);
brow_SetOpen( node, wnav_mOpen_Children);
return 1;
}
WItemPkgInfo::WItemPkgInfo( WNavBrow *brow, const char *item_name,
char *item_value,
brow_tNode dest, flow_eDest dest_code)
{
strcpy( name, item_name);
strcpy( value, item_value);
brow_CreateNode( brow->ctx, name, brow->nc_object,
dest, dest_code, (void *)this, 1, &node);
brow_SetAnnotPixmap( node, 0, brow->pixmap_leaf);
brow_SetAnnotation( node, 0, item_name, strlen(item_name));
brow_SetAnnotation( node, 1, item_value, strlen(item_value));
}
WItemPkgFileHier::WItemPkgFileHier( WNavBrow *brow, const char *item_name,
char *item_packagename,
brow_tNode dest, flow_eDest dest_code)
{
strcpy( packagename, item_packagename);
brow_CreateNode( brow->ctx, name, brow->nc_object,
dest, dest_code, (void *)this, 1, &node);
brow_SetAnnotPixmap( node, 0, brow->pixmap_map);
brow_SetAnnotation( node, 0, item_name, strlen(item_name));
}
int WItemPkgFileHier::open_children( WNavBrow *brow, double x, double y, int display_mode)
{ {
char cmd[200]; char cmd[200];
char tmpfile[200]; char tmpfile[200];
...@@ -630,12 +733,14 @@ int WItemPkgPackage::open_children( WNavBrow *brow, double x, double y, int disp ...@@ -630,12 +733,14 @@ int WItemPkgPackage::open_children( WNavBrow *brow, double x, double y, int disp
pwr_tTime time; pwr_tTime time;
int file_cnt = 0; int file_cnt = 0;
WItemPkgFile *item; WItemPkgFile *item;
WItemPkgPackage *next_item = 0; WItemPkgFileHier *next_files_item = 0;
WItemPkgPackage *next_pkg_item = 0;
int inserted = 0; int inserted = 0;
brow_tObject child; brow_tObject child;
int sts; int sts;
brow_tObject next; brow_tObject next_pkg, next_files, parent;
int next_was_open = 0; int next_pkg_was_open = 0;
int next_files_was_open = 0;
if ( brow_IsOpen( node)) { if ( brow_IsOpen( node)) {
close( brow, 0, 0); close( brow, 0, 0);
...@@ -653,14 +758,38 @@ int WItemPkgPackage::open_children( WNavBrow *brow, double x, double y, int disp ...@@ -653,14 +758,38 @@ int WItemPkgPackage::open_children( WNavBrow *brow, double x, double y, int disp
if ( display_mode & wpkg_mDisplayMode_FileDiff) { if ( display_mode & wpkg_mDisplayMode_FileDiff) {
// Display only file with newer date compared to previous package // Display only file with newer date compared to previous package
sts = brow_GetNextSibling( brow->ctx, node, &next); sts = brow_GetParent( brow->ctx, node, &parent);
if ( ODD(sts))
sts = brow_GetNextSibling( brow->ctx, parent, &next_pkg);
if ( ODD(sts)) {
brow_GetUserData( next_pkg, (void **)&next_pkg_item);
if ( brow_IsOpen( next_pkg)) {
sts = brow_GetChild( brow->ctx, next_pkg, &next_files);
if ( ODD(sts))
sts = brow_GetNextSibling( brow->ctx, next_files, &next_files);
if ( ODD(sts)) {
brow_GetUserData( next_files, (void **)&next_files_item);
if ( brow_IsOpen( next_files))
next_files_was_open = 1;
}
next_pkg_item->close( brow, 0, 0);
next_pkg_was_open = 1;
}
next_pkg_item->open_children( brow, 0, 0, wpkg_mDisplayMode__);
sts = brow_GetChild( brow->ctx, next_pkg, &next_files);
if ( ODD(sts))
sts = brow_GetNextSibling( brow->ctx, next_files, &next_files);
if ( ODD(sts)) { if ( ODD(sts)) {
brow_GetUserData( next, (void **)&next_item); brow_GetUserData( next_files, (void **)&next_files_item);
if ( brow_IsOpen( next)) { if ( brow_IsOpen( next_files)) {
next_item->close( brow, 0, 0); next_files_item->close( brow, 0, 0);
next_was_open = 1; }
next_files_item->open_children( brow, 0, 0, wpkg_mDisplayMode__);
} }
next_item->open_children( brow, 0, 0, wpkg_mDisplayMode__); else
// No next sibling, display all files
display_mode &= ~wpkg_mDisplayMode_FileDiff;
} }
else else
// No next sibling, display all files // No next sibling, display all files
...@@ -684,7 +813,7 @@ int WItemPkgPackage::open_children( WNavBrow *brow, double x, double y, int disp ...@@ -684,7 +813,7 @@ int WItemPkgPackage::open_children( WNavBrow *brow, double x, double y, int disp
if ( display_mode & wpkg_mDisplayMode_FileDiff) { if ( display_mode & wpkg_mDisplayMode_FileDiff) {
// Check if this file is changed // Check if this file is changed
int keep = 1; int keep = 1;
sts = brow_GetChild( brow->ctx, next, &child); sts = brow_GetChild( brow->ctx, next_files, &child);
while ( ODD(sts)) { while ( ODD(sts)) {
brow_GetUserData( child, (void **)&item); brow_GetUserData( child, (void **)&item);
if ( strcmp( item->filename, line_item[2]) == 0) { if ( strcmp( item->filename, line_item[2]) == 0) {
...@@ -726,10 +855,20 @@ int WItemPkgPackage::open_children( WNavBrow *brow, double x, double y, int disp ...@@ -726,10 +855,20 @@ int WItemPkgPackage::open_children( WNavBrow *brow, double x, double y, int disp
is.close(); is.close();
if ( display_mode & wpkg_mDisplayMode_FileDiff && next_item) { if ( display_mode & wpkg_mDisplayMode_FileDiff && next_pkg_item) {
next_item->close( brow, 0, 0); next_pkg_item->close( brow, 0, 0);
if ( next_was_open) if ( next_pkg_was_open) {
next_item->open_children( brow, 0, 0, display_mode); next_pkg_item->open_children( brow, 0, 0, display_mode);
if ( next_files_was_open) {
sts = brow_GetChild( brow->ctx, next_pkg, &next_files);
if ( ODD(sts))
sts = brow_GetNextSibling( brow->ctx, next_files, &next_files);
if ( ODD(sts)) {
brow_GetUserData( next_files, (void **)&next_files_item);
next_files_item->open_children( brow, 0, 0, display_mode);
}
}
}
} }
if ( file_cnt) { if ( file_cnt) {
......
...@@ -136,11 +136,41 @@ class WItemPkgNode : public WItemPkg { ...@@ -136,11 +136,41 @@ class WItemPkgNode : public WItemPkg {
class WItemPkgPackage : public WItemPkg { class WItemPkgPackage : public WItemPkg {
public: public:
WItemPkgPackage( WNavBrow *brow, char *item_name, char *item_packagename, pwr_tTime item_time, WItemPkgPackage( WNavBrow *brow, char *item_name, char *item_packagename,
pwr_tTime item_time, char *item_nodename, int item_bus,
brow_tNode dest, flow_eDest dest_code); brow_tNode dest, flow_eDest dest_code);
int open_children( WNavBrow *brow, double x, double y, int display_mode); int open_children( WNavBrow *brow, double x, double y, int display_mode);
char packagename[120]; char packagename[120];
pwr_tTime time; pwr_tTime time;
char nodename[32];
int bus;
};
class WItemPkgFileHier : public WItemPkg {
public:
WItemPkgFileHier( WNavBrow *brow, const char *item_name, char *item_packagename,
brow_tNode dest, flow_eDest dest_code);
int open_children( WNavBrow *brow, double x, double y, int display_mode);
char packagename[120];
};
class WItemPkgInfoHier : public WItemPkg {
public:
WItemPkgInfoHier( WNavBrow *brow, const char *item_name,
char *item_packagename, char *item_nodename, int item_bus,
brow_tNode dest, flow_eDest dest_code);
int open_children( WNavBrow *brow, double x, double y, int display_mode);
char packagename[120];
char nodename[120];
int bus;
};
class WItemPkgInfo : public WItemPkg {
public:
WItemPkgInfo( WNavBrow *brow, const char *item_name, char *item_value,
brow_tNode dest, flow_eDest dest_code);
char name[120];
char value[120];
}; };
class WItemPkgFile : public WItemPkg { class WItemPkgFile : public WItemPkg {
...@@ -154,5 +184,3 @@ class WItemPkgFile : public WItemPkg { ...@@ -154,5 +184,3 @@ class WItemPkgFile : public WItemPkg {
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment